Event Scripting - SetJobDependencyIDs command

Hello everyone,

I am working on maya 2013.

I was trying to use during an “on submission event” to create auto-dependency method.

My scenes have three job : BakeGI / BG / Char (one job per renderlayer)

During maya submission procedure, I am storing in a file each IDs with “pickle module” in a dictionnary

I have scripted something like this:

[code]import maya.cmds as cmds
import maya.mel as mel
import pickle
import glob

from Deadline.Events import *
from Deadline.Jobs import *
from Deadline.Scripting import *

def GetDeadlineEventListener():
return MyEvent()

class MyEvent (DeadlineEventListener):

def __init__( self ):
    self.OnJobSubmittedEvent += self.OnJobSubmitted

def OnJobSubmitted( self, job ):
    
    "1 - LOAD MY DICTIONNARY PROCEDURE"
    #self.myDic["FinalProc_" + PassJob] = [PassName, Version, JobID, ImagePath]


     "2- Set Dependency"
     if job.JobName = "CharJob":
          job.SetJobDependencyIDs((self.myDic["FinalProc_BakeGIJob"][2]),(self.myDic["FinalProc_BGJob"][2]))
          RepositoryUtils.SaveJob(job)[/code]

But “job.SetJobDependencyIDs” command doesn’t seem to work at the moment. At the moment, I’m using a procedure to modify the “.job” file in the repository with xml.etree.ElementTree module but I would prefer to use the deadline command.

So is the current command should be written : job.SetJobDependencyIDs( (FirstID) , (SecondID) ) or I’m missing something ?

Thanks.

After you call job.SetJobDependencyIDs(…), can you try printing out the value in the job.JobScriptDependencies property? This should determine if the values are being set in the job object or not.

Which version of Deadline are you using? There was a bug in Deadline 5 that could cause any changes made to a job in the OnJobSubmitted event to be ignored, but this is something that should be fixed in Deadline 6.

Cheers,

  • Ryan

Thanks for your answer,

I have found a moment to make some test. It is really behaving oddly. It seems that “job.SetJobDependencyIDs(…)” is “working”.
I printed “job.JobDependencyIDs” after the command and my Dependencies were assigned.

So, I checked in deadline monitor but the job was still green. When I hit the “modify Dependency”, Dependencies appeared in the list and when I clicked on “ok” to close the window, the job turn orange with status “Pending (Dependencies)”

I am quite puzzled… maybe I have a syntax error with the command : RepositoryUtils.SaveJob(job) ?

Or is it the bug you were talking about because I’m running Deadline 5.2 ?

I hope you have an idea.

Thanks

That’s what I’m assuming, especially since you confirmed it was set properly in the current job object. I don’t see any syntax errors there.

Is modifying the xml file directly a decent workaround for now? The issue above should be fixed in v6, so maybe this can get you by until you have a chance to upgrade?

Unfortunatly, modifying the xml seems to reproduce the bug.
I was wondering if there is a way to refresh the monitor dependencies with subprocess.

A friend of mine advise me to modify the “SubmitMayaToDeadline.mel” to delay the submission procedure and insert IDs during the proc.
I think I will go this way.

Thanks for your fast answers !
Have a good day.