BookmarkSubscribeRSS Feed
ChrisNZ
Tourmaline | Level 20

When scheduling a job, how is the default source path defined and how can it be changed?

ChrisNZ_0-1646889218535.png

 

 

7 REPLIES 7
SimonDawson
SAS Employee

There is a SAS metadata directory object associated with the application server context. This is where the default path comes from.

 

SimonDawson_0-1647209467057.png

It doesn't appear to be something exposed through the user interface (SMC). I'm not sure its a good idea to change it.

 

EDIT: You can update it inside the Schedule Manager plugin inside SMC. You right click the plugin, click "Deployment Directories". You get a UI to view this metadata and update it.

SimonDawson
SAS Employee

Just noticed you are talking about the browse for source code button, not the deployment directories. This uses the file service offered by the SAS Workspace Server. The schedule manager plugin does not include an override for where to start this search from, its using the default path of the file service. On Linux it looks like this path defaults to $HOME, on Windows %MYSASFILES%.

ChrisNZ
Tourmaline | Level 20

Hi Simon,

Changing %mysasfiles% doesn't change the default source path.

It always seems to point to the path of library SASUSER, which makes no sense at all.

Cheers, Christian

SimonDawson
SAS Employee
There is a IOM method driving this file chooser is the ListFiles method offered from the FileService. See https://support.sas.com/rnd/javadoc/93/iomzipij/sas/dev/mva-v930/tkiomc/grm/filesij.html.

The doc is brief but you get a rough idea what the developer has to work with. The difficulty for both the Workspace Server developers and also the Schedule Manager plugin developer is what is a valid path to start with? The plugin in the management console leaves the path argument empty to leave it to the service to return some valid location to start with. When the workspace server starts and this service is leveraged it has to return a valid path and files. I mentioned %MYSASFILES% was the default because it lined up in my lab. I don't actually know what the workspace server developers pick when path is an empty string but you can imagine the challenge.

If you had to build a file chooser to select files on the SAS server how would you decide a valid filesystem location to start browsing?
SimonDawson
SAS Employee

Kept code spelunking for you. The file service has a special flag you pass it to tell the service that you want the contents of the users home. The "ListFilesModeUser" flag is what is used in the schedule manager plugin to start the navigation at the users home. Sensible so far.

 

The file service uses some other code to find the home directory of the user. There are different implementations for the various operating systems. On Windows the function to find the users home directory looks up the shell variable SASUSER and returns this path, if its unset the current working directory of the process is used. Not entirely sure why its done like this but  I guess the reasoning is that SASUSER is 99.99% of the time in the users "My Documents" folder on Windows by virtue of using the result of the Windows SHGetKnownFolderPath function for FOLDERID_Documents at startup because of the default value of SASUSER is set like this: -SASUSER "?FOLDERID_Documents\My SAS Files\9.4".  On Linux/UNIX the ~ path is expanded and used.

You could change the default path by setting the Windows shell variable SASUSER to some other path. It not advisable, good chance that breaks stuff in your SAS session. Many places in SAS (and user written code) likely assume the shell variable SASUSER references the filesystem location of the SASUSER library.

If this is causing huge amounts of pain then give me a call tomorrow, or when you are free and we can talk about this. I'm sure we can find an elegant solution to whatever is causing you problems.

ChrisNZ
Tourmaline | Level 20

No worries Simon. You have already spent too much time on this.

I was just hoping that users who want to schedule jobs don't have to navigate.

We are using service accounts for scheduling.

The SASUSER env var was not defined so I defined it in the registry and it worked.

1          %put  &sysuserid;
srv-lsfadmin
2          
3          filename CMD pipe 'set | find "SASU"';
4          data T;
5            infile CMD;
6            input;
7            put _infile_;
8          run;

NOTE: Compression was disabled for data set WORK.T because compression overhead would increase the size of the data set.
NOTE: The infile CMD is:
      Unnamed Pipe Access Device,
      PROCESS=set | find "SASU",RECFM=V,LRECL=32767

SASUSER=F:\SASJobs\LSF\Admin
NOTE: 1 record was read from the infile CMD.
      The minimum record length was 28.
      The maximum record length was 28.


But the default path for deployment is still the same

ChrisNZ_0-1647834368057.png

That's fine, users will have to click and navigate to their folder on drive F: for now.
I had to try but the cost/benefit of this exercise is getting too high. 🙂

Thank you again for your thorough investigation!

ChrisNZ
Tourmaline | Level 20

MYSASFILES also points to F: btw, but the deployment default path seems hard to repoint.

No worries, we tried 🙂

Thanks again!!

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1478 views
  • 6 likes
  • 2 in conversation