BookmarkSubscribeRSS Feed
acordes
Rhodochrosite | Level 12

We have an user interface through DDC in Visual Analytics that captures the user's choice into parameters, processes them, adds logic and sends them via the append method to the sas code job. 

 

The code executes well but overall the job takes 15 seconds to complete. 

 

I have the suspicion that what consumes so much time is to lift the session and assign the caslibs, I assign all of them but I only need 2 for the code to run. The sas code once the session is created, takes less than a second to run as it is not resource heaevy what the code is doing. 

 

Can I use the autoexec file for keeping the session alive, @pathew ? I ask you directly because you solved a similar issue this week for me. Thanks in advance. 

 

Here is how the called sas code for execution initiates the session right now, the relevant part:

 

%put NOTE: Local   = %sysfunc(putn(&dt_local, datetime20.));
%put NOTE: UTC= %sysfunc(putn(&dt,       datetime20.));

/* %let local_vs_utc=%sysfunc(intck('dthours', &dt_local, &dt)); */
%let user_q    = %str(%')&SYSUSERID%str(%'); 
%let uuid_q    = %str(%')&row_id%str(%'); 
%let castbl=OUTPUT_EQUIPMENT_SRT_DEN;
%let caslib=pims;  

%global skip_job lockstate;
%let skip_job=0;        /* IMPORTANT: init so open-code %if is stable */
%let lockstate=ACCESSIBLE;

cas mySession sessopts=(caslib=casuser timeout=1800 locale="en_US");

caslib _all_ assign;


cas mySession sessopts=(caslib="&caslib");
libname mycas cas caslib="&caslib";

 

 

 

pic.png

1 REPLY 1
pathew
SAS Employee

Hi again 😉
to make sure I understand you correctly, what exactly takes 15 seconds?
The code snippet you posted? I see you run a 

caslib _all_ assign;

that can take a while. If you assign the libnames you actually require later explicitly anyways (libname xyz cas...) then you can probably just omit the _all_ assign.

If it takes 15 seconds before your code first starts running I suppose the main delay is the kubernetes pod start up time. In that case you might be able to make use of the compute tasks method introduces last year: Speeding Up SAS Viya Jobs with Compute Tasks

If I recall correctly with the same update also session support was introduced to the Job Execution web app, I never played around with those though so my experience is a bit limited: SAS Help Center: Using Sessions

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →
Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 176 views
  • 1 like
  • 2 in conversation