I’m looking at the cookbook to get started on my first draft template. I’m trying to make a template that will run from the afterEffects client submission plugin & create a quicktime from the set of png images that were rendered. The cookbook is great, but all the examples have hardcoded fileNames & frameNumbers. The only reference I can find for how to grab incoming variables is the video here:
I think the best starting point is the sample scripts, which are included in the Deadline repository. You can find them in \REPOSITORY\draft\Samples (where REPOSITORY is the path to your Deadline repository).
The \REPOSITORY\draft\Samples\Encode\encode_to_MOV_MJPEG_720p.py script may be a useful starting point. You’ll probably want to make a few changes to this script. For example, this script uses the MJPEG codec. If you want to use H264 instead, go to line 25, and change “MJPEG” to “H264”.
Also, this script scales images to 720p resolution. If you want to use the original image resolution instead:* Go to line 52, and change “width=outputWidth, height=OUTPUT_HEIGHT” to “width=firstFrame.width, height=firstFrame.height”, and
Remove line 61 (“frame.Resize( outputWidth, OUTPUT_HEIGHT, type=‘fill’ )”)
The example scripts are good, and I really like the cookbook idea, but a referenence manual is a must. Especially since all over the cookbook there’s recipes showing you how to access additional/custom values, etc. in a addition to the standard/default stuff. Which is awesome if there’s a reference someplace detailing what the standard stuff you is.
For example, what are all the keys that can be in the ‘expectedTypes’ dictionary passed to ‘ParseCommandLine’ and where would one find a list of those? Or what other utility functions like ‘ParseCommandLine’ exist?
Well, that turned into a bit of a rant, sorry about that >_< I like the documentation you’ve got, I just think it’s rather incomplete.
We plan to also document the DraftParamParser, which is an extra set of python functions that help Draft integrate with Deadline. The DraftParamParser library is a python script that you can open and look at in a text editor if you wish (you can find a copy of it in DeadlineRepository\draft\Windows\64bit), as is the Draft submission script (located in DeadlineRepository\scripts\Submission).
The standard parameters that you would use with expectedTypes are those defined by the Draft submission script. If you haven’t customized your submission script, the parameters it automatically sets up include: username, entity, version, frameList, startFrame, endFrame, outFolder, outFile, inFile, and deadlineJobID. (Some of these aren’t included if they were left empty.) You can also add your own additional parameters using the “Additional Args” field.
The types you can specify are ‘’, ‘’ and ‘’.
If you leave a parameter out of expectedTypes, it will still be returned, but it will default to string.
The other functions you are likely to use from DraftParamParser include ReplaceFilenameHashesWithNumber, FrameRangeToFrames, and possibly GetDeadlineJobProperties.
Until we get the documentation written and available, if there’s anything else I can help you with, do let me know.
Speaking of the command line parser, I think you should consider transitioning to a native python solution that pulls job info out of the MongoDB instead of pushing it through the command line. It would offer far richer meta data info. Just pass the Job ID that it’s attached to and then the draft scripts could dig into any of the parameters they need.
Draft shouldn’t be pulling anything directly out of the Deadline DB, that would be a maintenance nightmare and would lead to tons of bugs.
If you just want to grab extra stuff from the Job that isn’t in the command line, you should already be able to do that through Deadline’s Python API. What’s stopping you from doing that currently?
Sorry, not directly from the DB I mean using the python API to pull the info. So instead of Draft Scripts being fed a bunch of command line arguments I would expect the Draft script to just be fed the job GUID and then as a first step pull the job info via the python API.
Right. When Deadline creates a Draft Job based on another Job it already passes in that Job ID as a parameter, so I’m a bit confused as to what’s preventing you from doing exactly what you describe already. Or am I just misunderstanding something?
Well currently you pass about 10 variables to Draft scripts in the Draft plugin. I’m saying it would make a lot more sense to pass one argument (the job) and then you wouldn’t even need the DeadlineArgsParser at all. Instead I would just have you by default build a class in the examples of every job property. The current parser is a bit clunky if you want to add or remove extra flags. You have to include 18 lines of code in every Draft script for the expected Types dict even though I don’t use any of them. I would much prefer to move the command line args out of the equation entirely and build the parameters out of job properties in the database.
If you’re not using those parameters, you can leave them off. You only need to add them to the expected types dictionary if you want them converted to a type other than String. Anything not included in the expected types dictionary will still appear in the parameters, but the values will default to string.