Project

batchy

0.01
No commit activity in last 3 years
No release in over 3 years
For handling all of the exceptions, states, timeouts, etc of batch processes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Batchy¶ ↑

A wrapper for batch processes. It was designed to be used with an asynchronous library like delayed_job or resque. Code wrapped in a batchy block will have it’s start and end time logged. Batchy will keep track of the current state of the batch from new to running to completion. Errors not handled in the batched code will be caught by batchy and logged. Callbacks can be defined for success, failure or both.

<img src=“https://secure.travis-ci.org/Raybeam/batchy.png?branch=master” />

Installation¶ ↑

$ gem install batchy

Or if you’re using bundler add batchy to your Gemfile and

$ bundle install

If you’re using Rails, you can generate a migration with

$ rails generate batchy:active_record
$ rake db:migrate

Configuration¶ ↑

For a full list of configuration options, check the documentation.

Batchy.configure do | c |
  c.allow_duplicates = false
  c.raise_errors = false
  c.name_process = true
  c.process_name_prefix = "[BATCHY]"
  c.allow_mass_sigkill = false
  c.add_global_success_callback do | bch |
    # do something on success
  end
  c.add_global_failure_callback do | bch |
    # do something on failure
  end
  c.add_global_ensure_callback do | bch |
    # do something regardless of end state
  end
end