Giter VIP home page Giter VIP logo

robinhood's Introduction

Robinhood Build Status

Robinhood is a DSL for constructing iteration-based synchronous processes (aka can't be run as jobs) in a distributed manner.

In other words: Robs responsibilities from richer processes and gives them to the poor.

It leverages celluloid actors for each process and uses Redis as a locking mechanism to ensure the process is run in a single server.

Usage

Install the gem:

$ gem install robinhood

Define Robinhood in a file:

require 'robinhood'
require 'your-app'

Robinhood.define do
  redis{ Redis.new(:host => "10.0.1.1", :port => 6380) }

  process :assigner, throttle: 10 do
    UserAssigner.process!
  end

  process :sweeper, throttle: false, timeout: 20 do
    Sweeper.sweep!
  end
end

Robinhood.run

How does it work?

Each time a process finishes its execution, the lock is released so any other server (or system process) can execute it again. This ensures it will be executed in a synchronous manner (one after the other). It also garantees the executions will be distributed across the processes (or servers) so if a server goes down, the load will be distributed evenly across the rest of them.

You can also set a timeout (in case a process hangs for some reason) and a throttling mechanism (so a process can't be re-scheduled before this time has passed).

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

robinhood's People

Contributors

josepjaume avatar juandedios-herrero-rh avatar

Watchers

Enric Lluelles avatar Oriol Blanc avatar Miguel Camba avatar Juan Jesús Fernández Madrid avatar  avatar James Cloos avatar Joan Romano avatar Mainvolume avatar Sergio Luceno avatar Kirian avatar  avatar  avatar Fernando Drumond avatar Victor Blasco avatar Ivan Magrans avatar  avatar Marc Flores avatar Rafa González avatar Giovanni Giupponi avatar Albert Pedret avatar Guillem San Nicolas avatar Adrià Ríos Cabrera avatar  avatar S avatar Oriol Garcia Vivet avatar  avatar Jordi Gómez avatar Joe Kiely avatar Dani Moreno avatar  avatar  avatar  avatar Jsedano avatar Roger Julian avatar  avatar  avatar  avatar  avatar  avatar  avatar

robinhood's Issues

Robinhood should have an executable

We should leverage the usage of the daemons gem to create a binary for robinhood that automatically loads the configuration from a Robinhood file and starts robinhood. Something like this would tentatively work:

#!/usr/bin/env ruby
require 'rubygems'
require 'daemons'
require 'fileutils'

options = {
  dir_mode: :normal,
  monitor: true,
  multiple: true,
  app_name: 'robinhood',
  log_output: true
}

Daemons.run_proc('robinhood', options) do
  require 'Robinhood'
  Robinhood.start!
end

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.