AWS Thinkbox Discussion Forums

how to set env variables for maya (and nuke)

we are starting maya using a .bat to set some enviroment variables (network plugin pathes)
where in deadline can i setup those enviroment variables wich should be set before starting mayabatch

i noticed that i can modify already submitted jobs with those variables… but there must be a way to do this globally or always for certain job types

it’s really weird - any hint would be much appreciated
i’m running now a little startup-mel script that runs the .bat script that set’s the enviroment variables needed for the plugin but still redshift cannot be found in maya_plugin_path
it doesn’t even to run this mel-script (i added some prints wich nowhere appear in the log)

i also tried manually adding all the needed env-variables to the job, still the same error

Unable to dynamically load : //Fbbblue/temp/plugins/pub/Redshift/Plugins/Maya/2015/nt-x86-64/redshift4maya.mll

i’m 100%certain that the plugin is there … so what else can i do?

Hello,

If you currently use a .bat file to launch Maya outside of Deadline, you can just add that .bat to your executable list in configure plugins and then make sure to turn the bitness check off in your submissions.

that sounds like a good idea … i’ll give it a try

still no luck:

i either get
0: WARNING: Monitored managed process MayaBatch is no longer running
when i run it as mayabatch

or as a maya-cmd job
0: STDOUT: C:\Windows>“C:\Program Files\Autodesk\Maya2015\bin\render.exe”
0: STDOUT: Missing file name
0: INFO: Process exit code: 206

Hi,
Typically, clients start Maya via [MayaBatch.exe/maya] or [Render.exe/Render]. The advantage here is that the running executable process can have env variables injected into just this instance of the running executable instead of injecting the env variables permanently onto the system executing the job. Both options have their own merits. I see that you have already discovered that a job post-submission, can have 1 or more environment variables defined via the right-click job, “Modify Job Properties…”, “Environment” section - “add” to add a KEY=VALUE pair. Notice the checkbox at the bottom to inject only into the currently rendering process (one of the Maya exe’s as mentioned above).

You can inject environment variables at submission time via adding this entry to the job_info_file as described here (together with all the other options):
thinkboxsoftware.com/deadlin … nt_Options

Note the other options which may be of interest here as well:
“IncludeEnvironment”
“UseJobEnvironmentOnly”

Depending on how you are currently submitting your Maya jobs to your queue, you would just need to modify the appropriate submission script (all open code - mel, py) to include the additional functionality you require:
thinkboxsoftware.com/deadlin … Submission

Alternatively, you could hook into the Event Plugin system and write a py event which reacts to jobs of a certain type such as Maya being submitted into the queue and react accordingly with regard injecting environment variables. See here for more info:
thinkboxsoftware.com/deadlin … eventssdk/

As a side note, GPU rendering doesn’t work if you are running Deadline Slave as a service. See here for an additional feature we added recently for Redshift:
thinkboxsoftware.com/deadlin … Render_Job
Search for: “If rendering with Redshift, there will be an additional Redshift Options under the Maya Options:”

Regards,
Mike

yess…

that “IncludeEnviroment” was the solution … just added that into the SubmitJobToDeadline() function

was a bit tough to find my way through all that scripts, but now it works

thanxs for the help

i’m now having the same problem for Nuke

seems i’m not finding the right place to put this include enviroment - where exectly would i put this option for the nuke submitter script?

the submitter creates a jobinfo file with the option
IncludeEnvironment=true

but that doesn’t seem to add the env-variables to the job!?

strangly it adds the correct option to the job
EnvironmentKeyValue0=NUKE_PATH=//server/pipeline/Enviroment/pub/Nuke

but it doesn’t work (nuke can’t find plugins in this path) - only after i manually added under job setting-Enviroment the NUKE_PATH it worked

If you add the following line:

fileHandle.write( "IncludeEnvironment=true\n" )

underneath this line in the “SubmitJob” function:

fileHandle.write( "OnJobComplete=%s\n" % dialog.onComplete.value() )

then when I submit a Nuke job via the in-app Nuke submitter, I get all my local environment variables inserted into the job. You can see this in both the “Submission Params” and “Environment” sections when you double-click / right-click -> modify job properties dialog.

I believe the Foundry have several environment variables that can be used: NUKE_PATH, NUKE_PLUGIN_PATH, etc. Depending on your needs and perhaps what might also be defined in an init.py / menu.py file, you may have a re-direct or a AddPluginPath() function which is operating locally on your machine but is not currently being submitted as it’s not defined via an environment variable. This would explain why Nuke works, but plugins are not currently loaded. I would suggest defining several env variables which the Foundry make available, to give you the flexibility you need.

I believe the Foundry help docs have a section on the various environment variables available for use.

Hope this helps,
Mike

ohh … i found the problem … i edited the wrong file :unamused:

it’s working now

thanks again for help

btw. your SubmitNukeToDeadline.py uses spaces instead of tabs … that let me brake the file in first place

Great. I’m pleased it’s working for you!

We follow the Python PEP8 industry standard, which says No to tabs :slight_smile:
legacy.python.org/dev/peps/pep-0 … -or-spaces
legacy.python.org/dev/peps/pep-0008/#indentation

I think all the popular IDE editors have a function/button to allow the conversion of “tabs -> spaces” and I know the ones I use, have the ability to enforce the conversion when saving, so I don’t trip myself up :slight_smile:

ok then no tabs in my scripts anymore

once i get your system it’s very powerful and flexible:
by adding this lines i just add the Env.vars i like

import os
nukePath_ENV = os.environ.get(‘NUKE_PATH’)
fileHandle.write( “EnvironmentKeyValue0=NUKE_PATH=%s\n” % nukePath_ENV )

Privacy | Site terms | Cookie preferences