session actionstatus

Standard: Monitoring a Junior Analyst's Data Prep Job

Scénario de test & Cas d'usage

Business Context

A lead data scientist needs to monitor the progress of a critical data aggregation job being run by a junior analyst in a separate, persistent CAS session. The lead needs to confirm when the job completes successfully before starting the next phase of the analysis pipeline.
About the Set : session

Management of the CAS session state.

Discover all actions of session
Data Preparation

Creation of a sample customer transaction table. The junior analyst will run a summary on this table.

Copied!
1/* This data step is for context; the lead will not run it, but assumes it exists in the analyst's session. */ DATA casuser.transactions_q3;
2 DO customer_id = 1 to 50000;
3 DO i = 1 to rannor(123)*5 + 10;
4 transaction_date = '15JUL2025'd + ranuni(123)*90;
5 transaction_amount = round(ranuni(123)*1500, 0.01);
6 OUTPUT;
7 END;
8 END;
9 FORMAT transaction_date date9.;
10RUN;

Étapes de réalisation

1
Simulate the junior analyst starting their session and running a long summary action asynchronously.
Copied!
1PROC CAS;
2 SESSION casauto name='AnalystJobSession';
3 cas AnalystJobSession;
4 /* Assume casuser.transactions_q3 table is loaded */
5 ACTION SIMPLE.summary / TABLE={name='transactions_q3', caslib='casuser'}, async='summaryJob';
6RUN;
2
From the lead's default session, find the UUID of the analyst's session.
Copied!
1PROC CAS;
2 SESSION; /* Ensure we are in the lead's session */
3 ACTION SESSION.listSessions RESULT=r;
4 string targetSessionId;
5 DO row over r.SESSION;
6 IF row['Session Name'] == 'AnalystJobSession' THEN
7 targetSessionId = row['Session UUID'];
8 END;
9 PRINT 'Target Session UUID to monitor: ' || targetSessionId;
10RUN;
3
Use the retrieved UUID to check the status of the actions in the analyst's session.
Copied!
1PROC CAS;
2 /* Assuming targetSessionId is populated from the previous step */
3 ACTION SESSION.actionstatus / uuid=targetSessionId;
4RUN;
4
Clean up the analyst's session.
Copied!
1 
2PROC CAS;
3 
4SESSION AnalystJobSession terminate;
5RUN;
6 

Expected Result


The output of step 3 should be a table listing the actions for the 'AnalystJobSession'. It will show the 'simple.summary' action with its job name 'summaryJob' and a state of 'Running' or 'Completed', depending on execution time. This validates the ability to monitor a specific, named session.