session

actionstatus

Description

The `session.actionstatus` action allows you to retrieve the status of actions for a specific CAS session. This is particularly useful for monitoring long-running jobs or for managing multiple sessions concurrently. By providing the unique identifier (UUID) of a session, you can get detailed information about the state of any actions that have been submitted within that session, such as whether they are running, completed, or have failed.

session.actionstatus / uuid="string";
Settings
ParameterDescription
uuidSpecifies the unique identifier (UUID) of the session for which you want to retrieve the action status. This is a required parameter.
Data Preparation View data prep sheet
No Data Creation Needed

The `actionstatus` action operates on session metadata and does not require any specific data to be loaded into CAS. It is used to monitor the status of actions within existing sessions.

Copied!
1/* No data setup is required for this action. */

Examples

This example first retrieves the UUID of the current session using the `sessionId` action and then uses that UUID to get the status of actions within that same session.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2SESSION.sessionId RESULT=r;
3string mySessionId = r.SESSION;
4SESSION.actionstatus / uuid=mySessionId;
5RUN;
Result :
The output will be a table listing the status of all actions executed in the current session, including their job ID, state (e.g., 'Running', 'Completed'), and other metadata.

In this scenario, we start a new session ('MyNewSession') and run a potentially long-running action asynchronously (like `simple.summary`). We then use the `actionstatus` action from our original session to monitor the progress of the summary action by referencing the new session's UUID.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2SESSION casauto name='MyNewSession';
3 
4/* Load some data into the new session */
5cas MyNewSession;
6DATA casuser.cars;
7 SET sashelp.cars;
8RUN;
9 
10/* Run a summary action asynchronously in 'MyNewSession' */
11ACTION SIMPLE.summary / TABLE={name='cars', caslib='casuser'}, async='summaryJob';
12 
13/* Switch back to the original session to monitor */
14SESSION;
15 
16/* Get the UUID of 'MyNewSession' */
17ACTION SESSION.listSessions RESULT=r;
18string targetSessionId;
19DO row over r.SESSION;
20 IF row['Session Name'] == 'MyNewSession' THEN
21 targetSessionId = row['Session UUID'];
22END;
23 
24/* Check the status of the job in the other session */
25IF targetSessionId ne '' THEN DO;
26 PRINT 'Checking status for session: ' || targetSessionId;
27 ACTION SESSION.actionstatus / uuid=targetSessionId;
28END;
29ELSE DO;
30 PRINT 'Session MyNewSession not found.';
31END;
32 
33/* Clean up the other session */
34cas MyNewSession terminate;
35RUN;
Result :
The result will show the status of the `simple.summary` action running in the 'MyNewSession' session. The state might be 'Running' initially and will change to 'Completed' once the job is finished. This demonstrates how to monitor jobs across different sessions.

FAQ

What is the purpose of the actionstatus action?
What parameter does the actionstatus action require?
How can I check the action status of a different session?

Associated Scenarios

Use Case
Standard: Monitoring a Junior Analyst's Data Prep Job

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 con...

Use Case
Performance: Orchestrating Multiple Asynchronous Model Scoring Jobs

An automated nightly process kicks off several model scoring jobs in parallel to score different customer segments. Each job runs in its own CAS session for isolation. A master ...

Use Case
Edge Case: Querying a Non-Existent or Terminated Session

A system administrator is debugging the CAS environment. They have a list of session UUIDs from a logging system, but one of them may correspond to a session that has crashed or...