Introducing ScheduledJob

RightScale releases ScheduledJob, an open source scheduler that builds on top of DelayedJob.

Introducing ScheduledJob

TL;DR We’re open-sourcing ScheduledJob, a thin flexible interface that enables you to define recurring jobs using DelayedJob, e.g:

1
2
3
4
5
6
7
8
9
10
  class WeeklyMetricJob
  include ::ScheduledJob

  def perform
    ScheduledJob.logger.info('I need to do something over and over')
  end

  def self.time_to_recur(last_run_at)
    last_run_at.end_of_week + 3.hours
  end

During the development of RightScale Cloud Analytics, we needed a lightweight background job framework for various tasks. We run our background jobs on a ServerArray that can auto-scale.

There are a whole host of options in the background job space including:

DelayedJob made a lot of sense for us as it integrates nicely with ActiveRecord and we have used it on a couple of other projects successfully in the past. However, the problem we faced was how to make jobs run on a scheduled basis. An example of this could be a cleanup task that deletes old records from a table. Whilst this is not something that you want to run all the time, it is something that you may want to run say once a week.

There are some options for doing this, for example:

We developed ScheduledJob as none of these options were quite what we were looking because:

Checkout the repo for details, and create issues or send pull-requests!

If you like this kind of thing, you might be interested in joining our team.