0.0
No commit activity in last 3 years
No release in over 3 years
Wrapper process around rufus-scheduler
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

rufus-runner

Build Status

Wraps rufus-scheduler in a standalone process, with job timing, logging, and safe defaults.

Note: I did not write this gem, only deployed it to RubyGems. The project appears to be dead and I'll provide support the best I can. If the original authors decide they want to take it back over, just let me know.

Forked from: https://github.com/HouseTrip/rufus-runner

Installation

Add this line to your application's Gemfile:

gem 'rufus-runner'
$ bundle

Or install it yourself as:

$ gem install rufus-runner

Create a configuration file:

# config/schedule.rb
Rufus::TrackingScheduler.start do |scheduler|
  # sentinel job that keeps running to prove Rufus is still alive
  scheduler.run :name => 'no-op', :every => '60s' do
    Kernel.sleep(1e-3)
  end
end

The #run method simply takes the same options as Rufus's #every method, with these safe defaults:

:mutex             => <m>       # because Rails is not thread-safe
:timeout           => 60        # we don't want no long-running jobs, they should be DJ'd (seconds)
:discard_past      => true      # don't catch up with past jobs
:allow_overlapping => false     # don't try to run the same job twice simultaneously

Where <m> is a shared, global instance of Mutex.

Finally, run it:

$ rufus-runner config/schedule.rb

Rails

If you're running Rails, you might want to have an environment loaded in the scheduler. Simply add on top of your schedule:

# Rails 2
require 'config/boot'
require 'config/environment'

# Rails 3
require 'config/application'

When Rails is present, rufus-runner will call ActiveRecord::Base.clear_active_connections! after each job for you.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request