Coder Social home page Coder Social logo

seomoz / resque-sliders Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kmullin/resque-sliders

0.0 96.0 0.0 670 KB

A Resque plugin that enables complete control over your running Resque Workers, all from the Resque-Web UI

Home Page: http://kmullin.github.com/resque-sliders

License: MIT License

Ruby 84.91% CSS 1.00% JavaScript 7.09% HTML 6.99%

resque-sliders's Introduction

Resque Sliders Build Status

github.com/kmullin/resque-sliders

Description

ResqueSliders is a Resque plugin which allows you to control Resque workers from the Web-UI.

From the Resque-Web UI, you can:

  • Start workers with any queue, or combination of queues on any host, and specify how many of each should be running
  • Pause / Stop / Restart ALL running workers

ResqueSliders comes in two parts:

  • KEWatcher: A daemon that runs on any machine that needs to run Resque workers, watches over the workers and controls which ones are running
  • Resque-Web Plugin: A bunch of slider bars, with text-input box to specify what queues to run on the workers

Installation

Install as a gem:

$ gem install resque-sliders

KEWatcher

This is the daemon component that runs on any host that you want to run Resque workers on. The daemon's job is to manage how many Resque workers should be running, and what they should be running. It also provides an easy way to stop all workers during maintenance or deploys.

When the daemon first runs, it will register itself, by hostname with Redis:

  • Adds a few persistent settings to the hash key resque:plugins:resque-sliders:host_configs (max_children, current_children)
  • Gets any queues that need to be running on the host by looking at resque:plugins:resque-sliders: + hostname
Usage: kewatcher [options]

Options:
    -c, --config CONFIG              Resque Config (Yaml)
    -max-time, --max-run-time SECONDS Number of seconds that a process
must finish within
    -r, --rakefile RAKEFILE          Rakefile location
    -p, --pidfile PIDFILE            PID File location
    -f, --force                      FORCE KILL ANY OTHER RUNNING KEWATCHERS
    -v, --verbose                    Verbosity (Can be specified more than once, -vv)
    -m, --max MAX                    Max Children (default: 10)
    -w, --wait WAIT_TIME             Time (in seconds) to wait for worker to die before sending TERM signal (default: 20 seconds)
    -t, --time MAX_TIME              Max Time (in seconds) to wait for worker to die before sending KILL (-9) signal (FORCE QUIT) (default: 60)
                                     NOTE: With Resque >= 1.22.0 force quit is handled for you so by default this is the same as:
                                           RESQUE_TERM_TIMEOUT=40 or the difference of MAX_TIME and WAIT_TIME
                                           more info: http://hone.heroku.com/resque/2012/08/21/resque-signals.html
    -a, --async                      Do NOT wait for Resque workers to die completely before spawning new workers (default: false)
    -V, --version                    Prints Version

Important Options

    -m|--max MAX            (Max Children): Maximum number of workers to run on host (default: 10)
    -w|--wait WAIT_TIME     (Wait Time): How long to wait before sending TERM to zombies (default: 20 seconds)
    -t|--time TIME          (Total Time): How long to wait before sending KILL to zombies (default: 60 seconds)
                            NOTE: Resque >= 1.22.0 includes signal handling of its own to force quit, so we use it if its there, and override with our own timeout here
    -a|--async              (Async): Should we spawn new workers before old ones have fully terminated (default: false)
    -r|--rakefile RAKEFILE  (Rakefile): Pass along a rakefile to use when calling rake ... resque:work - shouldn't be needed if run from project directory
    -f|--force              (Force): Force any currently running KEWatcher processes to quit, waiting for it to do so, and starting in its place
                            RAILS_ENV: If you're using rails, you need to set your RAILS_ENV variable

Controlling the Daemon

Once the daemon is running on each host that is going to run Resque workers, you'll need to tell them which queues to run.

Signals

KEWatcher supports all the same signals as Resque:

  • TERM / INT / QUIT - Shutdown. Gracefully kill all child Resque workers, and wait for them to finish before exiting
  • HUP - Restart all Resque workers by gracefully killing them, and starting new ones in their place
  • USR1 - Stop all Resque workers, and don't start any more
  • USR2 - Pause spawning of new queues, but leave current ones running
  • CONT - Unpause. Continue spawning/managing child Resque workers

The queue configuration is done via Resque-Web interface

Resque-Web

See below for screenshots

Buttons:

  • Play / Pause - Start or Pause
  • Stop - Stop all workers
  • Reload - Sends HUP signal to running KEWatcher

Resque-Web Integration

Main Screen: showing 3 hosts, and showing that one of the nodes is not running KEWatcher Screen 1

Host Screen: showing different QUEUE combinations (comma separated) and slider bars indicating how many of each of them should run Screen 2

To enable the Resque-Web Integration you'll need to load ResqueSliders to enable the Sliders tab. Just add:

require 'resque-sliders'

to a file, like resque-web_init.rb, and run resque-web:

resque-web resque-web_init.rb

Works on

resque-sliders has been tested on the following platforms:

Ruby

  • 1.9.3
  • 1.8.7 (ree)
  • probabaly more...

Contributing

Want to fix a bug? See a new feature?

  1. Fork me
  2. Create a new branch
  3. Open a Pull Request

resque-sliders's People

Contributors

kmullin avatar cypriss avatar

Watchers

Marc Mims avatar Myron Marston avatar Walt Jones avatar David Joslin avatar Dr. Pete Meyers avatar Anish Kumar avatar Jesse Brown avatar Jason Younker avatar  avatar  avatar David Overcash avatar Miranda avatar Peter Conerly avatar Shelly Matsudaira avatar Koos Kleven avatar Evan Leif Battaglia avatar Aqui Griffin avatar  avatar James Cloos avatar Carin Overturf avatar Dan Lecocq avatar Tyler Murray avatar  avatar  avatar James Dominguez avatar  avatar Manish avatar  avatar  avatar Don avatar  avatar  avatar Maura Hubbell avatar Jerry Feng avatar Peter Li avatar Shawn Edwards avatar  avatar  avatar Sambit  avatar Gabriel Cain avatar  avatar Mike O'Leary avatar Kelsey Foley avatar  avatar  avatar  avatar KSHITIJ GAUTAM avatar Jon White avatar  avatar Sam Sullivan avatar  avatar  avatar  avatar  avatar MarkG avatar  avatar Ahmed Radwan avatar  avatar Chell avatar Jowell Villasin avatar  avatar  avatar  avatar Chris Airola avatar  avatar Justis avatar Nicolas Menescardi avatar Greg Burton avatar Omar Tsai avatar  avatar  avatar Trish G. avatar  avatar  avatar  avatar  avatar Gary Webb avatar Chiaryn Miranda avatar  avatar  avatar  avatar Namrata Deshpande avatar  avatar  avatar  avatar Tammy Bailey avatar  avatar  avatar  avatar Scott E avatar Matt McDonnell avatar Jamie Alberico avatar Charles Robison avatar Esha Ray avatar Carlos Westman avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.