Submitting through python

Hi. first post. I’ve got a little python app I’m working on that manages footage coming in to the studio.
It manages moving footage and renaming folders on the SAN, etc. I was working on having certain files automatically transcoded with ffmpeg for Offline, DPX, etc. and it dawned on me that due to the overhead this may as well be handled on the farm with Deadline.

I haven’t really found much information on submitting from command line/python so I thought I’d ask if anyone had any thoughts on this or an example of a script that I could use to help me wrap my head around how this could work.

Basically a batch ffmpeg submission script to Deadline based on a file input and output variable.

Thanks!

Michael

Hi,

We use the python standalone api for all our submissions.

In a nut shell, you need to open a standalone api connection with:

import Deadline.DeadlineConnect as Connect Deadline = Connect.DeadlineCon(PULSESERVERNAME, 8080)

Then you need to know the job and plugin attributes that you need for the job:

[code]
JobInfo = {
“Name”: “python transcoding test”,
“UserName”: “kwatts”,
“Frames”: “1-1”,
“Pool”: ‘transcoding’,
“Plugin”: “Python”,
“Priority”: 50,
“EnvironmentKeyValue0” : ‘PYTHONDONTWRITEBYTECODE=1’,
“EnvironmentKeyValue1” : ‘PYTHONUNBUFFERED=1’,
}
#
PluginInfo = {
“Version”: “2.6”,
‘ScriptFile’ : ‘//path/to/python/script.py’,
‘Arguments’ : ‘’-a test - b awesome’’,

}[/code]

Then once you have these 2 dictionarys of job and plugin properties, you can then submit them to the farm, and it will return the job info:

try: newJob = Deadline.Jobs.SubmitJob(JobInfo, PluginInfo) pprint(newJob) except: print "Sorry, Web Service is currently down!"

The Hands down easiest way to find all the job and plugin properties is to look at hte submission scripts that come with deadline, they live in your repo location at:

$REPO/scripts/Submission

Bust open one of these files, scroll down to where it starts to add things to the StreamWriter and these will be all the properties you need.

hope that helps.

Cheers
Kym

Thanks Kym!

FYI. I would just add that the Python Standalone API or the RESTful http API (which the Python Standalone API is a wrapper around) both require our “Web Service” to be running on a machine:
docs.thinkboxsoftware.com/produc … rvice.html

RESTful http API:
docs.thinkboxsoftware.com/produc … rview.html

Additionally, you may find that simply using our DeadlineCommand.exe CLI utility to submit jobs is an easier approach for you, as this doesn’t require the WebService to be running:
docs.thinkboxsoftware.com/produc … mmand.html

Here’s how to manually submit a job using this executable, which of course could be driven via subprocess in Python:
docs.thinkboxsoftware.com/produc … ting-a-job
docs.thinkboxsoftware.com/produc … ssion.html

We also have an arbitrary command line job but this is quite basic (on purpose), but might be of help:
docs.thinkboxsoftware.com/produc … -line-jobs

Finally, the DeadlineCommand executable binary could be invoked by any scripting language you like.