Skip to content

Commit

Permalink
+ Update to procrastinate 0.3
Browse files Browse the repository at this point in the history
This eliminates the need for explicit scheduler start. Nicer.

Nice nice nicer
small improvements
snowy day
  • Loading branch information
kschiess committed Dec 27, 2010
1 parent 7beb36b commit 5bd0bf7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,7 +1,7 @@
source "http://rubygems.org"

gem 'open4', '~> 1.0.1'
gem 'procrastinate', '~> 0.2.0'
gem 'procrastinate', :git => 'git://github.com/kschiess/procrastinate.git'
gem 'text-highlight'

group :development do
Expand Down
11 changes: 8 additions & 3 deletions Gemfile.lock
@@ -1,11 +1,16 @@
GIT
remote: git://github.com/kschiess/procrastinate.git
revision: 8ffc5c28bda0f685d100cf1da47b8b5fc248ff43
specs:
procrastinate (0.3.0)
state_machine (~> 0.9.4)

GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.2)
flexmock (0.8.11)
open4 (1.0.1)
procrastinate (0.2.0)
state_machine (~> 0.9.4)
rspec (2.3.0)
rspec-core (~> 2.3.0)
rspec-expectations (~> 2.3.0)
Expand All @@ -23,6 +28,6 @@ PLATFORMS
DEPENDENCIES
flexmock
open4 (~> 1.0.1)
procrastinate (~> 0.2.0)
procrastinate!
rspec
text-highlight
4 changes: 2 additions & 2 deletions Rakefile
Expand Up @@ -32,8 +32,8 @@ spec = Gem::Specification.new do |s|
s.require_paths = ["lib"]

s.add_dependency 'open4', '~> 1.0.1'
s.add_dependency 'procrastinate', '~> 0.2.0'
s.add_dependency 'text-highlight'
s.add_dependency 'procrastinate', '~> 0.3.0'
s.add_dependency 'text-highlight' '~> 1.0.0'

s.add_development_dependency("rspec")
s.add_development_dependency("flexmock")
Expand Down
9 changes: 4 additions & 5 deletions lib/ndo/multi_command.rb
@@ -1,7 +1,9 @@

require 'procrastinate'
require 'procrastinate/implicit'

require 'ndo/results'
require 'ndo/host'
require 'procrastinate'

# A class to execute a command on a list of hosts in parallel; allows access
# to results and is thus a) multi threaded and b) Ruby 1.9.2 only.
Expand All @@ -20,15 +22,12 @@ def initialize(command, hosts)
# Runs the command on all hosts. Returns a result collection.
#
def run
scheduler = Scheduler.start(SpawnStrategy::Throttled.new(5))
proxy = scheduler.create_proxy(self)
proxy = Procrastinate.proxy(self)

Ndo::Results.new.tap { |results|
hosts.each { |host|
results.store host, proxy.run_for_host(host)
}}
ensure
scheduler.shutdown
end

def run_for_host(host)
Expand Down

0 comments on commit 5bd0bf7

Please sign in to comment.