Hey all, I’m looking at Job Scripts — Deadline 10.1.20.3 documentation and trying to implement a script that’ll cause a job to release once an hour has passed. So, I’d like to be able to query the job (given from the input job ID from the __main__
args) from the Deadline db and get the submission date so I can decide if it should be released or not.
How would I best go about doing that? If I try to connect to Deadline with something like this:
from Deadline import DeadlineConnect
def __main__(job_id, task_ids=None):
conn = DeadlineConnect.DeadlineCon(...)
...
Then it fails because it can’t find the Deadline API. I’m sure this is a simple thing that I’m missing, but I don’t see any docs or examples that shows what I should do. Thanks!
What are you trying to achieve with this delay? You could make use of Event Plugins to release jobs (by doing a check on all jobs for example when a Slave goes idle, or maybe on House Cleaning intervals etc):
https://docs.thinkboxsoftware.com/products/deadline/10.1/1_User%20Manual/manual/event-plugins.html?highlight=event%20plugin#event-plugins-detailed-ref-label
https://docs.thinkboxsoftware.com/products/deadline/10.1/1_User%20Manual/manual/event-plugins.html?highlight=event%20plugin#creating-an-event-plug-in
Doing it on the job itself may be trickier and inefficient if you need a timed release. For example, you could run a PreJobScript that just runs a Python timer and finishes after an hour, but clearly not ideal in terms of resources being used up.
As for getting the Submit Date+Time:
https://docs.thinkboxsoftware.com/products/deadline/10.1/2_Scripting%20Reference/class_deadline_1_1_jobs_1_1_job.html#a3573fab683e25a9beb93d221d7035d39
So, here’s the problem/solution that I have at the moment.
We have assets with sub assets that we want to automatically update if the sub asset has been updated. But if we have multiple sub assets that have been updated, we don’t want the asset to be updated multiple times when one would suffice. Also, we want people to be able to manually let jobs go through if they need the asset updated now.
The solution we currently have is to add a job dependency script that’ll release the job after an hour. The benefit of the solution is that we can let the job get released after an hour automatically, and people can manually release the job by hand. The issue I ran into with the solution was that the Deadline API isn’t available for the job script, so the workaround I did was to create a subprocess of the deadlinecommand
and get the data I need that way.
You can make use of the web API as well using requests if you know your Deadline Host address and Port:
https://docs.thinkboxsoftware.com/products/deadline/10.1/1_User%20Manual/manual/rest-jobs.html#get-all-the-jobs
Another way to approach this might be that you could query the active jobs and requeue the main asset job if a sub asset is updated, otherwise send a new job if it’s already completed. Not sure how your workflow is currently set up i.e. if you end up with lots of pending jobs for the main asset if multiple sub assets are updated in a short span like you say.