I’m working up a script to look for job dependencies based on a naming convention (other jobs with a specific prefix plus the same file name)
I have it working with the following code:
[code]def main():
Job = MonitorUtils.GetSelectedJobs()[0]
deadlineCommand = "C:/Program Files/Thinkbox/Deadline7/bin/deadlinecommand.exe"
response = subprocess.Popen([deadlineCommand, "-GetJobIdsFilter", "Name=ASP_" + Job.JobName], stdout=subprocess.PIPE)
dependencies = response.communicate()[0].rstrip().split('\n')
for i,dependency in enumerate(dependencies):
dependencies[i] = dependency.rstrip('\r')
Job.SetJobDependencyIDs( dependencies )[/code]
However I don’t want it to overwrite all the job dependencies, in case there’s one that no longer follows the naming convention but should be a dependent.
Any time I’ve attempted to use Job.JobDependencyIDs though, I’ve been unable to get any results out of it. It never returns any IDs and it seems to break the script. I’ve used other attributes like JobName and Comment just fine, so I don’t know why this one in particular is giving trouble.
Here’s the kind of thing I was trying to do with it:
[code]def main():
Job = MonitorUtils.GetSelectedJobs()[0]
deadlineCommand = "C:/Program Files/Thinkbox/Deadline7/bin/deadlinecommand.exe"
response = subprocess.Popen([deadlineCommand, "-GetJobIdsFilter", "Name=ASP_" + Job.JobName], stdout=subprocess.PIPE)
dependencies = response.communicate()[0].rstrip().split('\n')
for i,dependency in enumerate(dependencies):
dependencies[i] = dependency.rstrip('\r')
dependencyIDs = JobDependencyIDs
for i,dependency in enumerate(dependencies):
if dependency not in dependencyIDs
dependencyIDs.append(dependency)
Job.SetJobDependencyIDs( dependencyIDs )[/code]