Hi, may I ask for assistance in understanding concurrences and
participants? I am new to ruote, so, I imagine that I'm
misunderstanding how to do something simple. And, I apologize in
advance for both the length of this message and for the possibility
that I'm misunderstanding something that ought to be obvious.
Please consider the following little unit test coded against the Ruote
2.0 test/functional framework:
class EftHandoffTest < Test::Unit::TestCase
include FunctionalBase
def test_simple
pdef = Ruote.process_definition :name => 'simple' do
sequence do
concurrence :count => 1 do
participant :ref => 'accept'
participant :ref => 'reject'
end
participant :ref => 'finish'
end
end
@engine.register_participant :accept do |wi|
puts "accept\n"
loop do
puts "loop..."
end
wi.fields['accepted'] = 'true'
end
@engine.register_participant :reject do |wi|
puts "rejected\n"
wi.fields['accepted'] = 'false'
end
@engine.register_participant :finish do |wi|
puts "finished accepted:#{wi.fields['accepted']}\n"
end
wfid = @engine.launch(pdef, :fields => {:dest_user =>
"David", :orig_user => "Masha", :orig_task => "Taxes"})
sleep 4
outcome = @engine.wait_for(wfid)
end
The purpose of this test case is to see what happens if
participant :accept takes a very long time (forever, in fact). I
would have expected ruote to kick off separate threads for :accept
and :reject, and that each of those threads would reply to the parent
expression (the concurrence itself) when complete. And,
therefore, :reject would complete first and the concurrence would
pass :rejects's workitem to :finish. And, therefore, I would see this
in the output:
accept (because concurrence kicks it off)
loop...
loop...
....etc....
reject (because concurrence kicks it off)
finished accepted:false (because :reject "won" the
concurrence)
But, that isn't at all what is happening. Instead, it would seem
that :accept is applied...and it prints 'accept' and then starts
loop...ing and it never, ever stops. :reject is NEVER KICKED OFF (*).
(*) I am not quite sure about this. It may be the case that :reject
is being applied--that is, the [:expressions :apply] event may be
pushed onto the workqueue and/or pulled off. But, if so, control
never seems to get back to it.
Here's the actual result of running this test (I'm using the EM
version of an engine):
using engine of class Ruote::Engine (cache off)
FE_CONCURRENCE: apply
FE_CONCURRENCE: apply_children
accept
loop...
loop...
loop...
loop...
loop...
loop...
loop...
loop...
loop...
loop...
loop...
loop...
(...there were lots more of these, before I stopped it...)
The FE_CONCURRENCE: lines are some puts statements I stuck into
fe_concurrence to help debug the situation. I put such puts
statements at the top of every method in fe_concurrence, but we don't
seem to get to them. I suspect that a single thread is being used to
kick off :accept, and that that thread simply never returns to deal
with :reject.
Any advice/suggestions will be much appreciated.
--~--~---------~--~----~------------~-------~--~----~
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en
-~----------~----~----~----~------~----~------~--~---