Send environment variables to deadline from maya

Hello all,

I would like to know how I can pass the environment variables of the user when sending to deadline from Maya.

At the studio, Maya is launched with a batch file to set temporary environment variables according to the project. (plugin version, licenses ect.)
Here a short version of the .bat

SET SHARED_MAYA_DIR=B:\\ressources\\sharedMaya

REM == Color management and ACES
SET OCIO=B:\ressources\networkInstall\openColorIo\aces_1.0.3\config.ocio

REM == Modules and Arnold 
SET MAYA_MODULE_PATH=%MAYA_MODULE_PATH%;%SHARED_MAYA_DIR%\modules\basic;B:\ressources\networkInstall\maya2020

REM == Other Arnold variables
SET MAYA_RENDER_DESC_PATH=B:\ressources\networkInstall\maya2020

REM == Start maya and launch startupSettings (FPS, Scale unit, ect...)
start C:\"Program Files"\Autodesk\Maya2020\bin\maya.exe -command "python(\"import startupSettings\"); python (\"\");" %*

Now, I would like the user to be able to pass this variables to deadline so the worker use the correct plugin versions.

I read that may be to modify the SubmitToMayaDeadline.mel (or maybe the ?).
If someone could point me in the right direction, it would be greatly appreciated.

I see the question has already been asked . But the links provided as solution are now 404 :’(

Tech specs
deadline 10.1, maya 2020, Arnold and Windows 10


If you are using the integrated Maya submitter, editing the SubmitMayaToDeadline.mel is a good place to insert your hooks.

The file itself is a bit of a nightmare, but essentially you’re looking for the relevant areas that contain fprint $fileId .... This is where the MEL script is writing the job file(s).

Now, what exactly you want to append here and how you want to retrieve it later is up to you. I would suggest using the ExtraInfo fields in the info file. More information about job files and manual job submissions here.

Once you’ve successfully inserted the extra info in the job submission, you can see this information via the Monitor.

In terms of what you want to actually do with this information requires a bit more explanation on your end. If you need to modify how Maya launches, you’re probably looking at some edits to the MayaBatch plugin. If you’re only wanting to use this information in your own code, before rendering, there’s a couple of MEL hooks that dump this info already. Let me know and I’ll dig them up for you, or help you integrate your own.

Shame those links are dead-ends now, but the 6.1 docs aren’t up anymore.

But what Mike from 2014 was talking about is the IncludeEnvironment flag which is still around! There’s some extra info about it in the manual submission docs.

If set to True, it grabs the submitter’s current environment variables and sets them in the job’s environment which sounds like just what you’re looking for. Give those two links a look and see if that helps you out!

Thanks Daniel and Justin for the help, it is working now !

As you advised, I added one line to SubmitMayaToDeadline.mel (line 3083)

fprint $fileId ("IncludeEnvironment=True \n");

I will look a bit more into deadline options.

1 Like