mirror of
https://github.com/sasjs/core.git
synced 2026-01-07 09:30:06 +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
|
,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 access_token_var= The global macro variable to contain the access token
|
||||||
@param grant_type= valid values:
|
@param grant_type= valid values:
|
||||||
@@ -12310,10 +12316,14 @@ libname &libref1 clear;
|
|||||||
|
|
||||||
@param path= The SAS Drive path to the job being executed
|
@param path= The SAS Drive path to the job being executed
|
||||||
@param name= The name of the job to execute
|
@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.
|
@param contextName= Context name with which to run the job.
|
||||||
Default = `SAS Job Execution compute context`
|
Default = `SAS Job Execution compute context`
|
||||||
|
|
||||||
|
@param outds= The output dataset containing links (Default=work.mv_jobexecute)
|
||||||
|
|
||||||
|
|
||||||
@version VIYA V.03.04
|
@version VIYA V.03.04
|
||||||
@author Allan Bowe, source: https://github.com/sasjs/core
|
@author Allan Bowe, source: https://github.com/sasjs/core
|
||||||
@@ -12322,6 +12332,7 @@ libname &libref1 clear;
|
|||||||
@li mp_abort.sas
|
@li mp_abort.sas
|
||||||
@li mf_getplatform.sas
|
@li mf_getplatform.sas
|
||||||
@li mf_getuniquefileref.sas
|
@li mf_getuniquefileref.sas
|
||||||
|
@li mf_getuniquelibref.sas
|
||||||
@li mv_getfoldermembers.sas
|
@li mv_getfoldermembers.sas
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@@ -12331,6 +12342,8 @@ libname &libref1 clear;
|
|||||||
,contextName=SAS Job Execution compute context
|
,contextName=SAS Job Execution compute context
|
||||||
,access_token_var=ACCESS_TOKEN
|
,access_token_var=ACCESS_TOKEN
|
||||||
,grant_type=sas_services
|
,grant_type=sas_services
|
||||||
|
,paramstring=0
|
||||||
|
,outds=work.mv_jobexecute
|
||||||
);
|
);
|
||||||
%local oauth_bearer;
|
%local oauth_bearer;
|
||||||
%if &grant_type=detect %then %do;
|
%if &grant_type=detect %then %do;
|
||||||
@@ -12392,11 +12405,16 @@ run;
|
|||||||
|
|
||||||
data _null_;
|
data _null_;
|
||||||
file &fname0;
|
file &fname0;
|
||||||
put '{"jobDefinitionUri": "'@@;
|
length joburi contextname $128 paramstring $32765;
|
||||||
put "&joburi"@@;
|
joburi=quote(trim(symget('joburi')));
|
||||||
put '","arguments":{"_contextName":"'@@;
|
contextname=quote(trim(symget('contextname')));
|
||||||
put "&contextName"@@;
|
paramstring=symget('paramstring');
|
||||||
put '"}}';
|
put '{"jobDefinitionUri":' joburi ;
|
||||||
|
put ' ,"arguments":{"_contextName":' contextname;
|
||||||
|
if paramstring ne "0" then do;
|
||||||
|
put ' ,' paramstring;
|
||||||
|
end;
|
||||||
|
put '}}';
|
||||||
run;
|
run;
|
||||||
|
|
||||||
proc http method='POST' in=&fname0 out=&fname1 &oauth_bearer
|
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;
|
%end;
|
||||||
;
|
;
|
||||||
run;
|
run;
|
||||||
/*data _null_;infile &fname1;input;putlog _infile_;run;*/
|
%if &SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201 %then
|
||||||
|
%do;
|
||||||
%mp_abort(iftrue=(
|
data _null_;infile &fname0;input;putlog _infile_;run;
|
||||||
&SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201
|
data _null_;infile &fname1;input;putlog _infile_;run;
|
||||||
)
|
%mp_abort(mac=&sysmacroname
|
||||||
,mac=&sysmacroname
|
|
||||||
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
,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 */
|
/* clear refs */
|
||||||
filename &fname0 clear;
|
filename &fname0 clear;
|
||||||
filename &fname1 clear;
|
filename &fname1 clear;
|
||||||
|
libname &libref;
|
||||||
|
|
||||||
%mend;/**
|
%mend;/**
|
||||||
@file mv_registerclient.sas
|
@file mv_registerclient.sas
|
||||||
|
|||||||
@@ -16,6 +16,12 @@
|
|||||||
,name=somejob
|
,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 access_token_var= The global macro variable to contain the access token
|
||||||
@param grant_type= valid values:
|
@param grant_type= valid values:
|
||||||
@@ -27,10 +33,14 @@
|
|||||||
|
|
||||||
@param path= The SAS Drive path to the job being executed
|
@param path= The SAS Drive path to the job being executed
|
||||||
@param name= The name of the job to execute
|
@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.
|
@param contextName= Context name with which to run the job.
|
||||||
Default = `SAS Job Execution compute context`
|
Default = `SAS Job Execution compute context`
|
||||||
|
|
||||||
|
@param outds= The output dataset containing links (Default=work.mv_jobexecute)
|
||||||
|
|
||||||
|
|
||||||
@version VIYA V.03.04
|
@version VIYA V.03.04
|
||||||
@author Allan Bowe, source: https://github.com/sasjs/core
|
@author Allan Bowe, source: https://github.com/sasjs/core
|
||||||
@@ -39,6 +49,7 @@
|
|||||||
@li mp_abort.sas
|
@li mp_abort.sas
|
||||||
@li mf_getplatform.sas
|
@li mf_getplatform.sas
|
||||||
@li mf_getuniquefileref.sas
|
@li mf_getuniquefileref.sas
|
||||||
|
@li mf_getuniquelibref.sas
|
||||||
@li mv_getfoldermembers.sas
|
@li mv_getfoldermembers.sas
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@@ -48,6 +59,8 @@
|
|||||||
,contextName=SAS Job Execution compute context
|
,contextName=SAS Job Execution compute context
|
||||||
,access_token_var=ACCESS_TOKEN
|
,access_token_var=ACCESS_TOKEN
|
||||||
,grant_type=sas_services
|
,grant_type=sas_services
|
||||||
|
,paramstring=0
|
||||||
|
,outds=work.mv_jobexecute
|
||||||
);
|
);
|
||||||
%local oauth_bearer;
|
%local oauth_bearer;
|
||||||
%if &grant_type=detect %then %do;
|
%if &grant_type=detect %then %do;
|
||||||
@@ -109,11 +122,16 @@ run;
|
|||||||
|
|
||||||
data _null_;
|
data _null_;
|
||||||
file &fname0;
|
file &fname0;
|
||||||
put '{"jobDefinitionUri": "'@@;
|
length joburi contextname $128 paramstring $32765;
|
||||||
put "&joburi"@@;
|
joburi=quote(trim(symget('joburi')));
|
||||||
put '","arguments":{"_contextName":"'@@;
|
contextname=quote(trim(symget('contextname')));
|
||||||
put "&contextName"@@;
|
paramstring=symget('paramstring');
|
||||||
put '"}}';
|
put '{"jobDefinitionUri":' joburi ;
|
||||||
|
put ' ,"arguments":{"_contextName":' contextname;
|
||||||
|
if paramstring ne "0" then do;
|
||||||
|
put ' ,' paramstring;
|
||||||
|
end;
|
||||||
|
put '}}';
|
||||||
run;
|
run;
|
||||||
|
|
||||||
proc http method='POST' in=&fname0 out=&fname1 &oauth_bearer
|
proc http method='POST' in=&fname0 out=&fname1 &oauth_bearer
|
||||||
@@ -125,17 +143,26 @@ proc http method='POST' in=&fname0 out=&fname1 &oauth_bearer
|
|||||||
%end;
|
%end;
|
||||||
;
|
;
|
||||||
run;
|
run;
|
||||||
/*data _null_;infile &fname1;input;putlog _infile_;run;*/
|
%if &SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201 %then
|
||||||
|
%do;
|
||||||
%mp_abort(iftrue=(
|
data _null_;infile &fname0;input;putlog _infile_;run;
|
||||||
&SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201
|
data _null_;infile &fname1;input;putlog _infile_;run;
|
||||||
)
|
%mp_abort(mac=&sysmacroname
|
||||||
,mac=&sysmacroname
|
|
||||||
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
,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 */
|
/* clear refs */
|
||||||
filename &fname0 clear;
|
filename &fname0 clear;
|
||||||
filename &fname1 clear;
|
filename &fname1 clear;
|
||||||
|
libname &libref;
|
||||||
|
|
||||||
%mend;
|
%mend;
|
||||||
Reference in New Issue
Block a user