Thank you - the issue seems to be that it definitely does not recognize the Ayon Server URL and Ayon API Key even though the GlobalJobPreLoad tries to set it for the environment here.
Let’s debug!
- For sake of being sure - can you double check your GlobalJobPreLoad in the Deadline repository is exactly like latest develop version? To ensure it’s not an issue from just an outdated
GlobalJobPreLoad.py
?
- If that’s the case, to improve the debugging lets log what the values are that are being set. Here in GlobalJobPreLoad add:
print(f"Setting {env}={val}")
- If all are being set correctly as you expect the values should be I think maybe there’s a bug on how the values are set and propagate to the
deadlinePlugin.RunProcess()
call that runs the --extractenvironment
call. Looking at the GlobalJobPreLoad OpenPype logic it explicitly mentions requiring its OPENPYPE_MONGO
var in os.environ
otherwise the run process won’t work - which might hint that we should be enforcing something similar here.
I believe that for the deadlinePlugin.RunProcess
to pick up the env var we should be using deadlinePlugin.SetProcessEnvironmentVariable
instead of deadlinePlugin.SetEnvironmentVariable
as their documentation states:
This DeadlinePlugin.SetProcessEnvironmentVariable should be differentiated with ManagedProcess.SetEnvironmentVariable which applies to the current Plugin. If using an advanced plugin, you will want to call this function instead of SetEnvironmentVariable, as you want the environment var to be set by managed processes started by this one. SetEnvironmentVariable sets environment for this managed process, once executed.
In this instance I believe we might want to actually run both since we want it to apply to the Deadline Render Job Plugin and anything that it runs, but also to the deadlinePlugin.RunProcess
call we do now.
So I suspect the issue for you might go away if you here also add:
deadlinePlugin.SetProcessEnvironmentVariable(env, val)
Why does this only happen to you?
I’m not sure.
I might also just be wrong with point 3 and there’s another bug (e.g. point 2). However it might very well be that others might have been testing deadline with their local machine instead of a farm machine that was not preconfigured for AYON with a server, user or api key predefined, or maybe others do have the AYON_API_KEY
submitted along with the Deadline Job in its job.GetJobEnvironmentKeyValue()
entries - and if so I believe it comes applied tot he GlobalJobPreLoad
sandbox as well, and thus is in os.environ
and thus DeadlinePlugin.RunProcess()
call also has the environment variables as needed.
Local cached job scripts per Job
Note: That whenever you update the GlobalJobPreLoad that you might need to resubmit the Render Job because I’ve often hit the case that the render machine kept using the cached local files of that job, like the one in this render log:
2023-10-19 16:23:12: 0: INFO: Executing global job preload script 'C:\ProgramData\Thinkbox\Deadline10\workers\MIF-TECH000\plugins\6531902782293632241930b3\GlobalJobPreLoad.py'
If that’s the case - the easiest fix I’ve found was to just Resubmit Job on the existing job and remove the original job. The new one will have a new job id and not use any cached data.