AWS Thinkbox Discussion Forums

Schedule a job to run every hour

I am attempting to setup a job that will run every hour.
Setting a job to repeat only allows for a 1 day or longer intervals.

What would be a workaround for this case?

Thanks!

You could create 24 jobs, one for each hour of a day.

What are you looking to do hourly? There might be a cleaner way.

Hi, bumping this subject as I’m also looking for a way to execute a job more than once a day, for example a python job that inspect the “master cut” and generate a new “encode job” every 2h if something changed in the edit.

I wanted to use Deadline for this, because

  • it would save me the trouble of having a dedicated server/VM for Cron jobs,
  • using deadline makes it “visible” to users and TDs, this not some hidden voodoo but an actual job they can look at and check its output directly

Would be a nice feature !

Cheers,
Alexis

The way some parts of Deadline deal with recurrent operations is by registering an Event Plugin to the On House Cleaning callback. For example the Deadline Spot Event Plugin uses this. The House Cleaning runs periodically, by default every 60 seconds. So an Event Plugin registered to that callback could check the last run time, and if an hour, or two hours, or whatever threshold you have defined has passed, it could then resume the particular job which would perform your operations, show progress in the Monitor, spawn other jobs if needed, and then mark itself as Completed again. The Event Script would write to the database the last time it triggered this, and then it would wait again for the specified time before repeating…

If you don’t want to have a visible Job representing that Python script doing the work for you, you could encode all the logic of it in the Event Plugin itself. The side effects will be visible (e.g. new jobs spawned to perform the encoding), but the Event itself would not have a Job-like representation with a progress bar in the UI - just a configuration dialog under Tools (Super User Mode) > Configure Events…

Look under your Repository/events/Spot/Spot.py for an example from which you could copy some logic. Esp. look for AddMetaDataEntry() and UpdateMetaDataEntry() to see how to store plugin-specific info in the Database, e.g. to store the last time the plugin executed its main logic…

Here is a quick and ugly Event Plugin which can be configured to requeue one job every N seconds (e.g. every 3600 seconds).

Requeuer.zip (1.4 KB)

If the job has Completed or Failed, it will be requeued when the given time has elapsed. If the job is in a Queued or Rendering state, it won’t be touched.

This way, you can create one Python Script Job on the queue that does your recurrent processing, and then copy its Job ID and paste it in the Configure Events > Requeuer configuration dialog, and set the desired time in seconds. If the Job has completed, it will be requeued every N seconds. If it is still rendering or waiting to be rendered, it won’t be modified.

To install, just create a Requeuer folder under DeadlineRepository10/custom/events/ and unzip the content of the attached archive. Feel free to improve the script, e.g. extend to support multiple jobs with unique time periods…

1 Like

Hi Bobo,

Thx for the feedback, I already have a couple of Event plugin in production (tweaked zabbix and one that change pools on a few machines at night/workday) so I am familiar with the “OnHouseCleaning” trick, but I was missing the “metadata/last runtime” to have a cron-like behavior.

Thx for the pointers and the example, that should do it !
Looking at how scheduling is managed/presented in deadline at the moment, I see how cumbersome it would be to add a finer “interval” mechanism, but I still think it would be a nice feature :slight_smile:

Cheers,
Alexis

Privacy | Site terms | Cookie preferences