Heyy, with the following code I tried to add a post job script to certain jobs.
from Deadline.Events import DeadlineEventListener
from Deadline.Scripting import ClientUtils, RepositoryUtils
def GetDeadlineEventListener():
return MayaScriptEventListener()
def CleanupDeadlineEventListener(eventListener):
eventListener.Cleanup()
class MayaScriptEventListener(DeadlineEventListener):
def __init__(self):
super().__init__()
self.OnJobSubmittedCallback += self.OnJobSubmitted
def Cleanup(self):
del self.OnJobSubmittedCallback
def OnJobSubmitted(self, job):
ClientUtils.LogText("in job submitted of maya script\n")
info_file_path = "C:/path/to/textfile.txt"
if not os.path.exists(info_file_path):
with open(info_file_path, "w") as info_file:
info_file.write(f"created\n")
script = self.GetConfigEntry("PostJobScript")
with open(info_file_path, "a") as info_file:
info_file.write(f"maya script path: {script}\n")
if "breakdown" in job.JobName:
RepositoryUtils.SetPostJobScript(job, script)
RepositoryUtils.SaveJob(job)
with open(info_file_path, "a") as info_file:
info_file.write(f"post job script set\n")
It creates the info_file and writes the right things but when I look at the job in the deadline monitor, it’s queued. The progress though is colored blue like it’s already completed. When I click on it I can see the post job script as a task and the frames. When I suspend the job, it becomes corrupted, then I can repair it, it becomes suspended and then I can resume the job and it works. Why does it have these difficulties in the beginning? What can I do to make it work right when it’s submitted?
Thank you in advance:)
Edit: I already tried to use a OnJobFinished-function
and add the post job script there. Then the frames render fine and when they’re finished (marked as completed) the post job script appears as a task but it is immediately also marked as complete even though the post job script wasn’t executed. The job itself is also marked blue as complete but it only says 50% rather than 100% (I only have one other task (the frames) beside the post job script)