Deadline Nuke submission, run Python script

Hello!

We use Nuke to process thousands of outputs automatically and have custom python scripts that handle this for us locally. Locally the workflow is for the artist to load their Nuke script, run script and it launches the process and cycles through until complete.

I would like to get this working on the farm using Deadline submission but there is an error when I send the Python Script File along with the submission and I am not sure why.

This same python script works perfectly when triggered by the artist inside Nuke.

Any help appreciated.

The error is as follows;

=======================================================
Error

Error: FailRenderException : SyntaxError: invalid syntax
at Deadline.Plugins.DeadlinePlugin.FailRender(String message) (Python.Runtime.PythonException)
File “C:\ProgramData\Thinkbox\Deadline10\workers\56-studio-20\plugins\651fec72332b5f26cacb8842\Nuke.py”, line 224, in RenderTasks
self.WritePython( “with open(”{}") as f: exec(compile(f.read(), “{}”, ‘exec’), globals(), locals()))".format(scriptFileName, scriptFileName) )
File “C:\ProgramData\Thinkbox\Deadline10\workers\56-studio-20\plugins\651fec72332b5f26cacb8842\Nuke.py”, line 41, in WritePython
self.WaitForProcess()
File “C:\ProgramData\Thinkbox\Deadline10\workers\56-studio-20\plugins\651fec72332b5f26cacb8842\Nuke.py”, line 48, in WaitForProcess
self.FlushMonitoredManagedProcessStdout( self.ProcessName )
File “C:\ProgramData\Thinkbox\Deadline10\workers\56-studio-20\plugins\651fec72332b5f26cacb8842\Nuke.py”, line 623, in HandleError
self.deadlinePlugin.FailRender( self.GetRegexMatch( 0 ) )
at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
at __FranticX_GenericDelegate0Dispatcher.Invoke()
at Deadline.Plugins.DeadlinePlugin.RenderTasks()
at Deadline.Plugins.DeadlinePlugin.DoRenderTasks()
at Deadline.Plugins.PluginWrapper.RenderTasks(Task task, String& outMessage, AbortLevel& abortLevel)
at Deadline.Plugins.PluginWrapper.RenderTasks(Task task, String& outMessage, AbortLevel& abortLevel)

=======================================================
Type

RenderPluginException

=======================================================
Stack Trace

at Deadline.Plugins.SandboxedPlugin.d(DeadlineMessage bgq, CancellationToken bgr)
at Deadline.Plugins.SandboxedPlugin.RenderTask(Task task, CancellationToken cancellationToken)
at Deadline.Slaves.SlaveRenderThread.c(TaskLogWriter ajv, CancellationToken ajw)

Hello

This is a known issue which was resolved in Deadline 10.3.0.9. I suggest to upgrade, if it is not possible, use the plugin I am attaching. Backup [Repo]/plugins/Nuke/Nuke.py then replace it with the one attached here and retry.
Nuke.py (33.8 KB)

Thanks @zainali

This did resolve the original issue, thank you. However, Nuke doesnt seem to be loading the correct NUKE_PATH environment variables before starting the Job. The node is correctly configured and when Nuke is launched manually on the render node it does load the correct Environment but on the Deadline Job it doesnt for some reason and thus it is complaining about a missing module _RenderAll which is one of our own.

Wondering if you have any thought on how to ensure Nuke loads the correct NUKE_PATH variables?

Thank you

… Ok, I realize now that the .py scripts we have located in NUKE_PATH (W:\toolbox\Nuke) are only loaded during Nuke interactive sessions and not in headless mode on the farm.

Are there any tips on how to load these .py scripts for terminal mode too? Specifically a script called _RenderAll.py which we need loading for the Deadline Job to run successfully.

Thank you in advance

Is the Worker running under the same user that you’re testing outside of Deadline with? Could be that the NUKE_PATH variable is associated with the user you’re signing in with.

Deadline doesn’t touch NUKE_PATH except when installing the submitter, so it’s not in render time that that’s getting touched.

Just saw your reply - I don’t know. What triggers it getting loaded and run in the interactive session? Maybe it needs to be baked into the scene?

Thank you.

There is a menu.py which is loading it in for interactive sessions, but not for Nuke headless. I’m just trying to figure out how to have the .py tools loaded for the non GUI version too.

Thanks again

@Benjamin_A_Robins - Do you have an init.py in your NUKE_PATH? menu.py is for interactive, init.py is for both interactive and command-line. You may need to move some of your start up logic into the init.py.
https://learn.foundry.com/nuke/developers/113/pythondevguide/startup.html#init-py