Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
rvm use 1.8.7-p334
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
source :rubygems
gem 'ruote', '2.2.0'
#gem 'ruote', :git => 'git://github.com/jmettraux/ruote.git'
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)
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
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.