Created
September 19, 2013 01:16
-
-
Save jmettraux/6617970 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run with ```bundle exec ruby ack.rb``` | |
require 'rufus-json/automatic' | |
require 'ruote' | |
require 'ruote/storage/fs_storage' | |
wfid = ARGV[0] | |
abort("Usage: bundle exec #{$0} <wfid>") unless wfid | |
ruote = Ruote::FsStorage.new('/tmp/ruote_storage') | |
part = Ruote::StorageParticipant.new(ruote) | |
if wi = part.by_wfid(wfid).first | |
wi.fields['acknowledged'] = true | |
part.proceed(wi) | |
puts "acknowledged and proceeded wi #{wi.fei.sid}" | |
else | |
puts "didn't find any workitem for process #{wfid}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'yajl-ruby' | |
gem 'ruote' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GEM | |
remote: https://rubygems.org/ | |
specs: | |
blankslate (2.1.2.4) | |
file-tail (1.0.12) | |
tins (~> 0.5) | |
parslet (1.4.0) | |
blankslate (~> 2.0) | |
ruby2ruby (1.3.1) | |
ruby_parser (~> 2.0) | |
sexp_processor (~> 3.0) | |
ruby_parser (2.3.1) | |
sexp_processor (~> 3.0) | |
rufus-cloche (1.0.4) | |
rufus-json (>= 1.0.3) | |
rufus-dollar (1.0.4) | |
rufus-json (1.0.6) | |
rufus-mnemo (1.2.3) | |
rufus-scheduler (3.0.0) | |
tzinfo | |
rufus-treechecker (1.0.8) | |
ruby_parser (>= 2.0.5) | |
ruote (2.3.0.2) | |
blankslate (= 2.1.2.4) | |
parslet (= 1.4.0) | |
ruby_parser (~> 2.3) | |
rufus-cloche (>= 1.0.2) | |
rufus-dollar (>= 1.0.4) | |
rufus-json (>= 1.0.1) | |
rufus-mnemo (>= 1.2.2) | |
rufus-scheduler (>= 2.0.16) | |
rufus-treechecker (>= 1.0.8) | |
sourcify (= 0.5.0) | |
sexp_processor (3.2.0) | |
sourcify (0.5.0) | |
file-tail (>= 1.0.5) | |
ruby2ruby (>= 1.2.5) | |
ruby_parser (>= 2.0.5) | |
sexp_processor (>= 3.0.5) | |
tins (0.10.0) | |
tzinfo (1.0.1) | |
yajl-ruby (1.1.0) | |
PLATFORMS | |
ruby | |
DEPENDENCIES | |
ruote | |
yajl-ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run with ```bundle exec ruby run.rb``` | |
require 'fileutils' | |
require 'rufus-json/automatic' | |
require 'ruote' | |
require 'ruote/storage/fs_storage' | |
FileUtils.rm_f('/tmp/ruote_storage') rescue nil | |
ruote = | |
Ruote::Dashboard.new( | |
Ruote::Worker.new( | |
Ruote::FsStorage.new('/tmp/ruote_storage'))) | |
#ruote.noisy = true | |
# turn this on to see worker activity | |
class Putter < Ruote::Participant | |
def on_workitem | |
puts(workitem.participant_name) | |
$stdout.flush | |
reply | |
end | |
end | |
ruote.register 'alpha', Putter | |
ruote.register 'bravo', Putter | |
ruote.register 'admin', Ruote::StorageParticipant | |
pdef = | |
Ruote.define do | |
alpha | |
repeat do | |
admin | |
stop :if => '${f:acknowledged} == true' | |
end | |
bravo | |
end | |
wfid = ruote.launch(pdef) | |
puts "launched wfid: #{wfid}" | |
r = ruote.wait_for(wfid, :timeout => 60 * 1000) | |
puts | |
p r['action'] | |
p r['workitem']['fields'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment