Auto-suspend Tasks based on submission region

Hi, I am attempting to set up an event that auto-suspends tasks on submission based on region.

We have multiple regions that only sync periodically, but a centralised render system. I would like to be able to set it so that people working on-site at the render system’s jobs (most employees) are unaffected, but anyone submitting from off-site has their task suspended.

I have implemented an event that handles this, however it is not working correctly - it is unfortunately suspending ALL jobs that are submitted regardless of their region.

def OnJobSubmitted(self, job):
    if job.GetJobInfoKeyValue('region') != "siteA":
        RepositoryUtils.SuspendJob(job)

Any help is greatly appreciated

That looks correct, are you seeing any errors in the Monitor logs? Assuming you’re submitting test jobs from the Monitor.

I’d try printing out the region from one of the jobs as well, there might be a mis-match in what the Monitor shows and what the API is getting. I doubt it, but it’s worth checking.

Issue ended up being a missed capital… Should be

job.GetJobInfoKeyValue('Region')

1 Like