Project

dissever

0.0
No release in over 3 years
Low commit activity in last 3 years
Simple library for multiprocessing tasks
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.1.1
~> 2.0.0
~> 10.4.0
~> 3.4.0
~> 0.35.0
 Project Readme

dissever

Gem Version Build Status Coverage Status Code Quality MIT Licensed

Simple library for multiprocessing tasks

Usage

Build an array of [name, &block] pairs and hand it to Dissever:

require 'dissever'

tasks = 1.upto(10).map { |x| ["Job #{x}", proc { Process.pid }] }
processor = Dissever.new(tasks: tasks)
result = processor.run!
# Value of result
# {"Job 1"=>24966, "Job 2"=>24967, "Job 3"=>24968, "Job 4"=>24969, "Job 5"=>24970, "Job 6"=>24971, "Job 7"=>24972, "Job 8"=>24973, "Job 9"=>24974, "Job 10"=>24975}

You can also pass in tasks as a block. The following code is equivalent to the above:

require 'dissever'

processor = Dissever.new(tasks: tasks) do
  1.upto(10).map { |x| ["Job #{x}", proc { Process.pid }] }
end
result = processor.run!
# Value of result
# {"Job 1"=>24986, "Job 2"=>24987, "Job 3"=>24988, "Job 4"=>24989, "Job 5"=>24990, "Job 6"=>24991, "Job 7"=>24992, "Job 8"=>24993, "Job 9"=>24994, "Job 10"=>24995}

If you don't want it to print the progress bar, you can call Dissever.new(quiet: true).

It defaults to running with a pool of 10 processes. You can tune this with the size parameter (Dissever.new(size: 20)).

Installation

gem install dissever

License

dissever is released under the MIT License. See the bundled LICENSE file for details.