Scénario de test & Cas d'usage
Create a very large table 'genomic_variants' with 100 million rows to simulate a resource-intensive, long-running task.
| 1 | DATA casuser.genomic_variants; |
| 2 | call streaminit(456); |
| 3 | DO i = 1 to 100000000; |
| 4 | chromosome = 'chr' || put(ceil(rand('UNIFORM')*22), 2.); |
| 5 | position = ceil(rand('UNIFORM')*10000000); |
| 6 | quality_score = rand('NORMAL', 50, 5); |
| 7 | IF (mod(i, 1000000) = 0) THEN put i=; /* Log progress */ |
| 8 | OUTPUT; |
| 9 | END; |
| 10 | RUN; |
| 1 | cas research_session name='research_session'; |
| 2 | PROC CAS; |
| 3 | SESSION research_session; |
| 4 | /* Assume data_prep code has been run */ |
| 5 | ACTION SIMPLE.summary RESULT=summary_job / |
| 6 | TABLE='genomic_variants', |
| 7 | async='genomic_summary_job'; |
| 8 | PRINT 'Research Session UUID: ' || SESSION.sessionId(); |
| 9 | RUN; |
| 1 | cas supervisor_session name='supervisor_session'; |
| 2 | PROC CAS; |
| 3 | SESSION supervisor_session; |
| 4 | /* Replace 'uuid-from-research-session' with the actual UUID */ |
| 5 | ACTION SESSION.batchresults / uuid='uuid-from-research-session'; |
| 6 | RUN; |
| 1 | PROC CAS; |
| 2 | SESSION research_session; |
| 3 | ACTION SESSION.endSession; |
| 4 | RUN; |
| 1 | cas results_session; |
| 2 | PROC CAS; |
| 3 | SESSION results_session; |
| 4 | /* Check status periodically */ |
| 5 | ACTION SESSION.actionstatus / name='genomic_summary_job'; |
| 6 | /* Fetch when complete */ |
| 7 | ACTION SESSION.fetchresult / name='genomic_summary_job'; |
| 8 | RUN; |
The `batchresults` action should execute quickly, detaching the 'genomic_summary_job'. The `endSession` action on 'research_session' should succeed without affecting the server-side job. After a significant amount of time, `actionstatus` will show the job as 'completed', and `fetchresult` will successfully retrieve the summary statistics for the 100 million row table, proving the job ran to completion independently of the client session.