Access job submission param from within job

Hi,
Is there an easy way to access submission parameters of a job from within that job?

Basically, I’d like to send a command line job on deadline with some ExtraInfoKeyValue on the job, and access those values inside the command line job (python script).

For now I’m setting environment variables set in the job, is there another way?

Thanks

As far as I know, the short answer is no. Executables are sandboxed to an extent, and aren’t really aware of the context they run in. Other than whatever environment the relevant job plugin chooses to set up for them.

However, if you indulge me for a second, some of these things might have potential:

  1. Modify the plugin you’re using (Python, Cmd, etc) to grab the job info you’re after and send it as a payload to the executable/script. Probably base64 encoded JSON or something low-tech like that. Alternatively send it the job-id and let the script figure out the rest
  2. Send the above payload (except the job id, you don’t know that at submission time) as a parameter in the job/plugin info file when you’re submitting. This only works if you’re submitting with a custom process (job/info files) or by modifying the relevant submitter code if you’re using default stuff
  3. Run the job as normal, but your executable/script queries what hostname it’s running on, and uses that information to execute a Deadline script (or standalone/REST api) to query which workers are doing which jobs, figuring out which job you’re interested in based on worker’s hostname. Could be iffy if you have multiple workers per host, but probably not impossible

If you’re remotely interested in any of the above, narrow it down a bit and post back. I’m sure we can figure something out. :slight_smile:

1 Like

Thanks for your answer @danielskovli

Great ideas, but a bit too complicated for the time I have on my hand :slight_smile:

As a solution, I setuped my jobs with custom environment variables which I then query during my script to get the data I need.

1 Like