Project

kryten

0.0
No commit activity in last 3 years
No release in over 3 years
Modular task runner and job manager. Supports daemons and threads.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
>= 0
~> 10.0

Runtime

~> 1.2.0
>= 0
 Project Readme

Kryten

Kryten Series 4000 Mechanoid is a modular task runner written in Ruby. It's meant to run simple recurring tasks in the background using threads or daemons.

Installation

Add this line to your application's Gemfile:

gem 'kryten'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kryten

Usage

  require 'kryten'
  include Kryten

  # Define work to be done in a class with a run method.
  # This method will be run at an interval defined by the timer method.
  # Execution happens in the background based on the type of task included.

  class Work
    include ThreadedTask

    def run
      log "working..."
    end

  end

  # The worker can run on it's own and responds to interrupt signals.
  Work.new.start        # loop run method in foreground
  Work.new.start_worker # loop run method in a thread

  # A worker can have any number of child workers
  class WorkList
    include ThreadedTask
  end

  WorkList.new('app').workers do
    [Work.new('task1'), Work.new('task2')]
  end

  # Run the work in separate processes instead of threads
  class WorkList
    include BackgroundTask
  end

  class Work
    include BackgroundTask
  end

  WorkList.new('app').workers do
    [Work.new('task1'), Work.new('task2')]
  end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/zsoltf/kryten

License

The gem is available as open source under the terms of the MIT License.