AWS Thinkbox Discussion Forums

job env variable cant be overwritten in jobpreload script

We have a job preload script, that depending on circumstances (what slave is rendering etc), can modify an existing job environment variable.

So for example, the job has a:

config=C:\baseconfig.ini

environment variable assigned to it. Then in the preload script, we override that if say, the machine has 20+cores to use:

config=C:\config_20cores.ini

This is sticking even as far as the maxController startMax function… Even in the line just before launching max, the proper value shows up. However, when max is started, if i print out all the env variables from maxscript, i get the original, job property value.

Maybe this is ‘as designed’?

Since the job is the last thing to be loaded/executed, this seems to make sense.

I somehow expected the pre-load script to already have the environment of the job set up, but that could simply be my mistake. Both ways would be valid, although ‘job-pre-load’ suggests that the script is being run before the job is loaded. Just caught me a little off guard.

Hey Laszlo,

Sorry it took me a bit to get back to you on this, I wanted to do some testing on this first :slight_smile:

How were you setting the environment variables? I was able to override Env Variables I set in the job within a JobPreload, and have it take, as long as I used “SetProcessEnvironmentVariable” function of the DeadlinePlugin (which gets passed in as an argument to the main function):

from Deadline.Scripting import *

def __main__( deadlinePlugin ):
    deadlinePlugin.SetProcessEnvironmentVariable("DEADLINE_JOB_ENV", "This is a test!")

Let me know if that works for you!

Cheers,
Jon

Was using the os.environ variable, ill try the process env variables, thanks for the tip!

Privacy | Site terms | Cookie preferences