Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View .gitignore
1 2 3 4 5 6
 
source :rubygems
 
gem 'ruote', '2.2.0'
#gem 'ruote', :git => 'git://github.com/jmettraux/ruote.git'
 
View .gitignore
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
GEM
remote: http://rubygems.org/
specs:
file-tail (1.0.8)
tins (~> 0.3)
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.2)
rufus-json (>= 1.0.1)
rufus-dollar (1.0.4)
rufus-json (1.0.1)
rufus-mnemo (1.2.2)
rufus-scheduler (2.0.16)
tzinfo (>= 0.3.23)
rufus-treechecker (1.0.8)
ruby_parser (>= 2.0.5)
ruote (2.2.0)
rufus-cloche (>= 0.1.20)
rufus-dollar (>= 1.0.4)
rufus-json (>= 0.2.5)
rufus-mnemo (>= 1.1.0)
rufus-scheduler (>= 2.0.8)
rufus-treechecker (>= 1.0.4)
sourcify (= 0.4.2)
sexp_processor (3.1.0)
sourcify (0.4.2)
file-tail (>= 1.0.5)
ruby2ruby (>= 1.2.5)
sexp_processor (>= 3.0.5)
tins (0.3.12)
tzinfo (0.3.32)
 
PLATFORMS
ruby
 
DEPENDENCIES
ruote (= 2.2.0)
View .gitignore
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
 
require 'ruote'
 
$engine = Ruote::Engine.new(
Ruote::Worker.new(
Ruote::HashStorage.new))
 
# When I complete alpha with field "processed" set to "yes", the concurrence
# ends. I expect to see my second echo for field "processed" to be "yes", but
# it prints "no", therefore zeta never comes to play.
#
# It appears that the reason the value of field "processed" does not get merged
# over correctly is because I have a conditional branch (beta) and that
# condition evals as false. If I take out the beta branch (which should be
# equivalent to leaving it with false condition), OR leave it in without
# setting the :if condition, OR the :if condition evals a true value (i.e.,
# :if=>"${f:isok}= 'no'"), the value of 'processed' field printed out then is
# 'yes'.
 
pdef0 = Ruote.process_definition :name => 'mytest', :revision => '1' do
sequence do
 
#set :field => 'isok', :value => 'no'
set :field => 'isok', :value => 'yes'
 
#set :field => 'processed', :value => 'no'
 
echo '=== 0 processed: ${f:processed}'
 
concurrence :over_if => '${f:processed} == yes' do
#concurrence :over_if => '${f:processed} == yes', :merge_type => 'mix' do
alpha
beta :if => '${f:isok} == yes'
gamma
end
 
echo '=== 1 processed: ${f:processed}'
# prints 'no' even when it's set to 'yes' when completing alpha
 
zeta :if => '${f:processed} == yes'
end
end
 
pdef1 = Ruote.process_definition :name => 'mytest', :revision => '1' do
sequence do
 
set :field => 'isok', :value => 'no'
#set :field => 'isok', :value => 'yes'
 
#set :field => 'processed', :value => 'no'
 
echo '=== 0 processed: ${f:processed}'
 
concurrence :over_if => '${f:processed} == yes' do
#concurrence :over_if => '${f:processed} == yes', :merge_type => 'mix' do
alpha
beta :if => '${f:isok} == yes'
gamma
end
 
echo '=== 1 processed: ${f:processed}'
# prints 'no' even when it's set to 'yes' when completing alpha
 
zeta :if => '${f:processed} == yes'
end
end
 
pdef2 = Ruote.process_definition :name => 'mytest', :revision => '1' do
sequence do
 
set :field => 'isok', :value => 'no'
#set :field => 'isok', :value => 'yes'
 
#set :field => 'processed', :value => 'no'
 
echo '=== 0 processed: ${f:processed}'
 
#concurrence :over_if => '${f:processed} == yes' do
concurrence :over_if => '${f:processed} == yes', :merge_type => 'mix' do
alpha
beta :if => '${f:isok} == yes'
gamma
end
 
echo '=== 1 processed: ${f:processed}'
# prints 'no' even when it's set to 'yes' when completing alpha
 
zeta :if => '${f:processed} == yes'
end
end
 
pdef3 = Ruote.process_definition :name => 'mytest', :revision => '1' do
sequence do
 
#set :field => 'isok', :value => 'no'
set :field => 'isok', :value => 'yes'
 
#set :field => 'processed', :value => 'no'
 
echo '=== 0 processed: ${f:processed}'
 
#concurrence :over_if => '${f:processed} == yes' do
concurrence :over_if => '${f:processed} == yes', :merge_type => 'mix' do
alpha
beta :if => '${f:isok} == yes'
gamma
end
 
echo '=== 1 processed: ${f:processed}'
# prints 'no' even when it's set to 'yes' when completing alpha
 
zeta :if => '${f:processed} == yes'
end
end
 
$engine.register :alpha do |workitem|
p :alpha
workitem.fields['processed'] = 'yes'
end
$engine.register :beta do |workitem|
p :beta
end
$engine.register :gamma do |workitem|
sleep 0.5
p :gamma
end
$engine.register :zeta do |workitem|
p :zeta
end
 
#$engine.noisy = true
 
[ pdef0, pdef1, pdef2, pdef3 ].each do |pdef|
 
puts '-' * 80
puts Ruote::VERSION
puts
 
puts Ruote::Reader.to_ruby(pdef)
puts
 
wfid = $engine.launch(pdef)
$engine.wait_for(wfid)
puts
end
 
View .gitignore
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
--------------------------------------------------------------------------------
2.2.0
 
Ruote.process_definition :name => "mytest", :revision => "1" do
sequence do
set :field => "isok", :value => "yes"
echo "=== 0 processed: ${f:processed}"
concurrence :over_if => "${f:processed} == yes" do
alpha
beta :if => "${f:isok} == yes"
gamma
end
echo "=== 1 processed: ${f:processed}"
zeta :if => "${f:processed} == yes"
end
end
 
=== 0 processed:
:alpha
:beta
=== 1 processed: yes
:zeta
 
--------------------------------------------------------------------------------
2.2.0
 
Ruote.process_definition :name => "mytest", :revision => "1" do
sequence do
set :field => "isok", :value => "no"
echo "=== 0 processed: ${f:processed}"
concurrence :over_if => "${f:processed} == yes" do
alpha
beta :if => "${f:isok} == yes"
gamma
end
echo "=== 1 processed: ${f:processed}"
zeta :if => "${f:processed} == yes"
end
end
 
=== 0 processed:
:alpha
=== 1 processed:
 
--------------------------------------------------------------------------------
2.2.0
 
Ruote.process_definition :name => "mytest", :revision => "1" do
sequence do
set :field => "isok", :value => "no"
echo "=== 0 processed: ${f:processed}"
concurrence :over_if => "${f:processed} == yes", :merge_type => "mix" do
alpha
beta :if => "${f:isok} == yes"
gamma
end
echo "=== 1 processed: ${f:processed}"
zeta :if => "${f:processed} == yes"
end
end
 
=== 0 processed:
:gamma
:alpha
=== 1 processed: yes
:zeta
 
--------------------------------------------------------------------------------
2.2.0
 
Ruote.process_definition :name => "mytest", :revision => "1" do
sequence do
set :field => "isok", :value => "yes"
echo "=== 0 processed: ${f:processed}"
concurrence :over_if => "${f:processed} == yes", :merge_type => "mix" do
alpha
beta :if => "${f:isok} == yes"
gamma
end
echo "=== 1 processed: ${f:processed}"
zeta :if => "${f:processed} == yes"
end
end
 
=== 0 processed:
:alpha
:gamma
:beta
:gamma
:gamma
=== 1 processed: yes
:zeta
View .gitignore
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
--------------------------------------------------------------------------------
2.3.0
 
Ruote.process_definition :name => "mytest", :revision => "1" do
sequence do
set :field => "isok", :value => "yes"
echo "=== 0 processed: ${f:processed}"
concurrence :over_if => "${f:processed} == yes" do
alpha
beta :if => "${f:isok} == yes"
gamma
end
echo "=== 1 processed: ${f:processed}"
zeta :if => "${f:processed} == yes"
end
end
 
=== 0 processed:
:alpha
:beta
=== 1 processed: yes
:zeta
:gamma
 
--------------------------------------------------------------------------------
2.3.0
 
Ruote.process_definition :name => "mytest", :revision => "1" do
sequence do
set :field => "isok", :value => "no"
echo "=== 0 processed: ${f:processed}"
concurrence :over_if => "${f:processed} == yes" do
alpha
beta :if => "${f:isok} == yes"
gamma
end
echo "=== 1 processed: ${f:processed}"
zeta :if => "${f:processed} == yes"
end
end
 
=== 0 processed:
:alpha
=== 1 processed:
 
--------------------------------------------------------------------------------
2.3.0
 
Ruote.process_definition :name => "mytest", :revision => "1" do
sequence do
set :field => "isok", :value => "no"
echo "=== 0 processed: ${f:processed}"
concurrence :over_if => "${f:processed} == yes", :merge_type => "mix" do
alpha
beta :if => "${f:isok} == yes"
gamma
end
echo "=== 1 processed: ${f:processed}"
zeta :if => "${f:processed} == yes"
end
end
 
=== 0 processed:
:alpha
=== 1 processed: yes
:zeta
:gamma
 
--------------------------------------------------------------------------------
2.3.0
 
Ruote.process_definition :name => "mytest", :revision => "1" do
sequence do
set :field => "isok", :value => "yes"
echo "=== 0 processed: ${f:processed}"
concurrence :over_if => "${f:processed} == yes", :merge_type => "mix" do
alpha
beta :if => "${f:isok} == yes"
gamma
end
echo "=== 1 processed: ${f:processed}"
zeta :if => "${f:processed} == yes"
end
end
 
=== 0 processed:
:alpha
:beta
:gamma
:gamma
=== 1 processed: yes
:zeta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.