NOTE: The following was written for Deadline 5, and needs to be updated for Deadline 6/7. For now, see the “simple_slate_h264_*” scripts in yourRepository/draft/Samples/Encode/ for updated examples.

## Problem¶

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.

## Solution¶

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

#Call the utility function

#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"]


## Discussion¶

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 the earlier Cookbook entry Setting Up Custom Command Line Parameters.

## 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
elif sys.platform.startswith( 'darwin' ): #Mac OSX