mirror of
https://github.com/sasjs/core.git
synced 2026-01-05 00:20:05 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9783edd0e3 | |||
| 961728a987 |
49
all.sas
49
all.sas
@@ -12573,7 +12573,7 @@ filename &fname3 clear;
|
|||||||
|
|
||||||
%mv_getjoblog(uri=&uri,outref=mylog)
|
%mv_getjoblog(uri=&uri,outref=mylog)
|
||||||
|
|
||||||
This macro is used by the mv_jobwaitfor macro, which is generally a more
|
This macro is used by the mv_jobwaitfor.sas macro, which is generally a more
|
||||||
convenient way to wait for the job to finish before fetching the log.
|
convenient way to wait for the job to finish before fetching the log.
|
||||||
|
|
||||||
|
|
||||||
@@ -13378,18 +13378,19 @@ libname &libref;
|
|||||||
|
|
||||||
## Input table (minimum variables needed)
|
## Input table (minimum variables needed)
|
||||||
|
|
||||||
@li FLOW_ID - Numeric value, provides sequential ordering capability
|
|
||||||
@li _CONTEXTNAME - Dictates which context should be used to run the job. If
|
|
||||||
blank, will default to `SAS Job Execution compute context`.
|
|
||||||
@li _PROGRAM - Provides the path to the job itself
|
@li _PROGRAM - Provides the path to the job itself
|
||||||
|
@li FLOW_ID - Numeric value, provides sequential ordering capability. Is
|
||||||
|
optional, will default to 0 if not provided.
|
||||||
|
@li _CONTEXTNAME - Dictates which context should be used to run the job. If
|
||||||
|
blank (or not provided), will default to `SAS Job Execution compute context`.
|
||||||
|
|
||||||
Any additional variables provided in this table are converted into macro
|
Any additional variables provided in this table are converted into macro
|
||||||
variables and passed into the relevant job.
|
variables and passed into the relevant job.
|
||||||
|
|
||||||
| FLOW_ID| _CONTEXTNAME |_PROGRAM|
|
|_PROGRAM| FLOW_ID (optional)| _CONTEXTNAME (optional) |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
|0|SAS Job Execution compute context|/Public/jobs/somejob1|
|
|/Public/jobs/somejob1|0|SAS Job Execution compute context|
|
||||||
|0|SAS Job Execution compute context|/Public/jobs/somejob2|
|
|/Public/jobs/somejob2|0|SAS Job Execution compute context|
|
||||||
|
|
||||||
## Output table (minimum variables produced)
|
## Output table (minimum variables produced)
|
||||||
|
|
||||||
@@ -13450,7 +13451,16 @@ libname &libref;
|
|||||||
|
|
||||||
Trigger the flow
|
Trigger the flow
|
||||||
|
|
||||||
%mv_jobflow(inds=work.inputjobs,outds=work.results,maxconcurrency=4)
|
%mv_jobflow(inds=work.inputjobs
|
||||||
|
,maxconcurrency=4
|
||||||
|
,outds=work.results
|
||||||
|
,outref=myjoblog
|
||||||
|
)
|
||||||
|
|
||||||
|
data _null_;
|
||||||
|
infile myjoblog;
|
||||||
|
input; put _infile_;
|
||||||
|
run;
|
||||||
|
|
||||||
|
|
||||||
@param [in] access_token_var= The global macro variable to contain the access token
|
@param [in] access_token_var= The global macro variable to contain the access token
|
||||||
@@ -13463,6 +13473,7 @@ libname &libref;
|
|||||||
@param [in] inds= The input dataset containing a list of jobs and parameters
|
@param [in] inds= The input dataset containing a list of jobs and parameters
|
||||||
@param [in] maxconcurrency= The max number of parallel jobs to run. Default=8.
|
@param [in] maxconcurrency= The max number of parallel jobs to run. Default=8.
|
||||||
@param [out] outds= The output dataset containing the results
|
@param [out] outds= The output dataset containing the results
|
||||||
|
@param [out] outref= The output fileref to which to append the log file(s).
|
||||||
|
|
||||||
@version VIYA V.03.05
|
@version VIYA V.03.05
|
||||||
@author Allan Bowe, source: https://github.com/sasjs/core
|
@author Allan Bowe, source: https://github.com/sasjs/core
|
||||||
@@ -13482,6 +13493,7 @@ libname &libref;
|
|||||||
,maxconcurrency=8
|
,maxconcurrency=8
|
||||||
,access_token_var=ACCESS_TOKEN
|
,access_token_var=ACCESS_TOKEN
|
||||||
,grant_type=sas_services
|
,grant_type=sas_services
|
||||||
|
,outref=0
|
||||||
);
|
);
|
||||||
%local oauth_bearer;
|
%local oauth_bearer;
|
||||||
%if &grant_type=detect %then %do;
|
%if &grant_type=detect %then %do;
|
||||||
@@ -13504,16 +13516,29 @@ libname &libref;
|
|||||||
,mac=&sysmacroname
|
,mac=&sysmacroname
|
||||||
,msg=%str(Input dataset was not provided)
|
,msg=%str(Input dataset was not provided)
|
||||||
)
|
)
|
||||||
%mp_abort(iftrue=(%mf_existVarList(&inds,_CONTEXTNAME FLOW_ID _PROGRAM)=0)
|
%mp_abort(iftrue=(%mf_existVarList(&inds,_PROGRAM)=0)
|
||||||
,mac=&sysmacroname
|
,mac=&sysmacroname
|
||||||
,msg=%str(The following columns must exist on input dataset &inds:
|
,msg=%str(The _PROGRAM column must exist on input dataset &inds)
|
||||||
_CONTEXTNAME FLOW_ID _PROGRAM)
|
|
||||||
)
|
)
|
||||||
%mp_abort(iftrue=(&maxconcurrency<1)
|
%mp_abort(iftrue=(&maxconcurrency<1)
|
||||||
,mac=&sysmacroname
|
,mac=&sysmacroname
|
||||||
,msg=%str(The maxconcurrency variable should be a positive integer)
|
,msg=%str(The maxconcurrency variable should be a positive integer)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/* set defaults if not provided */
|
||||||
|
%if %mf_existVarList(&inds,_CONTEXTNAME FLOW_ID)=0 %then %do;
|
||||||
|
data &inds;
|
||||||
|
%if %mf_existvarList(&inds,_CONTEXTNAME)=0 %then %do;
|
||||||
|
length _CONTEXTNAME $128;
|
||||||
|
retain _CONTEXTNAME "SAS Job Execution compute context";
|
||||||
|
%end;
|
||||||
|
%if %mf_existvarList(&inds,FLOW_ID)=0 %then %do;
|
||||||
|
retain FLOW_ID 0;
|
||||||
|
%end;
|
||||||
|
set &inds;
|
||||||
|
run;
|
||||||
|
%end;
|
||||||
|
|
||||||
%local missings;
|
%local missings;
|
||||||
proc sql noprint;
|
proc sql noprint;
|
||||||
select count(*) into: missings
|
select count(*) into: missings
|
||||||
@@ -13638,7 +13663,7 @@ data;run;%let jdswaitfor=&syslast;
|
|||||||
%end;
|
%end;
|
||||||
%if &jid=&jcnt %then %do;
|
%if &jid=&jcnt %then %do;
|
||||||
/* we are at the end of the loop - time to see which jobs have finished */
|
/* we are at the end of the loop - time to see which jobs have finished */
|
||||||
%mv_jobwaitfor(ANY,inds=&jdsrunning,outds=&jdswaitfor)
|
%mv_jobwaitfor(ANY,inds=&jdsrunning,outds=&jdswaitfor,outref=&outref)
|
||||||
%local done;
|
%local done;
|
||||||
%let done=%mf_nobs(&jdswaitfor);
|
%let done=%mf_nobs(&jdswaitfor);
|
||||||
%if &done>0 %then %do;
|
%if &done>0 %then %do;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
%mv_getjoblog(uri=&uri,outref=mylog)
|
%mv_getjoblog(uri=&uri,outref=mylog)
|
||||||
|
|
||||||
This macro is used by the mv_jobwaitfor macro, which is generally a more
|
This macro is used by the mv_jobwaitfor.sas macro, which is generally a more
|
||||||
convenient way to wait for the job to finish before fetching the log.
|
convenient way to wait for the job to finish before fetching the log.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,18 +9,19 @@
|
|||||||
|
|
||||||
## Input table (minimum variables needed)
|
## Input table (minimum variables needed)
|
||||||
|
|
||||||
@li FLOW_ID - Numeric value, provides sequential ordering capability
|
|
||||||
@li _CONTEXTNAME - Dictates which context should be used to run the job. If
|
|
||||||
blank, will default to `SAS Job Execution compute context`.
|
|
||||||
@li _PROGRAM - Provides the path to the job itself
|
@li _PROGRAM - Provides the path to the job itself
|
||||||
|
@li FLOW_ID - Numeric value, provides sequential ordering capability. Is
|
||||||
|
optional, will default to 0 if not provided.
|
||||||
|
@li _CONTEXTNAME - Dictates which context should be used to run the job. If
|
||||||
|
blank (or not provided), will default to `SAS Job Execution compute context`.
|
||||||
|
|
||||||
Any additional variables provided in this table are converted into macro
|
Any additional variables provided in this table are converted into macro
|
||||||
variables and passed into the relevant job.
|
variables and passed into the relevant job.
|
||||||
|
|
||||||
| FLOW_ID| _CONTEXTNAME |_PROGRAM|
|
|_PROGRAM| FLOW_ID (optional)| _CONTEXTNAME (optional) |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
|0|SAS Job Execution compute context|/Public/jobs/somejob1|
|
|/Public/jobs/somejob1|0|SAS Job Execution compute context|
|
||||||
|0|SAS Job Execution compute context|/Public/jobs/somejob2|
|
|/Public/jobs/somejob2|0|SAS Job Execution compute context|
|
||||||
|
|
||||||
## Output table (minimum variables produced)
|
## Output table (minimum variables produced)
|
||||||
|
|
||||||
@@ -81,7 +82,16 @@
|
|||||||
|
|
||||||
Trigger the flow
|
Trigger the flow
|
||||||
|
|
||||||
%mv_jobflow(inds=work.inputjobs,outds=work.results,maxconcurrency=4)
|
%mv_jobflow(inds=work.inputjobs
|
||||||
|
,maxconcurrency=4
|
||||||
|
,outds=work.results
|
||||||
|
,outref=myjoblog
|
||||||
|
)
|
||||||
|
|
||||||
|
data _null_;
|
||||||
|
infile myjoblog;
|
||||||
|
input; put _infile_;
|
||||||
|
run;
|
||||||
|
|
||||||
|
|
||||||
@param [in] access_token_var= The global macro variable to contain the access token
|
@param [in] access_token_var= The global macro variable to contain the access token
|
||||||
@@ -94,6 +104,7 @@
|
|||||||
@param [in] inds= The input dataset containing a list of jobs and parameters
|
@param [in] inds= The input dataset containing a list of jobs and parameters
|
||||||
@param [in] maxconcurrency= The max number of parallel jobs to run. Default=8.
|
@param [in] maxconcurrency= The max number of parallel jobs to run. Default=8.
|
||||||
@param [out] outds= The output dataset containing the results
|
@param [out] outds= The output dataset containing the results
|
||||||
|
@param [out] outref= The output fileref to which to append the log file(s).
|
||||||
|
|
||||||
@version VIYA V.03.05
|
@version VIYA V.03.05
|
||||||
@author Allan Bowe, source: https://github.com/sasjs/core
|
@author Allan Bowe, source: https://github.com/sasjs/core
|
||||||
@@ -113,6 +124,7 @@
|
|||||||
,maxconcurrency=8
|
,maxconcurrency=8
|
||||||
,access_token_var=ACCESS_TOKEN
|
,access_token_var=ACCESS_TOKEN
|
||||||
,grant_type=sas_services
|
,grant_type=sas_services
|
||||||
|
,outref=0
|
||||||
);
|
);
|
||||||
%local oauth_bearer;
|
%local oauth_bearer;
|
||||||
%if &grant_type=detect %then %do;
|
%if &grant_type=detect %then %do;
|
||||||
@@ -135,16 +147,29 @@
|
|||||||
,mac=&sysmacroname
|
,mac=&sysmacroname
|
||||||
,msg=%str(Input dataset was not provided)
|
,msg=%str(Input dataset was not provided)
|
||||||
)
|
)
|
||||||
%mp_abort(iftrue=(%mf_existVarList(&inds,_CONTEXTNAME FLOW_ID _PROGRAM)=0)
|
%mp_abort(iftrue=(%mf_existVarList(&inds,_PROGRAM)=0)
|
||||||
,mac=&sysmacroname
|
,mac=&sysmacroname
|
||||||
,msg=%str(The following columns must exist on input dataset &inds:
|
,msg=%str(The _PROGRAM column must exist on input dataset &inds)
|
||||||
_CONTEXTNAME FLOW_ID _PROGRAM)
|
|
||||||
)
|
)
|
||||||
%mp_abort(iftrue=(&maxconcurrency<1)
|
%mp_abort(iftrue=(&maxconcurrency<1)
|
||||||
,mac=&sysmacroname
|
,mac=&sysmacroname
|
||||||
,msg=%str(The maxconcurrency variable should be a positive integer)
|
,msg=%str(The maxconcurrency variable should be a positive integer)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/* set defaults if not provided */
|
||||||
|
%if %mf_existVarList(&inds,_CONTEXTNAME FLOW_ID)=0 %then %do;
|
||||||
|
data &inds;
|
||||||
|
%if %mf_existvarList(&inds,_CONTEXTNAME)=0 %then %do;
|
||||||
|
length _CONTEXTNAME $128;
|
||||||
|
retain _CONTEXTNAME "SAS Job Execution compute context";
|
||||||
|
%end;
|
||||||
|
%if %mf_existvarList(&inds,FLOW_ID)=0 %then %do;
|
||||||
|
retain FLOW_ID 0;
|
||||||
|
%end;
|
||||||
|
set &inds;
|
||||||
|
run;
|
||||||
|
%end;
|
||||||
|
|
||||||
%local missings;
|
%local missings;
|
||||||
proc sql noprint;
|
proc sql noprint;
|
||||||
select count(*) into: missings
|
select count(*) into: missings
|
||||||
@@ -269,7 +294,7 @@ data;run;%let jdswaitfor=&syslast;
|
|||||||
%end;
|
%end;
|
||||||
%if &jid=&jcnt %then %do;
|
%if &jid=&jcnt %then %do;
|
||||||
/* we are at the end of the loop - time to see which jobs have finished */
|
/* we are at the end of the loop - time to see which jobs have finished */
|
||||||
%mv_jobwaitfor(ANY,inds=&jdsrunning,outds=&jdswaitfor)
|
%mv_jobwaitfor(ANY,inds=&jdsrunning,outds=&jdswaitfor,outref=&outref)
|
||||||
%local done;
|
%local done;
|
||||||
%let done=%mf_nobs(&jdswaitfor);
|
%let done=%mf_nobs(&jdswaitfor);
|
||||||
%if &done>0 %then %do;
|
%if &done>0 %then %do;
|
||||||
|
|||||||
Reference in New Issue
Block a user