AWS Thinkbox Discussion Forums

Environment variables do not work on Linux

(A Solution has been found… see my 3rd post.)

Deadline is behaving differently between windows and linux machines on our farm.
If I add environment variables to a job (job properties) linux picks them up. If I set the variables via the GlobalJobPreload.py (ie os.environ[“var”] = value), they are entirely ignored by the subprocess.
Windows on the other hand honors both methods.

I’m calculating these variables within the GlobalJobPreload.py since they’re paths determined by each node based on their own platform (ie hardcoding them into the job properties is not an option).

Thanks

-Deadline 10.1.12.1: Installed as daemon/service on both linux and windows

This is a simplified follow up to this post which received zero responses.

Have you put a ticket in with support as well as creating a forum post?
Which exact version of Deadline are you running?

Are you running deadline as root and the worker as a specific user? is there any Worker log info where it’s trying to apply the env vars?

I’ve used the job properties to modify maya redshift versions too but not tried it through the preload, so as you’ve stated it’s something to do with this script

are you able to check the os.environ returns the expected value (linux / centos)

Thank you @anthonygelatka for the response,
I’ve sent in a ticket this morning (103142), and responded to your questions below.

Which exact version of Deadline are you running?

I’m running Deadline v10.1.12.1 Mayacmd plugin (not batch)

Are you running deadline as root and the worker as a specific user?

All installs across both platforms are installed as service/daemon using the same user account which had zero issues with or last render queue software (or my own incomplete custom solution)

is there any Worker log info where it’s trying to apply the env vars?

After setting the values I’m checking and printing out both the values that were set and if the paths were found on disk within my logs, and both platforms print out success into the deadline logs (viewable within deadline monitor)

I’ve used the job properties to modify maya redshift versions too but not tried it through the preload, so as you’ve stated it’s something to do with this script

Correct this approach works in windows, so it’s an issue with how linux is handling GlobalJobPreload.py… If I submit a job, and one by one add the variables to the job properties starting with MAYA_RENDER_DESC_PATH, I can get the process to inch forward in finding the plugin, then loading, then rendering, but as noted I would need to set all variables before I get a successful render, and once those values are set on the job properties, it means the windows machines fail, since paths cannot / aren’t the same per platform, and job properties seem to override values set in the preload.

are you able to check the os.environ returns the expected value (linux / centos)

Yes, the check of os.environ is part of the render log, and it always reports success, but still doesn’t seem to pass these variables on to the subprocess call for maya.

I searched every .py file in the install folder for various keywords like Popen, os.system, REDSHIFT_ etc… and couldn’t track down where the actual call to the maya executable is happening with one exception of the MayaBatch plugin (DeadlineMayaBatchFunctions.py line 202) but I’m using mayacmd not mayabatch.
Judging by the mayacmd.py file, and the lack of any direct call, it seems there’s some internal mechanism by which deadline actually runs the process, and I have no control over it via python.

Thanks to Justin at AWS the problem has been resolved.

It looks like deadline is treating each platform differently which is unfortunate, but there is a more appropriate way to set these variables.

This documentation page covers the functions listed below.

The short of it is…
GlobalJobPreload.py requires you define a function with the signature __main__(pluginObject)
You can use the plugin object passed into __main__ to access these functions.
GetProcessEnvironmentVariable()
SetProcessEnvironmentVariable()
ProcessEnvironmentVariableExists()

And you need to avoid using os.environ type calls since they won’t work the same between platforms.

#Example:
def __main__(pluginObject):
…pluginObject.SetProcessEnvrironmentVariable(“MyVarName”, “MyValue”)`

1 Like
Privacy | Site terms | Cookie preferences