AWS Thinkbox Discussion Forums

Custom action to suspend a task/job

I’m trying to use Deadline to manage Abaqus FEA simulations. With a simple plugin it’s easy to start an analysis, but I would like to add the option to suspend the analysis. As the analysis is always just one task, the task needs to be suspended by a special command to Abaqus and next the job needs to be set to “Suspended” as the Abaqus process needs to keep running. Is it possible to add special Suspend callbacks to a plugin?
If this is not possible, I might be able to make it work with an additional layer in Python, but I would prefer not doing this…

Thanks in advance!
Joost

Would it be an option to listen to the Deadline.Events.DeadlineEventListener.OnJobSuspendedCallback signal that gets emitted when a job is suspended? This way you could just use the built-in Monitor tools to suspend your job, and your event plugin would deal with communication with your simulation host.

However, I’m not sure if Deadline forces the process to be killed when a job is suspended. That could be a bit of a snag I gues…

https://docs.thinkboxsoftware.com/products/deadline/10.0/2_Scripting%20Reference/class_deadline_1_1_events_1_1_deadline_event_listener.html#a2f52ee9249b8c485517aa1529ad93358

I was indeed looking at event plugins, I guess part of the work could be done there (at least calling the suspend command for the process). But in my understanding of the documentation, the OnJobSuspendedCallback is run after the job actually suspended. It seems Deadline kills the task processes and next changes status to “suspended”. When suspending the job I can choose not to suspend the task to let it finish. In that case Deadline is waiting for the task process to finish before it changes the job status to suspended. But as the task process keeps running, the job never reaches the suspended state.
So I need to catch the event of “requesting job suspension” and I need to be able to set the job status to suspended in script…

I think I’ll have to look into an additional Python layer.

Makes sense. If the suspended state doesn’t get set before the job is killed/finished, you can’t really use that hook.

How about just making a very simple Monitor context script that performs your actions, in your preferred order? You would have access to the job and plugin object, so that part shouldn’t be too tricky, but you might still not be able to actually suspend the job and also have it continue to run (as per your findings).

However, if you set the suspended (but don’t kill process) flag, presumably it would be properly marked as suspended once the simulation gracefully exists?

Simple Monitor job-script example: https://github.com/ThinkboxSoftware/Deadline/blob/master/Custom/scripts/Jobs/QueryJobStats.py

(from memory, I think allowing multiple job selections requires a bit of script configuration from the Tools>Configure script menus dialog)

Privacy | Site terms | Cookie preferences