BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
LinusH
Tourmaline | Level 20

Hi,

Does anybody know if there is a way to get the name of the job flow that the current running SAS job is deployed from?

Our jobs are scheduled from SMC and are Scheduled to Windows Task Scheduler, and some of out jobs can be deployed from different job flows (daily, weekly and so on).

Br

Linus

Data never sleeps
1 ACCEPTED SOLUTION

Accepted Solutions
twocanbazza
Quartz | Level 8

Hi Linus.

My thoughts (could be completly wrong Smiley Wink)

I don't think the batch SAS Session running would know this, unless you passed a parameter in the batch command.  The job flow name is known in the Metadata and possibly the scheduler of your choice. 

We are using LSF, and there is an option to include the flow name in the Log of each batch sas session, not sure if that is available for the windows scheduler.  But when trying to find this option I can't seem to find it anymore...

What and how are you wanting to use this information?

Barry

View solution in original post

5 REPLIES 5
twocanbazza
Quartz | Level 8

Hi Linus.

My thoughts (could be completly wrong Smiley Wink)

I don't think the batch SAS Session running would know this, unless you passed a parameter in the batch command.  The job flow name is known in the Metadata and possibly the scheduler of your choice. 

We are using LSF, and there is an option to include the flow name in the Log of each batch sas session, not sure if that is available for the windows scheduler.  But when trying to find this option I can't seem to find it anymore...

What and how are you wanting to use this information?

Barry

LinusH
Tourmaline | Level 20

I have a couple of jobs that will be called from different flows.In my case a job could be run as a daily, weekly and monthly batch.

I was looking for a way to dynamically tell the job in which context it is running, so I can base some logic on that fact. And I thought that naming of the low could be one way.

I investigated this a bit further, and I found out that if a job is part of multiple, I could adjust the startup command and a -sysparm, which is independent from the startup command of the same job in a different flow.

I have also seen that 9.3 (we're currently on 9.2) you could set an environment variable specific for a flow. If this works as I understand the documentation, it would also work for us.

I look into the flow name in the log file name thing...

/Linus

Data never sleeps
nar_sas
SAS Employee

The deployed job and the job flow objects are both stored in metadata.  It is possible to walk the metadata relationships to get this name of the flow if the flow was created in SAS management console. 

LinusH
Tourmaline | Level 20

It has crossed my mind. It isn't really the quick fix that I was looking for...;)

But even so, to search the metadata during batch execution, I still need to know the metadata id for the deployed job flow membership (or whatever that object type is called). I can't really picture how that would work.

Br

Linus

Data never sleeps
LinusH
Tourmaline | Level 20

including the flow name in log file name is an option for the Scheduling server.

And we're probably go with that solution, by having a naming convention for flow names.

And in the autoexec_usermods we just pick out the information need by using getoption('LOG').

Thanks for the tip!

/Linus

Data never sleeps

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 2736 views
  • 0 likes
  • 3 in conversation