Python version of SubmitToModo script

I’ve been asked to add some additional functionality to my teams SubmitToModo script but I’m far more comfortable with Python than Perl. So I was curious if there is a Python version of this script for Deadline. I was going to translate it over myself but I wanted to make sure one didn’t already exist. I guess I should also ask if there is any reason that this script needs to be in Perl.

Thanks!

So the Perl script we have for modo is actually just a tiny wrapper that secretly calls the Monitor’s modo submission script, which is written in Python :slight_smile:

The script you’ll want to modify is located at ‘scripts/Submission/ModoSubmission.py’ in the Deadline Repository.

Cheers,

  • Jon

Ah excellent! So if I need to add in functionality that populates the submit to Modo window (like Job name, description, etc…) the ModoSubmission.py would be the place to go?

That’s correct. Changes made there will be reflected in both the Monitor Submitter and the integrated Modo Submitter.

Great, thanks for the info.

I actually have another question about this script. If I have both Deadline 5 and Deadline 6 installed. Is there a separate script for Deadline 6?

Edit #1:
Actually I found the script DeadlineModoClient.pl

But I’m concerned that it will get confused by the fact that I have two versions of Deadline running. I don’t see anything in either script that would allow it to chose a version. But I could be missing something.

Edit #2:

This seems to be working fine no matter where I launch the script from be it local or from the repository. I still haven’t been able to determine why this works. There doesn’t seem to be much of a difference between the old Deadline 5 SubmitModoToDealine and the new Deadline 6 DeadlineModoClient. So how are they determining which Deadline version to use?

So back in Deadline 5, we were kinda reliant on the Deadline binaries being in the OS search path (ie, the PATH environment var).

In Deadline 6, we moved away from that (and are not adding the D6 bin folder to the PATH by default). We’re instead using our own custom environment variable (called DEADLINE_PATH) to figure out where the binaries are. This was done mainly to improve support on the Mac (and Linux to a lesser extent), where there’s really no good way to globally add a folder to the PATH variable.

A nifty side benefit to this is that D5 and D6 can live alongside each other without interfering with each other. I still wouldn’t really recommend it long term, though, because there might be some edge cases we missed that still rely on the PATH environment, and if it’s calling D5 stuff instead of D6 it could get confusing real fast.

Cheers,
Jon

Cool thanks for the explanation. It makes sense now. 5 and 6 will only be running through the transition period. But it is really nice that I can have them both on at the same time for now because it lowers the farm downtime.

I’m back to attempting to replicate the functionality in the DeadlineModoClient.pl into a Python script. I’ve been able to get everything working except the very last part where it calls the deadlinecommandbg.exe.

Current;y I’m trying this:


script = “\renderfarm\DeadlineRepository6\scripts\Submission\ModoSubmission.py”
launchDeadline = [‘C:\Program Files\Thinkbox\Deadline6\bin\deadlinecommandbg.exe’, ‘-executescript script’]
process = subprocess.Popen(launchDeadline, stdout=subprocess.PIPE)
process.wait()

But it’s not working. I’ve also tried os.system with no success. What’s even weirder is that I’ve tried launching the exe from a Windows shell using the same flag and script path. The submit window pops open for a half a second then closes. So I’m kind of at a loss as to how to get this script to launch from Python. What is it about Perl that allows you to run this executable with just backticks? `"$deadlinecommandbg\

I was hoping someone would have some insight into launching the deadlinecommandbg.exe properly from Python. I realize that it’s probably better to just use Perl, but there are things I’d like to do pipelinewise that will be made easier with Python.

Thanks!

From the code you provided, I can see a couple problems.

First, you’re not escaping backslashes in your script variable, so you should probably do that. Alternatively, you could prefix the literal with ‘r’ to make it a raw string (ie, python interprets backslashes as backslashes instead of escape codes):

script = r"\\renderfarm\DeadlineRepository6\scripts\Submission\ModoSubmission.py"

Second, the script variable isn’t properly being specified in the arguments passed to Popen – it’s currently just including the string ‘script’ instead of your actual variable contents. Your arguments should look like this:

launchDeadline = ['C:\\Program Files\\Thinkbox\\Deadline6\\bin\\deadlinecommandbg.exe', '-executescript', script]

Other than that, I think everything else should work as expected.

Great thanks! I’m still getting my Python legs back and I tend to forget basic stuff like this. I’l give it a try.

It worked! I was so close haha.
Thanks!

No problem, good to hear everything worked out!