I am just starting with python and just trying to understand how to submit a proper job that uses the added arguments (the current rendering frame) but this already fails for somehow.
What I do:
I submit with the DL-monitor a python job.
I add the Arguments < STARTFRAME > < ENDFRAME >
Frame List -> 1-4
The python job contains this code:
def __main__ ( *args ):
with open( "X:/DL_test.txt", "w" ) as f:
f.write( "Frame: " + str( args[0] ) )
When the job is completed the function main didn’t actually run.
If I submit a python file without the main function the code does work and a txt is created but I can not use the arguments.
From the Job info parameters it refers to the plugin=Python.
What do I miss here and how do I let Deadline to run the main function that passes the *args?
__main__ is only automatically call if it’s part of a class. Python jobs in this case are normal Python scripts. So you can either do the whole thing without def, or call the def manually at the end.
That is when the script is run as part of Deadline eco-system (sorry I don’t know a better term for this). Those are executed as part of other task so it has access to all Deadline classes and objects.
However for stand-alone script I don’t thnk you have access to that, as mentioned above, they’re normal Python script with no relation to Deadline. You can use stand-alone API to query info from Deadline but the ID will have to be passed manually.