AWS Thinkbox Discussion Forums

Environment vars not reaching event plugin?

I’m testing event plugins in Deadline 10 (10.0.0.42), and when the OnJobFinishedCallback is triggered, I’m not seeing the environment variables I’ve set on the job. For example, I’ve set a var for “REZ_CONFIG_FILE” on the job to a custom path; the direct python os.environ shows the regular system setting for the var, and the result from the plugin object’s GetProcessEnvironmentVariable is empty. I don’t believe there should be anything else monkeying with the env vars.

Have I missed something? Is this not supported? Is this a bug?
Thanks!

I guess a good starting put is where/how have you set that variable?

Deadline does environments in kind of a peculiar way. We build up a dictionary using SetProcessEnvironmentVariable() and then pass that dictionary only to the process we ran. If you’re using os.envrion[] to set things, that might work, but it won’t touch the underlying dict that GetProcessEnvironmentVariable() is using, and it will only set on the current Python Sandbox. Meaning if an event runs inside another sandbox, it won’t see what you set before.

This is a pretty common issue… I bet we could use a Blog post about it.

For this particular test I tried setting it from the Monitor on the Job Properties -> Environment in super user mode, and resubmitted it. It shows up in the main job, but not the events.

“Disable Event Sandboxing” is disabled by default in the repo config options, and rightly so, as you ideally want each event execution to execute in a clean environment:
docs.thinkboxsoftware.com/produ … ient-setup
As a result, none of the job’s env vars will make it through to this new clean environment. So, in the case of a “OnJobFinishedCallback”, I would query the Deadline job object and re-apply the env vars at entry.
Alternatively, enable the above checkbox setting in your repo, restart Deadline Slave and possibly have a dirty environment. :wink:

Ah, okay. I was trying to get vars out of the object to, but maybe I was digging in the wrong place. I’ll come back here if I can’t find it.

Thanks!

docs.thinkboxsoftware.com/produ … 6def9b9467

print job.GetJobEnvironmentKeyValue( "REZ_CONFIG_FILE" ) envVarList = job.GetJobEnvironmentKeys() for key in envVarList: print( "%s=%s" % ( key, job.GetJobEnvironmentKeyValue( key ) ) )

(disclaimer: code not tested/from memory)

In other semi-related news, I actually had an interesting chat with another customer the other day about how we should probably do more to support REZ straight ‘out-of-the-Deadline-box’. Need to think some more about this…

It’s definitely becoming an important tool for a lot of shops. Done well, a lot of configuration could be handled elegantly through it.

Privacy | Site terms | Cookie preferences