Project

spool

0.0
No commit activity in last 3 years
No release in over 3 years
Manage and keep alive pool of processes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 0.8
< 5.11, ~> 5.0
~> 0.2
~> 11.0
~> 0.12

Runtime

>= 0.4.4, ~> 0.4
 Project Readme

Spool

Gem Version Build Status Coverage Status Code Climate Dependency Status

Manage and keep alive pool of processes

Installation

Add this line to your application's Gemfile:

gem 'spool'

And then execute:

$ bundle

Or install it yourself as:

$ gem install spool

Usage

Setup

Worker

loop do
  puts "#{Process.pid} - #{Time.now}"
  sleep 1
end

Pool config

processes 4
command 'ruby worker.rb'
# optional
dir File.dirname(__FILE__)
env VAR1: 'foo', VAR2: 'bar'
pidfile 'pool.pid'
restart_when { |p| p.memory > 512 }

Start

console:~$ spool pool_config.rb

Signals

  • INT/TERM: quick shutdown, kills all processes immediately
  • QUIT: graceful shutdown, waits for processes to finish
  • HUP: reloads config file and gracefully restart all processes
  • USR2: gracefully restart all processes with current configuration
  • TTIN: increment the number of processes by one
  • TTOU: decrement the number of processes by one

Contributing

  1. Fork it ( https://github.com/gabynaiman/spool/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