-
-
Save jmettraux/6617646 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
require 'rufus-json/automatic' | |
require 'ruote' | |
require 'ruote/storage/fs_storage' | |
require 'pp' | |
abort("Usage: ack.rb <wfid>") if ARGV[0].nil? | |
wfid = ARGV[0] | |
ruote = Ruote::Dashboard.new(Ruote::FsStorage.new("/tmp/ruote_storage")) | |
sp = ruote.register_participant '.+', Ruote::StorageParticipant | |
wis = sp.by_wfid(wfid) | |
puts "found: #{wis.size}" | |
wis.each do | wi | | |
pp wi | |
wi.set_field('acknowledged', true) | |
sp.update(wi) | |
sp.proceed(wi) | |
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
require 'rufus-json/automatic' | |
require 'ruote' | |
require 'ruote/storage/fs_storage' | |
@ruote = Ruote::Dashboard.new(Ruote::Worker.new(Ruote::FsStorage.new("/tmp/ruote_storage"))) | |
class Alpha < ::Ruote::Participant | |
def on_workitem | |
puts "Alpha" | |
reply | |
end | |
end | |
class Bravo < ::Ruote::Participant | |
def on_workitem | |
puts "Bravo" | |
reply | |
end | |
end | |
class WaitForAck < ::Ruote::Participant | |
def on_workitem | |
if workitem.fields["acknowledged"] == true | |
puts "acknowledged" | |
else | |
puts "no ack from admin" | |
end | |
sleep 5 | |
reply | |
end | |
end | |
@ruote.register 'alpha', Alpha | |
@ruote.register 'bravo', Bravo | |
@ruote.register 'wait_for_admin_ack', WaitForAck | |
@ruote.register_participant '.+', Ruote::StorageParticipant | |
pdef = Ruote.define 'test_pdef' do | |
cursor do | |
alpha | |
repeat do | |
wait_for_admin_ack | |
_break :if => '${f:acknowledged} == true' | |
end | |
bravo | |
end | |
end | |
wfid = @ruote.launch(pdef) | |
puts "launched wfid: #{wfid}" | |
@ruote.wait_for(wfid, :timeout=>10000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment