BookmarkSubscribeRSS Feed
Mayt
Obsidian | Level 7

Hi everyone

I have a job flow that contains  jobs inside. Some jobs need to run in parallel. I used to execute it by right click--> execute and set time trigger, and the job flow worked fine. 

Mayt_0-1708605633123.png

The problem is right now I want to execute the job flow through API. But can't find any solution.

I've tried one solution like Instead of creating a job flow, I created job definition then put the each-step code in it and used %include to run the each-step code. Then executed it through API. But It can't run in parallel and didn't show if there are errors each step.

My code in job definition is something like this:

/*include file*/
FILENAME first_code FILESRVC FOLDERPATH='code path'  FILENAME='mycode1.sas';
FILENAME sec_code FILESRVC FOLDERPATH='code path'  FILENAME='mycode2.sas';
FILENAME third_code FILESRVC FOLDERPATH='code path'  FILENAME='mycode3.sas';

%include first_code;
%if &SYsrc=0 %then %do;
    %put Return Code for first_code: &SYSRC;
    %include sec_code;
    %if &SYsrc=0 %then %do;
        %put Return Code for sec_code: &SYSRC;
        %end;
     %include third_code;
        %if &SYsrc=0 %then %do;
        %put Return Code for third_code: &SYSRC;
        %end;
      

So if you guys know how to execute the job flow through API, please let me know.

Thank you in advanced.

3 REPLIES 3
ChrisHemedinger
Community Manager

Yes, SAS Viya has a Job Execution API. You can also list Jobs and get status of running Jobs.

 

See examples here:
https://github.com/sassoftware/devsascom-rest-api-samples/blob/master/Compute/jobExecution.md

 

And documentation:
https://developer.sas.com/apis/rest/Compute/#job-execution

 

This Postman collection might also help for testing:
https://github.com/sassoftware/sas-rest-api-postman-collections/tree/master/jobs-crud

 

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
Mayt
Obsidian | Level 7

So I need to call the job flow in job definition, Then execute the job definition right? How can I call the job flow in job definition? Can I just use %include like I did in my code. But I think job flow doesn't have path.

DeMer
Calcite | Level 5

Can you use the job chaining macros that are provided with the Job Execution Webapp?

https://go.documentation.sas.com/doc/en/sasstudiocdc/v_047/pgmsascdc/jobexecug/p0qsxn76pbh5qjn1iob6u...

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 550 views
  • 1 like
  • 3 in conversation