Closed mblauw-sas closed 2 years ago
Hi @mblauw-sas,
Thanks for raising this. After exploring the REST APIs for both Viya 3.5 and 4, and reproducing the above behaviour in Viya 3.5, I believe this is a SAS Bug.
The documentation is very sparse on the matter, but it seems to me that when you create a job definition you provide a bunch of parameters
along with default values.
Here is an example of a SASjs generated job:
{
"creationTimeStamp": "2022-07-13T11:02:47.228Z",
"modifiedTimeStamp": "2022-07-13T11:02:47.228Z",
"createdBy": "allbow",
"modifiedBy": "allbow",
"version": 2,
"id": "5bd61d5d-deb1-49bc-8c5a-78a1a0880abc",
"name": "makedata1",
"type": "Compute",
"parameters": [{
"version": 1,
"name": "_addjesbeginendmacros",
"defaultValue": "false",
"type": "CHARACTER",
"required": false
}],
"code": "* Job Variables start;\n* Job Variables end;\n* SAS Macros start;\n%macro example(msg);\n data work.example;\n msg=symget('msg');\n putlog msg=;\n run;\n%mend example;\n* SAS Macros end;\n* SAS Includes start;\nfilename FREF1 temp;\ndata _null_;\nfile FREF1 lrecl=32767;\nput 'proc sql;';\nput 'create table &mylib..demotable1(';\nput ' tx_from num not null format=datetime19.3';\nput ' ,tx_to num not null format=datetime19.3';\nput ' ,vara varchar(10) not null';\nput ' ,varb varchar(32) not null';\nput ' ,constraint pk_demotable1';\nput ' primary key(tx_from, vara));';\nrun;\nfilename FREF2 temp;\ndata _null_;\nfile FREF2 lrecl=32767;\nput '/* this is just to illustrate possibilities for SAS Program inclusion */';\nput 'data work.append;';\nput ' if 0 then set &mylib..demotable1;';\nput 'infile cards dsd;';\nput 'input tx_from';\nput ' tx_to';\nput ' vara : $char.';\nput ' varb : $char.';\nput ';';\nput 'datalines4;';\nput '0,999999,A,B';\nput ';;;;';\nput 'run;';\nrun;\n* SAS Includes end;\n* Binary Files start;\n* Binary Files end;\n* JobInit start;\n%example(Job Init is executing!)\n%let mylib=WORK;\n* JobInit end;\n* Job start;\n%let pw={sas002}asdfasdf;\n%example(MakeData1 is executing)\n/* these file refs are configurable above */\n%inc FREF1;\n%inc FREF2;\nproc append base=&mylib..demotable1 data=work.append;\nrun;\ndata _null_;\n rc=sleep(10);\nrun;\n* Job end;\n* JobTerm start;\n%example(Job Term is executing!)\n* JobTerm end;",
"links": [{
"method": "GET",
"rel": "self",
"href": "/jobDefinitions/definitions/5bd61d5d-deb1-49bc-8c5a-78a1a0880abc",
"uri": "/jobDefinitions/definitions/5bd61d5d-deb1-49bc-8c5a-78a1a0880abc",
"type": "application/vnd.sas.job.definition"
}, {
"method": "GET",
"rel": "alternate",
"href": "/jobDefinitions/definitions/5bd61d5d-deb1-49bc-8c5a-78a1a0880abc",
"uri": "/jobDefinitions/definitions/5bd61d5d-deb1-49bc-8c5a-78a1a0880abc",
"type": "application/vnd.sas.summary"
}, {
"method": "PUT",
"rel": "update",
"href": "/jobDefinitions/definitions/5bd61d5d-deb1-49bc-8c5a-78a1a0880abc",
"uri": "/jobDefinitions/definitions/5bd61d5d-deb1-49bc-8c5a-78a1a0880abc",
"type": "application/vnd.sas.job.definition",
"responseType": "application/vnd.sas.job.definition"
}, {
"method": "DELETE",
"rel": "delete",
"href": "/jobDefinitions/definitions/5bd61d5d-deb1-49bc-8c5a-78a1a0880abc",
"uri": "/jobDefinitions/definitions/5bd61d5d-deb1-49bc-8c5a-78a1a0880abc"
}],
"properties": []
}
By contrast, when you set up a job request, which is associated with a job definition, you can provide arguments
.
It seems that Environment Manager does not honour the defaults in the parameters
of the job when creating the arguments
of the new job request.
I've also reproduced this by creating a job using SAS Studio, with _addJesBeginEndMacros
set to false, scheduling, and opening in Environment Manager. Same behaviour, so it's nothing to do with SASjs.
I've raised a track: 7613618632
Thank you for looking into this Allan! I have also sent this to our project team such that they are aware.
Ok! I got a response on the ticket, they are able to reproduce. Are we ok to close this issue?
Yes, I will close. Thanks!
Leaving the SAS note here: https://support.sas.com/kb/69/540.html
I deployed my job using sasjs. Now scheduling it from SAS Studio by going to the job and right-click: Schedule Job.
When I open the Job Properties in environment manager, it states thet _addJesBeginEndMacros is not set (or set to true), while it should be set to false (in line with the deployed job settings)