0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Run a rake task in multiple processes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7

Runtime

>= 1.3.0
>= 10.0.0
 Project Readme

Rake::Multiple

Rake::Multiple is the easiest way to run the same Rake task in multiple forked processes. It's particularly useful if your app is hosted on a PaaS provider, such as Heroku, and you want to run multiple worker processes by container, saving money.

Installation

Add this line to your application's Gemfile:

gem 'rake-multiple'

And then execute:

$ bundle

Usage

Rake::Multiple can invoke any task by prefixing the multiple namespace to the task. So if you're running:

rake jobs:work

You can then run two processes in your app with the following command:

MULTIPLE_WORKER_COUNT=2 rake multiple:jobs:work

If your tasks need has dependencies, you can run a specific dependency by using the MULTIPLE_EXECUTE_TASK variable.

MULTIPLE_WORKER_COUNT=2 MULTIPLE_EXECUTE_TASK=environment rake multiple:jobs:work

Contributing

  1. Fork it ( https://github.com/[my-github-username]/rake-multiple/fork )
  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 a new Pull Request