AWS Thinkbox Discussion Forums

Interruptible Jobs - Time Remaining Threshold error

"Error: RemTimeThreshold must be a value between 0 and 0 inclusive (Deadline.Submission.DeadlineSubmissionException)"

We get this as we try to programmatically set a job to be interruptible. Not sure what is happening. If we don’t set a time and it gets set to the default 0, or we set it to 0, the time is passed through and it works (as the error above would suggest).

Here’s the snippet of code:

[code] interruptible = kwargs.pop(‘interruptible’, False)
interrupt_percentage = int(kwargs.pop(‘interrupt_percentage’, 100))
interrupt_timerem = int(kwargs.pop(‘interrupt_timerem’, 0))

if interruptible:
    JobInfo['InterruptiblePercentage'] = interrupt_percentage
    JobInfo['RemTimeThreshold'] = interrupt_timerem[/code]

Are the two properties mutually exclusive? Am I missing something else?

Nah, that’s definitely a bug on our part. The max and min of that property are both zero which defeats the property:

			job.RemTimeThreshold = GetOptionalJobInfoValueAsInteger( jobInfo, "RemTimeThreshold", "0", 0, 0 );

This should be an easy fix.

Okay, we’ll set those manually for the time being. Glad it’s not something obvious I was missing. ^_^; When it’s fixed (hopefully soon, but not likely to be within the next several days I’d assume), where would I find that fix?

Thanks!

We’ll mention it in the release notes for the service pack as usual:
docs.thinkboxsoftware.com/produ … ne-release

I’ve asked if we can move it onto the dev sprint, but it will likely take a few weeks…

How are you submitting the jobs? We should be able to work around this with some scripting, you’d just have to pull the job object out after submission, change it, then re-save.

We create a deadline_job class with the JobInfo and PluginInfo dictionaries as attributes and a spool method, then connect to the repo and submit using the two dictionaries in the spool method

[code]from Deadline.DeadlineConnect import DeadlineCon as Connect
farm = Connect(“deadline.repository.url”, 8082)

newJob = farm.Jobs.SubmitJob(self.JobInfo, self.PluginInfo)

#MORE CODE HERE

return newJob[’_id’][/code]

I like your solution, am already implementing it. I’ll come back to post how it went.

Yup, the solution totally works.

In our deadline pipeline hook (inside a spool method inside a custom class with jobinfo, plugininfo dicts as attributes):

[code]#Previously imported: from Deadline.DeadlineConnect import DeadlineCon as Connect

farm = Connect(‘url.for.repository’, 8082)

try:
newJob = farm.Jobs.SubmitJob(self.JobInfo, self.PluginInfo)
assert isinstance(newJob, dict)

except Exception as e:
if “RemTimeThreshold” in newJob:
# Error message has the bug warning in it, try again.
log.warning(“Known remaining time threshold bug. Attempting to submit without it and send time as envvar…”)
# Remove the key from JobInfo
rem_time = self.JobInfo.pop(“RemTimeThreshold”)
log.debug(“RemTimeThreshold: %d” % rem_time)
# Make sure we don’t step on toes with other envvars
env_vars = [env_var for env_var in self.JobInfo if ‘EnvironmentKeyValue’ in env_var]
self.JobInfo[‘EnvironmentKeyValue%d’ % len(env_vars)] = “REM_TIME_THRESHOLD=%d” % rem_time

    try:
        newJob = farm.Jobs.SubmitJob(self.JobInfo, self.PluginInfo)
        assert isinstance(newJob, dict)

    except Exception as e2:
        log.error("Yeah, still couldn't spool. Raising the error!", exc_info=True)
        raise e2

else:
    log.error("Could not spool. Here's why.", exc_info=True)
    raise e[/code]

And in our custom event on the Deadline Repository, under the OnJobSubmitted callback:

if 'REM_TIME_THRESHOLD' in env_key_list: self.LogInfo("Hacktastically setting RemTimeThreshold for interruptible job! (Have they fixed this bug yet?)") job.RemTimeThreshold = int(job.GetJobEnvironmentKeyValue('REM_TIME_THRESHOLD')) RepositoryUtils.SaveJob(job) else: self.LogInfo("RemTimeThreshold is not here, moving on....")

LOL. I enjoy your diagnostic output there. I’m pretty similar in my code. We had a chuckle at this bug, but sorry you had to find it.

The good news is that we have it fixed in the source tree. I’m not sure if the next SP will include it, but the one after should.

Privacy | Site terms | Cookie preferences