I want to write a Python script which scans a directory
for any image sequence(-s). If it finds any I want this Python
script to launch (lets say RVIO) rendering job for each image sequence found via Deadline.
I know there are number of articles in docs describing how to
write a custom submission script with Python. But those custom plugins
would still need a human input (submission).
What I want is that Python to initiate and to submit each job in a loop as many times as needed
without a need for a user’s input.
Many thanks in advance!
Those scripts can be used as a template to write your script, since they provide good examples of how to create the necessary submission files and then submit them to Deadline. In fact, the RVIO submitter is definitely a good place to start!
Instead of prompting the user with a submission dialog, it would just scan the directory and loop over the results to submit jobs. You would do this loop in your main function, and then each iteration of the loop would call the function to submit the job. You would probably need to edit the existing function that submits the job to take specific parameters, and you would also have to change it so that it doesn’t try to pull values from a submission dialog. Instead, it would hardcode certain values (ie: pool, group, priority, etc), and take other values from the function parameters (ie: input path and output path).
You could then execute this new script from the Monitor manually, or set up a scheduled task to call “deadlinecommand.exe -ExecuteScript myscript.py” at certain intervals (where myscript.py is your submission script).
Hope this helps!
- Ryan
Great! Thanks Ryan!
Let me re-phrase that…as I understand it: In order for Deadline to accept and execute a job from Python (doesn’t matter what job: maya or nuke) the Python script itself must to be run from within Deadline. This Python script should be run from Deadline Monitor -> Submit -> Python job or from a command line using the following syntax: “deadlinecommand.exe -ExecuteScript myscript.py”
Let’s say, myscript.py written to scan a directory for the image sequences. This script will loop a function that initiates and starts the Deadline rendering job for each image sequences found.
What happens if this myscript.py is run from Python shell itself instead of from Deadline Monitor submission? What is the difference between running a script in a Python shell and running the same script from Deadline Monitor?
If you run the script from a python shell, you will not have access to the Deadline modules. However, that’s not necessarily a problem because you can still have your scripts create the job files, and then call deadlinecommand.exe to submit them to Deadline. You can take a look at the integrated Nuke submitter in \your\repository\submission\Nuke to see how we do this in native python.
Eventually, we would like to have proper python modules for Deadline that can be used in native python scripts…
Cheers,
- Ryan
Even while it is currently not possible to run Deadline commands from a native Python shell I am still glad there is a way around it by utilizing Deadline itself to run and execute python scripts!
I understand that using the submission python scripts (such as Nuke or RVIO) is a good place to start while writing your own Python scripts. I just wish the syntax and commands used there would be somewhat documented in more details.
The only place I was able to find where this information is available is in the docs under the “Scripting Deadline” section. I guess it should be a main reference library to anyone who attempts to write a Python script for Deadline.
From a quick look through the documentation it appears that any Deadline Python submission script to work with Deadline is actually accompanied with a few others scripts: usually .param and .nlinit
For those Python scripts executed via Deadline-Submit Python script or by using a command line: “deadlinecommand.exe -ExecuteScript myscript.py”
the need for the .param and .nlinit is not required, correct?
Right. The dlinit and param files are only need for Deadline plugins and event plugins. The only requirement for scripts being executed with deadlinecommand.exe -executescript is that they have a main function defined.