I have a question that I asked SAS directly and they pointed me to this message board. Our team is migrating into SAS Viya and previously ran jobs on a grid service where the status of jobs could be pulled down with a macro and printed. I'm trying to replicate this in the Viya environment. I am using RSUBMIT blocks with SIGNON statements to batch submit programs and I can see these jobs within the workload orchestrator while it they are running:
I was previously pointed to some code that works with proc http to pull information with an API I believe (I am not familiar with this type of extraction of information). https://communities.sas.com/t5/Administration-and-Deployment/How-to-retrieve-status-of-scheduled-jobs/td-p/784321 I tried to modify it but it does not pull information about individual RSUBMIT sessions, only the overarching program running the RSUBMITS:
%let baseurl=;/**Removed the URL due to company protocol**/
%macro getjobs();
/* Initialize files */
filename headout temp;
filename resp temp;
/* Call the jobExecution REST API using whatever filter you want to limit the results */
proc http oauth_bearer=sas_services url="&baseurl/jobExecution/jobs?start=0%nrstr(&limit)=20%nrstr(&filter)=ge(creationTimeStamp,%272025-12-18T05:00:00.000Z%27)" out=resp headerout=headout HEADEROUT_OVERWRITE;
headers "Accept"="application/json";
run;
/* Read in the response using the JSON libname engine. */
libname resp json fileref=resp;
/* Define a data set with the information we want. */
proc sql;
create table jobs
(name char(255),stat char(50),createdBy char(50),creationTimeStamp char(25),expirationTimeStamp char(25), elapsedTime num);
insert into work.jobs
select a.name,b.state,b.createdBy,b.creationTimeStamp,b.expirationTimeStamp,b.elapsedTime
from resp.items_jobrequest as a,resp.items as b where a.ordinal_items = b.ordinal_items;
quit;
/* Check for a next link (meaning there are more results not in the initial response) */
%local next;
data _null_;
set resp.links;
where rel="next";
call execute('filename r'||strip(put(_n_,12.0))||' temp;');
call execute('%nrstr(proc http oauth_bearer=sas_services url="%%nrstr('||"&baseurl"||strip(href)||')" out=r'||strip(put(_n_,12.0))||' headerout=headout HEADEROUT_OVERWRITE;)');
call execute(' headers "Accept"="application/json";');
call execute('run;');
call execute('libname r'||strip(put(_n_,12.0))||' json fileref=r'||strip(put(_n_,12.0))||';');
run;
%mend getjobs;
%getjobs();
Is there something similar to this that anyone has used to access the workload orchestrator list?
... View more