AWS Thinkbox Discussion Forums

Loading Redshift through mayapy.exe Python Plugin

We are using the python deadline plugin to execute python code in deadline as jobs.

Some of these jobs require to call maya.standalone.initialize() with mayapy.exe as the python interpreter. So far, so good.

Now we want to be able to load plugins such as redshift afther the call to maya.standalone.initialize() through the maya.cmds.loadPlugin(‘redshift4maya’) command but we get an error that maya was unable to load the plugin. I believe this is because the os.environ provided to the Deadline Python Plugin that executes my python code doesnt have all the environment variables that redshift provides… So i have two options:

  • (1) provide all the necessary env variables to the job through the EnvironmentKeyValue0 etc… Which is rather difficult to maintain if we want it to work with other plugins… Or, ideally and better option:

  • (2) We know that other Deadline plugins like MayaBatch are able to load redshift, arnold, renderman etc without the need of passing those plugin specific env variables. We would like to do the same in our Custom Python Plugin but we cannot seem to find where this is done… So,

Can we provide the node machine’s environment variables to the python plugin? How can we do this?

Yeah redshift requires environments to be set before launching maya…
I would suggest that you use a a jobpreload script to populate the environment befor launching the python session, see:
https://docs.thinkboxsoftware.com/products/deadline/10.0/1_User%20Manual/manual/application-plugins.html?highlight=jobpreload#jobpreload-py

Have some indicator on your python job that it is a redshift job, so that you only setup the env for redshift if so. The job extrainfo items are good for this.

use this command to set the environment:

deadlinePlugin.SetProcessEnvironmentVariable("ENVNAME","VALUE") # the value has to be a string

Hope this helps.
Kym

Hi,
sorry if i didnt make myself clear enough.
I dont want to go the “SetProcessEnvironmentVariable” way (which was the option number 1 i was referring to earlier on).
I would like to do something similar as i presume the MayaBatch plugin does: if you are rendering with redshift in maya (or any other renderer), you dont need to pass the specific redshift env variables (because the mayabatch plugin already does this?), which leads to my option number 2 ( the one i would like to follow and the reason of this post). I would like to maybe “copy” the part of the code of the mayabatch plugin that sets up the environment for the plugin being able to be loaded via a MEL “loadPlugin “redshift4maya” -quiet”. Im just guessing how this works in deadline. If we take into account that the node has redshift installed, the system Environment has all the variables all set up, so i just want my python plugin to work with that same environment.

Not sure if this is would work for you but we force Maya to load/unload plusins with userSetup.mel on our file server. We use JobPreload.py to include that path into MAYA_SCRIPT_PATH environment. The userSetup file is maintained by our pipeline team, modify 1 file to affect all jobs kind of set up.

1 Like
Privacy | Site terms | Cookie preferences