?>Array ( [lang] => en [id] => 38 ) CI/CD Scenario: Managing Action Set Updates and Lifecycle - WeAreCAS
builtins actionSetToTable

CI/CD Scenario: Managing Action Set Updates and Lifecycle

Scénario de test & Cas d'usage

Business Context

A data science team maintains a 'recommendationEngine' as a CAS action set. This engine is updated frequently. A CI/CD pipeline must be able to redeploy the action set and overwrite the existing definition table in-place to ensure dependent applications always have the latest metadata.
Data Preparation

Define the initial version (v1) of the recommendation engine action set.

Copied!
1PROC CAS;
2ACTION BUILTINS.defineActionSet /
3 name='recommendationEngine'
4 definition={{
5 ACTION='getRecommendations',
6 parms={{name='userId', type='string'}},
7 code='print("v1: Getting recommendations for user " .. _parms_["userId"]);'
8 }};
9RUN;
10QUIT;

Étapes de réalisation

1
Initial deployment: Convert the v1 action set to a table named 'RECOMMENDER_METADATA'.
Copied!
1PROC CAS;
2ACTION BUILTINS.actionSetToTable /
3 actionSet='recommendationEngine'
4 casOut={name='RECOMMENDER_METADATA', caslib='casuser'};
5RUN;
6QUIT;
2
Simulate an update: Define a new version (v2) of the action set with the same name but modified code.
Copied!
1PROC CAS;
2ACTION BUILTINS.defineActionSet /
3 name='recommendationEngine'
4 definition={{
5 ACTION='getRecommendations',
6 parms={{name='userId', type='string'}, {name='maxResults', type='int', defaultValue=10}},
7 code='print("v2: Getting top " .. _parms_["maxResults"] .. " recommendations for user " .. _parms_["userId"]);'
8 }};
9RUN;
10QUIT;
3
Automated redeployment: Convert the updated (v2) action set, overwriting the existing table using 'replace=true'.
Copied!
1PROC CAS;
2ACTION BUILTINS.actionSetToTable /
3 actionSet='recommendationEngine'
4 casOut={name='RECOMMENDER_METADATA', caslib='casuser', replace=true};
5RUN;
6QUIT;
4
Verification: Fetch the table content to confirm it now reflects the v2 definition, including the new 'maxResults' parameter.
Copied!
1PROC CAS;
2ACTION TABLE.fetch /
3 TABLE='RECOMMENDER_METADATA';
4RUN;
5QUIT;

Expected Result


The action runs successfully in both instances. After step 3, the 'RECOMMENDER_METADATA' table is overwritten. The final fetch in step 4 shows the v2 definition of the 'getRecommendations' action, which now includes the 'maxResults' parameter, confirming the lifecycle update was successful.