How can I override a job's framerange from the event plugin?

All the frames properties are read only, how do I override the framerange of a job in a OnJobSubmitted callback?

When nothing else works, use deadlinecommand :slight_smile:

ClientUtils.ExecuteCommand (["SetJobFrameRange ", aJob.JobId, "1-20", "2" ])
1 Like

ah ofcourse! :man_facepalming:

It might not work in an Event though - I just tested, and it appears that when that line is run in an Event Script, it does not modify the submitted job because the event is triggered by deadlinecommand too early.

It does work in a General Monitor script.

This works though:

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

def GetDeadlineEventListener():
    return JobSubmissionFrameRangeEventListener()

def CleanupDeadlineEventListener( eventListener ):
    eventListener.Cleanup()

class JobSubmissionFrameRangeEventListener (DeadlineEventListener):
    def __init__( self ):
        self.OnJobSubmittedCallback += self.OnJobSubmitted
        
    def Cleanup( self ):
        del self.OnJobSubmittedCallback
     
    def OnJobSubmitted( self, job ):
        self.LogInfo( "OnJobSubmitted Frame Range Callback!" )
        RepositoryUtils.SetJobFrameRange(job, "1-20", 2)
        RepositoryUtils.SaveJob(job)
        pass

Yep, I noticed this…

Maybe OnJobStarted?

I simply want to override the framerange so it does first-middle-last-rest

I updated my reply with the working example using RepositoryUtils.SetJobFrameRange()

Awesome!

Are there any docs about the RepositoryUtils?

1 Like

Ah it was in there the whole time :stuck_out_tongue:

Thanks! :slight_smile:

Also you might want to look at Deadline/Custom/events/AutomaticPreviewJobSubmission at master · ThinkboxSoftware/Deadline · GitHub

It’s kinda-sorta what you’re looking to do, and might at least have some goodies you’re interested in.

1 Like

Thanks! I will take a look and maybe take some code from that :wink:

1 Like