BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Spinnafio
Fluorite | Level 6

Dear All,

 

I have to run some jobs using the command line interface in sas viya 3.4.

I followed the steps in the official documentation, for the creation and execution of jobs but their execution failed.

I have similar jobs with same code, created in SASJobExecution and they work fine there.

 

An example of the job definition template that I used is:

 

{
    "name": "try",
    "type": "Compute",
    "code": " cas casauto  host='xxx' port=5570 ; caslib _all_ assign; proc printto log='/yyy/try1_log.txt' print='/yyy/try1_log.txt' new;run; data _null_; run; proc printto; run; cas casauto terminate;"
}

(the code is just a toy example that creates a cas session and writes some log in a file).

 

The relative job request is 

{
    "version": 0,
    "name": "try1",
    "description": "try1",
    "jobDefinitionUri": "/jobDefinitions/definitions/xxxx-xxxx-xxxx-xxxx",
    "arguments":null,
    "properties": null
}

do you have any ideas or suggestions to solve this problem?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Spinnafio
Fluorite | Level 6

I solved the problem, thanks for your support.

 

The problem was in the CLI of sas viya. I installed the last version (the ones for viya 3.5) and now it works fine.

View solution in original post

8 REPLIES 8
RegevH
SAS Employee
In order to better understand the problem, please use sas-admin command with "--verbose" option . To assist you, please include in your reply the exact sas-admin command as well as the output of the command.

Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

Spinnafio
Fluorite | Level 6

The command that i used was:

sas-admin --verbose job requests execute --id fff24617-a773-4675-9f78-934f4d07df7d

 

 

the output i receved was : ( I coverd the host and the user with some x)

 

level=debug msg="Added translations for locales" language=[]
level=debug msg="Added translations for locales" language=[]
level=debug msg="Adding translation func for locale" language=en-US
level=debug msg="Adding translation func for language" language=en
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en-US\"}"
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en\"}"
level=debug msg="Added translations for locales" language=[]
level=debug msg="Added translations for locales" language="[ko zh-Hans zh-Hant doc.go en ja]"
level=debug msg="Adding translation func for locale" language=en-US
level=debug msg="Adding translation func for language" language=en
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en-US\"}"
level=debug msg="Added translations for locales" language=[]
level=debug msg="Added translations for locales" language="[doc.go en ja ko zh-Hans zh-Hant]"
level=debug msg="Adding translation func for locale" language=en-US
level=debug msg="Adding translation func for language" language=en
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en-US\"}"
level=debug msg="Unable to access bundle, GoMessages_en.properties" err="open GoMessages_en.properties: file does not exist"
level=debug msg="Unable to access bundle, GoMessages_en.properties" err="open GoMessages_en.properties: file does not exist"
level=debug msg="Unable to access bundle, GoMessages_en-US.properties" err="open GoMessages_en-US.properties: file does not exist"
level=debug msg="Added translations for locales" language=[]
level=debug msg="Added translations for locales" language="[en doc.go]"
level=debug msg="Adding translation func for locale" language=en-US
level=debug msg="Adding translation func for language" language=en
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en-US\"}"
level=debug msg="Added translations for locales" language=[]
level=debug msg="Added translations for locales" language="[zh-Hans zh-Hant en ja ko]"
level=debug msg="Adding translation func for locale" language=en_US.UTF-8
level=debug msg="Adding translation func for language" language=en
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en_US.UTF-8\"}"
level=debug msg="Added translations for locales" language=[]
level=debug msg="Added translations for locales" language=[]
level=debug msg="Adding translation func for locale" language=en-US
level=debug msg="Adding translation func for language" language=en
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en-US\"}"
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en\"}"
level=debug msg="Added translations for locales" language=[]
level=debug msg="Added translations for locales" language="[ja ko zh-Hans zh-Hant doc.go en]"
level=debug msg="Adding translation func for locale" language=en-US
level=debug msg="Adding translation func for language" language=en
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en-US\"}"
level=debug msg="Unable to access bundle, GoMessages_en.properties" err="open GoMessages_en.properties: file does not exist"
level=debug msg="Unable to access bundle, GoMessages_en.properties" err="open GoMessages_en.properties: file does not exist"
level=debug msg="Unable to access bundle, GoMessages_en-US.properties" err="open GoMessages_en-US.properties: file does not exist"
level=debug msg="Added translations for locales" language=[]
level=debug msg="Added translations for locales" language="[zh-Hant doc.go en ja ko zh-Hans]"
level=debug msg="Adding translation func for locale" language=en-US
level=debug msg="Adding translation func for language" language=en
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en-US\"}"
level=debug msg="Added translations for locales" language=[]
level=debug msg="Added translations for locales" language="[en doc.go]"
level=debug msg="Adding translation func for locale" language=en-US
level=debug msg="Adding translation func for language" language=en
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en-US\"}"
level=debug msg="Added translations for locales" language=[]
level=debug msg="Added translations for locales" language="[zh-Hans zh-Hant en ja ko]"
level=debug msg="Adding translation func for locale" language=en_US.UTF-8
level=debug msg="Adding translation func for language" language=en
level=debug msg="Error finding translation function" err="no supported languages found []string{\"en_US.UTF-8\"}"
triggers: [{  RunNow 0 []   IMMEDIATE }]

POST /scheduler/jobs HTTP/1.1
Host: xxxxxxxxxxxxxxxxxxxxx
User-Agent: Go-http-client/1.1
Transfer-Encoding: chunked
Accept: application/vnd.sas.schedule.job+json
Accept-Language: en-US,en
Accept-Locale: en-US,en
Authorization: <AUTHORIZATION>
Content-Type: application/vnd.sas.schedule.job+json
Accept-Encoding: gzip

185
{"name":"CLI: Job Request","description":"Job Request scheduled from the sas-job-cli","runAs":"","request":{"uri":"/jobExecution/jobs/fff24617-a773-4675-9f78-934f4d07df7d","method":"POST","headers":{"Accept":["application/vnd.sas.job.execution.job+json"],"Content-Type":["application/vnd.sas.job.execution.job.request+json"]},"body":null},"triggers":[{"name":"RunNow","type":"IMMEDIATE"}]}
0



HTTP/1.1 201
Transfer-Encoding: chunked
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Location: /scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' *.sas.com blob: data:; style-src 'self' 'unsafe-inline'; child-src 'self' blob: data: mailto:;
Content-Type: application/vnd.sas.schedule.job+json
Date: Fri, 24 Apr 2020 12:22:02 GMT
Expires: 0
Last-Modified: Fri, 24 Apr 2020 12:22:02 GMT
Location: /scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0
Pragma: no-cache
Server: Apache/2.4
Vary: User-Agent
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block

9e9
{"creationTimeStamp":"2020-04-24T12:22:02.820Z","modifiedTimeStamp":"2020-04-24T12:22:02.820Z","createdBy":"xxxxx","modifiedBy":"xxxxx","links":[{"method":"GET","rel":"self","href":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0","uri":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0","type":"application/vnd.sas.schedule.job"},{"method":"PUT","rel":"update","href":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0","uri":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0","type":"application/vnd.sas.schedule.job","responseType":"application/vnd.sas.schedule.job"},{"method":"DELETE","rel":"delete","href":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0","uri":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0"},{"method":"GET","rel":"history","href":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0/history","uri":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0/history","type":"application/vnd.sas.collection","itemType":"application/vnd.sas.schedule.history"},{"method":"GET","rel":"jobs","href":"/scheduler/jobs","uri":"/scheduler/jobs","type":"application/vnd.sas.collection","itemType":"application/vnd.sas.schedule.job"},{"method":"POST","rel":"createJob","href":"/scheduler/jobs","uri":"/scheduler/jobs","type":"application/vnd.sas.schedule.job","responseType":"application/vnd.sas.schedule.job"},{"method":"GET","rel":"fireTimes","href":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0/fireTimes","uri":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0/fireTimes","type":"application/vnd.sas.collection"},{"method":"PUT","rel":"pauseJob","href":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0/state?value=paused","uri":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0/state?value=paused"},{"method":"PUT","rel":"resumeJob","href":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0/state?value=resumed","uri":"/scheduler/jobs/a9c7d397-696d-4962-b971-4fe60d1da2b0/state?value=resumed"}],"version":1,"id":"a9c7d397-696d-4962-b971-4fe60d1da2b0","name":"CLI: Job Request","description":"Job Request scheduled from the sas-job-cli","runAs":"xxxxx","request":{"uri":"/jobExecution/jobs/fff24617-a773-4675-9f78-934f4d07df7d","method":"POST","headers":{"Accept":["application/vnd.sas.job.execution.job+json"],"Content-Type":["application/vnd.sas.job.execution.job.request+json"]},"body":null},"triggers":[{"links":[],"version":1,"id":"b19dfd2b-78ae-4c3c-9823-29e5946013d8","name":"RunNow","repeat":0,"type":"IMMEDIATE","active":false}],"jobTimeOut":30}
0


Executed the job request "fff24617-a773-4675-9f78-934f4d07df7d"

 

RegevH
SAS Employee
The last line in the log indicates that the job execution started. Open SAS Viya Environment Manager and switch to the "Jobs" screen. You should see each job executed and the job log. Check the job log and look for errors.

Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

Spinnafio
Fluorite | Level 6

The job executed doesn't appear there.

RegevH
SAS Employee
Would you like to try the examples in the following link ? You might find there the information that will lead you to solve the problem with job execution.
https://github.com/sassoftware/devsascom-rest-api-samples/blob/master/Compute/jobExecution.md

Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

Spinnafio
Fluorite | Level 6

I looked at those examples and I noticed that I didn't specified the following arguments in the job request

 "arguments":{
	"_apslist":"_debug,_clientname,_userlocale",
	"_debug": "log",
	"_clientname": "SASJobExecution",
    "_contextName": "SAS Job Execution compute context",
	"_userlocale": "en_US"
	},

After this correction, the job created runs correctly from the Environment Manager but it didn't work from the Command Line interface.

So I guess the problem is the lack of some arguments but I didn't find any documentation about them.

RegevH
SAS Employee
We can execute jobs either using CLI (sas-admin) or using REST API . Try to execute a job definition that was created using SAS Environment Manager.
Note: The sas-admin CLI is actually using the REST API (issues HTTP calls to SAS Viya services) and provides a subset of the full REST API.
See also the introduction paragraph at https://documentation.sas.com/?docsetId=calcli&docsetTarget=n01xwtcatlinzrn1gztsglukb34a.htm&docsetV...

Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

Spinnafio
Fluorite | Level 6

I solved the problem, thanks for your support.

 

The problem was in the CLI of sas viya. I installed the last version (the ones for viya 3.5) and now it works fine.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 2681 views
  • 0 likes
  • 2 in conversation