Changing the "Group" that the job is assigned to from the plugin script

Hello,

I’m wondering how I can change the Group or a Pool of a job after it failed to render.

My solution is that in the plugin script, I’m checking the error code, and if it isnt 0, I will change the jobs “Group” and fail render so that it gets picked up by different slaves.

The only issue is that I dont know how to change the “Group” with deadline API.
The code I have been using is:

self.GetJob().JobGroup = "high_spec"

But it doesnt seem to work. I also cant find any other method in the API that would allow me to modify this property. I can print the existing group just fine, but cant modify it.

Any help would be appreciated!

CHeers,
Michael

Hello!

I bet you’re missing a RepositoryUtils.SaveJob(job) to get your update back to the database. So you’d want:

currentJob = self.GetJob()
currentJob.JobGroup = "high_spec"
RepositoryUtils.SaveJob(currentJob)

However, instead of updating the application plugin I’d instead use an Event Plugin that fires off of the OnJobFailedCallback or OnJobErrorCallback to update the job after an error or failure occurs.

That way you can have this failure recovery code affect multiple plugins if you’d like. And in my opinon it’s a pain to keep track of customization in the application plugins as they’re already fairly complex.

1 Like

Thank you very much Justin, the RepositoryUtils.SaveJob(job) did the trick!
I will also look at the Event Plugins scripts as suggested.

Privacy | Site terms | Cookie preferences