Jamie McCrindle
Jamie McCrindle

Reputation: 9214

Dynamic job scheduling in Rails

I've had a look at a number of scheduling libraries for Rails and I'd like some help choosing one, given that none quite seem to meet my requirements. It's a fairly common use case:

We have a number of reports and we'd like to let users set up when they would want to schedule when and how often a particular report is sent to them by mail. Users need to be able to see a list of the reports they have scheduled and they should be able to cancel or change existing scheduled reports. Scheduled jobs should survive restarts of the server. At the moment I'm not worried about only running jobs on a single node in a cluster of rails servers.

Upvotes: 15

Views: 13012

Answers (3)

Mike Trpcic
Mike Trpcic

Reputation: 25659

I would recommend using Delayed::Job for the actual jobs, as it automatically handles persistence for your users, and you can use the delayed_jobs table for the management (allowing users to modify/delete jobs that they've started).

When it comes to automatically scheduling jobs, you can use the Clockwork gem. It was built by Heroku (If I'm not mistaken), and essentially allows you to emulate/replace cron within your ruby/rails app.

With the two libraries above, you've got all your bases covered.

Upvotes: 8

Khash
Khash

Reputation: 2570

My company makes CloudQuartz (www.thecloudblocks.com) which allows you to schedule the jobs through an API and get callbacks when they are due to run.

It has a web UI to show you about jobs, their trend and their status, but this UI would not be open to your customers unless you use the API. Hope you find this helpful.

Upvotes: -1

nathanvda
nathanvda

Reputation: 50057

I would decide against resque for exactly the same reasons. Instead we went for delayed-job as well, and indeed, the last thing a job does, is reschedule the job to run again next time.

Upvotes: 1

Related Questions