session batchresults

Edge Case and Error Handling for Financial Risk Model Execution

Scénario de test & Cas d'usage

Business Context

A financial institution's QA team is validating the stability of their CAS environment. They need to ensure that the `batchresults` action behaves predictably and provides clear error messages when used incorrectly, such as with invalid parameters or on sessions in an inappropriate state. This prevents system instability during automated job management.
About the Set : session

Management of the CAS session state.

Discover all actions of session
Data Preparation

A small data table is created. The focus of this scenario is on session states and action parameters, not on data processing.

Copied!
1DATA casuser.trade_data;
2 DO i = 1 to 10;
3 trade_id = i;
4 value = 1000 * i;
5 OUTPUT;
6 END;
7RUN;

Étapes de réalisation

1
Test Case A: Call 'batchresults' with a completely invalid, non-existent UUID.
Copied!
1 
2PROC CAS;
3ACTION
4SESSION.batchresults / uuid='this-is-not-a-real-uuid';
5RUN;
6 
2
Test Case B: Call 'batchresults' on a valid session that has no active asynchronous action running.
Copied!
1cas risk_session name='risk_session';
2cas admin_session;
3PROC CAS;
4 SESSION admin_session;
5 s_uuid = findSession('risk_session');
6 ACTION SESSION.batchresults / uuid=s_uuid;
7RUN;
3
Test Case C: Call 'batchresults' on a session where a fast asynchronous action has likely already completed.
Copied!
1PROC CAS;
2 SESSION risk_session;
3 ACTION BUILTINS.echo RESULT=r / message='hello', async='fast_job';
4RUN;
5PROC CAS;
6 SESSION admin_session;
7 s_uuid = findSession('risk_session');
8 /* This creates a race condition */
9 ACTION SESSION.batchresults / uuid=s_uuid;
10RUN;
4
Verify the status of the 'fast_job' to confirm it completed and check the log for the error from the batchresults call.
Copied!
1PROC CAS;
2 SESSION risk_session;
3 ACTION SESSION.actionstatus / name='fast_job';
4RUN;

Expected Result


Each test case should fail gracefully without crashing the server. Test Case A should produce an error in the log stating the session UUID was not found. Test Case B should result in an error indicating no running action is available to be switched to batch mode in the target session. Test Case C will most likely produce the same error as B, because the 'fast_job' completes almost instantly, leaving no 'running' action for `batchresults` to act upon. The system must remain stable throughout all invalid calls.