AWS Thinkbox Discussion Forums

Prejob script submission issue in OnJobSubmitted callbacks

Hi,

I’m trying to create a custom event script which will add prejob script to any jobs submitted on the specified plugin type like Maya for example, using OnJobSubmitted callback function and RepositoryUtils.SetPreJobScript() function. But after submission this job never starts and always on queue and the progress bar show completed blue color like below screenshot,

If i suspend the first frame, the job shows corrupted like below,

Once i run Repair corrupted job and requeue it, the job runs fine after that. I’ve attached my prejob submission event script below,

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

def GetDeadlineEventListener():
    return PFxPreJob()

def CleanupDeadlineEventListener(deadlinePlugin):
    deadlinePlugin.Cleanup()

class PFxPreJob(DeadlineEventListener):
    def __init__(self):
        self.OnJobSubmittedCallback += self.OnJobSubmitted

    def Cleanup(self):
        del self.OnJobSubmittedCallback

    def OnJobSubmitted(self, job):
        pre_job = "L:/12_SCRIPTS_AND_WORKFILES/Pipeline_Files/pipeline_next/Deadline/pre_job/pfx_pre_job.py"
        if job.JobPlugin in ('MayaBatch'):
            try:
                RepositoryUtils.SetPreJobScript(job, pre_job)
                self.LogInfo("Pre-Job script added")
            except Exception as e:
                print(str(e))

Please let me know if i need to make any changes in the script or anyother way to submit prejob script for all type of plugins.

This is a known issue with SetPreJobScript and SetPostJobScript. The workaround I’ve used is this:

RepositoryUtils.SetPostJobScript(jobID, location)
RepositoryUtils.SaveJob(job)
newJob = RepositoryUtils.ResubmitJob( job, frameList, chunkSize, submitSuspended )
RepositoryUtils.DeleteJob(job)

Which adds the job script to a job, then re-submits it and deletes the old job. You’ll just have to make sure you add some check to keep from repeatedly re-submitting and changing the same job over and over.

Privacy | Site terms | Cookie preferences