Send info to subprocess' stdin in Deadline plugin

I need to send a script to a Nuke.exe -t command via the process’ stdin

From the command line I’d do it as:
Nuke.exe -t < myScript.py

In a Deadline plugin I’m guessing I need to use StartManagedMonitoredProgram() so the stdout of the child is redirected to the slave and so I can then use WriteFileToStdInManagedProgram() by specifying the path to the script that needs to be piped.

Can anybody help me as to the usage of StartManagedMonitoredProgram() and what the documentation means when it states: “Starts a managed program using the given MMP config Filename”… What’s a MMP config?

Using Deadline 3.1

Many thanks,
Patrick
patrick.boucher@modusfx.com

I’ve managed to work around my lack of understanding of the Deadline SDK by using the following two methods in a simple plugin:

[code] def RenderExecutable(self):
return r’C:\Windows\system32\cmd.exe’

def RenderArgument(self):
    arguments = ' /C " "%s" -t < "%s" "' % (GetConfigEntry("NukeExecutable"), GetConfigEntry("NukeScriptFile"))
    return arguments[/code]

The hop through cmd.exe is superfluous but using the following code would choke on the stdin redirect.

[code] def RenderExecutable(self):
return GetConfigEntry(“NukeExecutable”)

def RenderArgument(self):
    arguments = ' -t < "%s"' % GetConfigEntry("NukeScriptFile")
    return argument[/code]

I’d still like to know the “clean” way of doing this kind of stdin redirect (maybe using StartManagedMonitoredProgram()) if anyone out there is so inclined.

Cheers,
Patrick

Hey Patrick,

Check out the MayaBatch plugin in \your\repository\plugins (specifically, the MayaBatch.py file). We start up Maya using StartMonitoredManagedProcess and then pipe stdin to it using WriteStdinToMonitoredManagedProcess. Hopefully you can use this plugin as a reference to build yours.

Cheers,

  • Ryan