Using Deadline Job Values


When a Draft job is submitted to Deadline using either the Draft Event Plugin or the Job right-click Submission Script, it is tied to another Deadline Job.  This ‘original’ Job is generally the Job that was responsible for creating the input for Draft, and a lot of info from this Job is passed onto Draft.  However, Deadline does not pass all of the Job Properties, and getting those into your Draft script will require either parsing the XML Job file or making calls to DeadlineCommand and parsing its output.


Fortunately, we have recently added a helper function to the DraftParamParser utility script to do this complicated work for you.  The GetDeadlineJobProperties function takes the path to the Deadline Repository and a Job ID as parameters, and returns a dictionary of Job Properties for that particular Job: 

from DraftParamParser import *

#Sample input
deadlineRepoPath = r"\\repoServer\DeadlineRepository" #Deadline repository 
deadlineJobID = "999_050_999_4253fd64" #The ID of the Deadline Job to parse

#Call the utility function 
jobProps = GetDeadlineJobProperties( deadlineRepoPath, deadlineJobID )

#The function returns a dictionary, you can now access any Job property: 
print jobProps["Name"] #prints out the original Job’s name

#Some properties are lists:
print jobProps["AuxiliaryFileNames"][0] #prints out the first aux filename

#ExtraInfoKeyValues is a dictionary:
print jobProps["ExtraInfoKeyValues"]["DraftTemplate"]



As a general rule, values in the Dictionary will be returned as strings (or None if there is no value).  Exceptions to this rule are for any property containing lists (which are returned as lists of strings), and ExtraInfoKeyValues, which are returned as a Dictionary.  Available properties generally correspond to the Job properties listed here, minus the ‘Job’ prefix. 

To confirm the name of a given property, you can check by simply opening a .job file found in the Deadline Repository and inspecting the Tag names.

Getting the Deadline Job ID

If the Draft job is tied to another Deadline job, as described in this entry’s Problem description, Deadline will pass the ID of this ‘original’ job as a parameter to your Draft template, as ‘deadlineJobID=<job ID>’.  You can get the actual value from the template parameters by using the Param Parser utility function, as shown in this earlier Cookbook entry here.

Cross-Platform Path Considerations

You may have noted that the GetDeadlineJobProperties function expects you to provide it with the path to the Deadline Repository.  If you have a cross-platform render farm, that path might be different based on which OS the Slave is running on.  Aside from setting up an OS-specific Group for Draft jobs, there would be no way to guarantee which OS the Draft Job might run on.  In that case, it would be best to specify the Repository Path based on the current OS, as follows: 

import sys

dealdineRepoPath = “”
if sys.platform.startswith( ‘linux’ ): #Linux
	deadlineRepoPath = r“/mnt/DeadlineRepository”
elif sys.platform.startswith( ‘darwin’ ): #Mac OSX
	deadlineRepoPath = r”/Volumes/DeadlineRepository” 
elif sys.platform.startswith( ‘win32’ ): #Windows
	deadlineRepoPath = r”\\repoServer\DeadlineRepository”