Nuke Plugin not detecting proper exit in BatchMode

Hi,

I am attempting to use the ‘BatchMode’ option in the Nuke Plugin. Essentially I want to launch a python script to Nuke in -t mode.
This python script will generate a Quicktime. The script does load and run, and the Quicktime is generated, but something is causing Deadline to detect the script as exiting improperly.

I have tried calling nuke.scriptExit() and sys.exit(0) at the end of the python script. I’m not sure what is making the monitored managed process unhappy. The same command line runs fine from a command prompt and as a Deadline CommandScript job.

FYI,
The commandline ends up looking somehting like this:
“C:\Program Files (x86)\Nuke6.1v2\Nuke6.1.exe” -V -t “X:\show\devshow\AA\0001\comp\AA_0001_precomp\v003\2kan_lin_wtProcess\DailyFactory\1288120174_DailyFactory.py”

Here is some error log output:


0: STDOUT: Loading C:/Program Files (x86)/Nuke6.1v2/plugins/Invert.dll
0: STDOUT: Loading C:/Program Files (x86)/Nuke6.1v2/plugins/Keymix.dll
0: STDOUT: Loading C:/Program Files (x86)/Nuke6.1v2/plugins/OneView.dll
0: STDOUT: Loading C:/Program Files (x86)/Nuke6.1v2/plugins/movWriter.dll
0: STDOUT: Loading C:/Program Files (x86)/Nuke6.1v2/plugins/exrReader.dll
0: STDOUT: X:\show\devshow\AA\0001\comp\AA_0001_precomp\v003\HDQT_sRGB\AA_0001_precomp_v003.mov
0: STDOUT: Loading C:/Program Files (x86)/Nuke6.1v2/plugins/date.tcl
0: STDOUT: Writing X:/show/devshow/AA/0001/comp/AA_0001_precomp/v003/HDQT_sRGB/AA_0001_precomp_v003.mov .9
0: STDOUT: Writing X:/show/devshow/AA/0001/comp/AA_0001_precomp/v003/HDQT_sRGB/AA_0001_precomp_v003.mov took 2.15 seconds
0: STDOUT: Writing X:/show/devshow/AA/0001/comp/AA_0001_precomp/v003/HDQT_sRGB/AA_0001_precomp_v003.mov .4.9
0: STDOUT: Writing X:/show/devshow/AA/0001/comp/AA_0001_precomp/v003/HDQT_sRGB/AA_0001_precomp_v003.mov took 0.98 seconds
0: STDOUT: Writing X:/show/devshow/AA/0001/comp/AA_0001_precomp/v003/HDQT_sRGB/AA_0001_precomp_v003.mov .5
0: STDOUT: Writing X:/show/devshow/AA/0001/comp/AA_0001_precomp/v003/HDQT_sRGB/AA_0001_precomp_v003.mov took 0.87 seconds
---- October 26 2010 – 04:02 PM ----
0: WARNING: Monitored managed process Nuke is no longer running
Scheduler Thread - Render Thread 0 threw an error:
Scheduler Thread - Exception during render: An error occurred in RenderTasks(): Monitored managed process “Nuke” has exited or been terminated.

at Deadline.Plugins.ScriptPlugin.RenderTasks(Int32 startFrame, Int32 endFrame, String& outMessage)

As far as I can tell, Nuke is exiting because it is finished. Is it not returning a proper exit code? Any ideas? Has anyone successfully used ‘BatchMode’ in the Deadline Nuke Plugin. I found it in the .py file of the Plugin, but now that I look again it is not exposed as an Option. Is it experimental or something :wink:

Thanks,
Paul

Hey Paul,

The BatchMode was our first attempt at better controlling the Nuke rendering process, instead of just running command line renders. For the most part, it worked great, but it didn’t handle edge cases like custom render nodes, which is why we scrapped it. We kept the code around in case we ever revisited it, but for now it is considered an experimental and unsupported feature. :slight_smile:

The way it works is that the StartJob and EndJob functions are responsible for starting up and shutting down Nuke, respectively. So normally, the python code itself doesn’t have to worry about exiting Nuke. The plugin monitors the Nuke process, so when it exits unexpectedly (which is the case here), it thinks something has gone wrong and throws the error.

So the workaround likely is to change your python script so that it doesn’t exit Nuke, and instead rely on Deadline to take care of that when the job is finished.

Cheers,

  • Ryan

Hmmm, originally I did not have the calls to nuke.scriptExit() and sys.exit(0) in there… and Nuke was still exiting unexpectedly.

The other thing I tried was to print a unique string at the end of my python script… something like:

print("THE QT PROCESS HAS COMPLETED")

Then in the Deadline plugin I wanted to capture that with a AddStdoutHandler and in the Handler call ExitWithSuccess(). The problem I’m having is I’m not seeing the output of the print statements in the Deadline logs. Any trick to this? I remember in Fusion, I had to make a call to flush the std io.

Anyways, I’ll probably find a different way to get at what I’m after, but I’ll update this thread if I learn anything useful along the way.

Thanks,
Paul

Maybe just don’t use batch mode. If I’m understanding correctly, you’re just running a command line, right? If that’s the case, just don’t use batch mode and instead use a modified command line to run the script. That would probably work better.

Cheers,

  • Ryan

Ahhh, OK. I now see all the wizardry in the StartJob, RenderTask, and EndJob for BatchMode. I really just needed “-t” to get inserted into the Nuke commandline. Not all that magic! I hacked in my own “-t” solution to the Nuke Plugin and everything works fine.

For the next release, it might be nice to put a little comment at the top of the Nuke Plugin that BatchMode is experimental or outdated or something… I wouldn’t have messed with it, except at a quick glance it looked like it was what i needed.

Thanks,
Paul

Good call. We’ll do that!