mirror of
https://github.com/sasjs/core.git
synced 2025-12-11 06:24:35 +00:00
fix: adding outds and parameters to mv_jobexecute
This commit is contained in:
53
all.sas
53
all.sas
@@ -12299,6 +12299,12 @@ libname &libref1 clear;
|
||||
,name=somejob
|
||||
)
|
||||
|
||||
Example with parameters:
|
||||
|
||||
%mv_jobexecute(path=/Public/folder
|
||||
,name=somejob
|
||||
,paramstring=%str("macvarname":"macvarvalue","answer":42)
|
||||
)
|
||||
|
||||
@param access_token_var= The global macro variable to contain the access token
|
||||
@param grant_type= valid values:
|
||||
@@ -12310,10 +12316,14 @@ libname &libref1 clear;
|
||||
|
||||
@param path= The SAS Drive path to the job being executed
|
||||
@param name= The name of the job to execute
|
||||
@param params= A macro quoted string to append to the URL
|
||||
@param paramstring= A JSON fragment with name:value pairs, eg: `"name":"value"`
|
||||
or "name":"value","name2":42`. This will need to be wrapped in `%str()`.
|
||||
|
||||
@param contextName= Context name with which to run the job.
|
||||
Default = `SAS Job Execution compute context`
|
||||
|
||||
@param outds= The output dataset containing links (Default=work.mv_jobexecute)
|
||||
|
||||
|
||||
@version VIYA V.03.04
|
||||
@author Allan Bowe, source: https://github.com/sasjs/core
|
||||
@@ -12322,6 +12332,7 @@ libname &libref1 clear;
|
||||
@li mp_abort.sas
|
||||
@li mf_getplatform.sas
|
||||
@li mf_getuniquefileref.sas
|
||||
@li mf_getuniquelibref.sas
|
||||
@li mv_getfoldermembers.sas
|
||||
|
||||
**/
|
||||
@@ -12331,6 +12342,8 @@ libname &libref1 clear;
|
||||
,contextName=SAS Job Execution compute context
|
||||
,access_token_var=ACCESS_TOKEN
|
||||
,grant_type=sas_services
|
||||
,paramstring=0
|
||||
,outds=work.mv_jobexecute
|
||||
);
|
||||
%local oauth_bearer;
|
||||
%if &grant_type=detect %then %do;
|
||||
@@ -12392,11 +12405,16 @@ run;
|
||||
|
||||
data _null_;
|
||||
file &fname0;
|
||||
put '{"jobDefinitionUri": "'@@;
|
||||
put "&joburi"@@;
|
||||
put '","arguments":{"_contextName":"'@@;
|
||||
put "&contextName"@@;
|
||||
put '"}}';
|
||||
length joburi contextname $128 paramstring $32765;
|
||||
joburi=quote(trim(symget('joburi')));
|
||||
contextname=quote(trim(symget('contextname')));
|
||||
paramstring=symget('paramstring');
|
||||
put '{"jobDefinitionUri":' joburi ;
|
||||
put ' ,"arguments":{"_contextName":' contextname;
|
||||
if paramstring ne "0" then do;
|
||||
put ' ,' paramstring;
|
||||
end;
|
||||
put '}}';
|
||||
run;
|
||||
|
||||
proc http method='POST' in=&fname0 out=&fname1 &oauth_bearer
|
||||
@@ -12408,18 +12426,27 @@ proc http method='POST' in=&fname0 out=&fname1 &oauth_bearer
|
||||
%end;
|
||||
;
|
||||
run;
|
||||
/*data _null_;infile &fname1;input;putlog _infile_;run;*/
|
||||
|
||||
%mp_abort(iftrue=(
|
||||
&SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201
|
||||
%if &SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201 %then
|
||||
%do;
|
||||
data _null_;infile &fname0;input;putlog _infile_;run;
|
||||
data _null_;infile &fname1;input;putlog _infile_;run;
|
||||
%mp_abort(mac=&sysmacroname
|
||||
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
||||
)
|
||||
,mac=&sysmacroname
|
||||
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
||||
)
|
||||
%end;
|
||||
|
||||
%local libref;
|
||||
%let libref=%mf_getuniquelibref();
|
||||
libname &libref JSON fileref=&fname1;
|
||||
|
||||
data &outds;
|
||||
set &libref..links;
|
||||
run;
|
||||
|
||||
/* clear refs */
|
||||
filename &fname0 clear;
|
||||
filename &fname1 clear;
|
||||
libname &libref;
|
||||
|
||||
%mend;/**
|
||||
@file mv_registerclient.sas
|
||||
|
||||
Reference in New Issue
Block a user