I create participants like this:
$engine =
Ruote::Engine.new(Ruote::Worker.new(Ruote::FsStorage.new('work')))
$engine.register_participant :alpha do |workitem|
workitem.fields['message'] = { 'text' => 'hello !', 'author' =>
'Alice' }
end
and create processes like this:
$engine.variables['sync_process'] = Ruote.process_definition :name =>
'sync_process' do
define :sync_http do
sequence do
alpha
end
end
end
and execute:
wfid = $engine.launch($engine.variables[process], options)
puts "done: #{wfid}"
outcome = $engine.wait_for(wfid)
With JRuby I'm getting the following errors in the work directory, I
tried looking for other logs that might tell me more but this was all
I found.
{"type":"errors","_id":"err_0_8_0_2!187994958!20100209-
bomamugodu","message":"#\u003CArgumentError: wrong # of arguments(0
for 1)\u003E","trace":"/Users/francisco/realtravel/rtsite/
realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/ruote/exp/
fe_participant.rb:204:in `schedule_timeout'\n/Users/francisco/
realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/
ruote/exp/fe_participant.rb:145:in `apply'\n/Users/francisco/
realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/
ruote/exp/flowexpression.rb:197:in `do_apply'\n/Users/francisco/
realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/
ruote/worker.rb:329:in `launch'\n/Users/francisco/realtravel/rtsite/
realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/ruote/worker.rb:
227:in `process'\n/Users/francisco/realtravel/rtsite/realtravel.com/
gems/jruby/1.8/gems/ruote-2.1.5/lib/ruote/worker.rb:172:in `step'\n/
Users/francisco/realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/
ruote-2.1.5/lib/ruote/worker.rb:65:in `run'\n/Users/francisco/
realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/
ruote/worker.rb:76:in `run_in_thread'\n/Users/francisco/realtravel/
rtsite/realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/ruote/
worker.rb:76:in `initialize'\n/Users/francisco/realtravel/rtsite/
realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/ruote/worker.rb:
76:in `new'\n/Users/francisco/realtravel/rtsite/realtravel.com/gems/
jruby/1.8/gems/ruote-2.1.5/lib/ruote/worker.rb:76:in `run_in_thread'\n/
Users/francisco/realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/
ruote-2.1.5/lib/ruote/engine.rb:58:in `initialize'\n/Users/francisco/
realtravel/rtsite/realtravel.com/lib/ruote/participants.rb:13:in
`new'\n/Users/francisco/realtravel/rtsite/realtravel.com/lib/ruote/
participants.rb:13\n/Users/francisco/realtravel/rtsite/realtravel.com/
lib/ruote/participants.rb:31:in `require'\n/Users/francisco/
Applications/jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require'\n/Users/francisco/realtravel/rtsite/realtravel.com/
gems/jruby/1.8/gems/activesupport-2.3.5/lib/active_support/
dependencies.rb:156:in `require'\n/Users/francisco/realtravel/rtsite/
realtravel.com/gems/jruby/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:521:in `new_constants_in'\n/Users/
francisco/realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/
activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
`require'\n/Users/francisco/realtravel/rtsite/realtravel.com/lib/tasks/
ruote.rake:23\n/Users/francisco/Applications/jruby-1.4.0/lib/ruby/gems/
1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'\n/Users/francisco/
Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:
636:in `execute'\n/Users/francisco/Applications/jruby-1.4.0/lib/ruby/
gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'\n/Users/francisco/
Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:
631:in `execute'\n/Users/francisco/Applications/jruby-1.4.0/lib/ruby/
gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'\n/
Users/francisco/Applications/jruby/lib/ruby/1.8/monitor.rb:242:in
`mon_synchronize'\n/Users/francisco/Applications/jruby-1.4.0/lib/ruby/
gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'\n/
Users/francisco/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/
rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'\n/Users/francisco/
Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:
604:in `each'\n/Users/francisco/Applications/jruby-1.4.0/lib/ruby/gems/
1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'\n/Users/
francisco/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/
lib/rake.rb:596:in `invoke_with_call_chain'\n/Users/francisco/
Applications/jruby/lib/ruby/1.8/monitor.rb:242:in `mon_synchronize'\n/
Users/francisco/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/
rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'\n/Users/
francisco/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/
lib/rake.rb:583:in `invoke'\n/Users/francisco/Applications/jruby-1.4.0/
lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'\n/
Users/francisco/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/
rake-0.8.7/lib/rake.rb:2029:in `top_level'\n/Users/francisco/
Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:
2029:in `each'\n/Users/francisco/Applications/jruby-1.4.0/lib/ruby/
gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'\n/Users/
francisco/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/
lib/rake.rb:2068:in `standard_exception_handling'\n/Users/francisco/
Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:
2023:in `top_level'\n/Users/francisco/Applications/jruby-1.4.0/lib/
ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'\n/Users/
francisco/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/
lib/rake.rb:2068:in `standard_exception_handling'\n/Users/francisco/
Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:
1998:in `run'\n/Users/francisco/Applications/jruby-1.4.0/lib/ruby/gems/
1.8/gems/rake-0.8.7/bin/rake:31\n/Users/francisco/Applications/
jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:19:in `load'\n/
Users/francisco/Applications/jruby/bin/rake:19","fei":
{"engine_id":"engine","wfid":"20100209-
bomamugodu","sub_wfid":"187994958","expid":"0_8_0_2"},"msg":{"fei":
{"engine_id":"engine","wfid":"20100209-
bomamugodu","sub_wfid":"187994958","expid":"0_8_0_2"},"tree":
["exalead_instance",{"ref":"exalead_instance"},[]],"parent_id":
{"engine_id":"engine","wfid":"20100209-
bomamugodu","sub_wfid":"187994958","expid":"0_8_0"},"variables":null,"workitem":
{"fields":
{"restore":"production","rsync":"true","remote_profile":"production","remote_branch":"trunk","restore_indexes":"reviews-12000","console":"true","sync_direction":"down","archive_tmp":"","archive":"production","sync_indexes":"reviews-12000","remote":"vegas","env":"trunk","user":"rt.remote.vegas.user","dir":"/
repository/data/archive/production/
production","index":"reviews-12000","instance":"reviews-12000"},"fei":
{"engine_id":"engine","wfid":"20100209-
bomamugodu","sub_wfid":"187994958","expid":"0_8_0_2"}},"type":"msgs","_id":"26802-988-1265707440.466000","action":"apply","put_at":"2010-02-09
09:24:00.466000 UTC","_rev":0},"put_at":"2010-02-09 09:24:00.512000
UTC","_rev":0}
Hello Franciso,
maybe this is better :
---8<---
require 'rubygems'
require 'ruote'
require 'ruote/storage/fs_storage'
$engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::FsStorage.new('work')))
$engine.register_participant :alpha do |workitem|
workitem.fields['message'] = { 'text' => 'hello !', 'author' => 'Alice' }
end
pdef = Ruote.process_definition :name => 'sync_process' do
alpha
end
wfid = $engine.launch(pdef)
p $engine.wait_for(wfid)
--->8---
and it works.
Trying with your version now. Stay tuned.
--
John Mettraux - http://jmettraux.wordpress.com
Hello again Francisco,
your version :
---8<---
require 'rubygems'
require 'ruote'
require 'ruote/storage/fs_storage'
$engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::FsStorage.new('work')))
$engine.register_participant :alpha do |workitem|
workitem.fields['message'] = { 'text' => 'hello !', 'author' => 'Alice' }
end
$engine.variables['sync_process'] = Ruote.process_definition :name =>
'sync_process' do
define :sync_http do
sequence do
alpha
end
end
end
wfid = $engine.launch($engine.variables[process], options)
puts "done: #{wfid}"
outcome = $engine.wait_for(wfid)
p outcome
--->8---
gives me :
---8<---
kiko.rb:19: undefined local variable or method `process' for
main:Object (NameError)
--->8---
If I replace process with "sync_process" and options with {} :
---8<---
wfid = $engine.launch($engine.variables['sync_process'], {})
--->8---
It's successful :
---8<---
done: 20100209-bematayuyu
{"wfid"=>"20100209-bematayuyu", "fei"=>{"engine_id"=>"engine",
"wfid"=>"20100209-bematayuyu", "sub_wfid"=>nil, "expid"=>"0"},
"workitem"=>{"fields"=>{}, "fei"=>{"engine_id"=>"engine",
"wfid"=>"20100209-bematayuyu", "sub_wfid"=>nil, "expid"=>"0_0"}},
"type"=>"msgs", "_id"=>"27993-30-1265719104.178000",
"action"=>"terminated", "put_at"=>"2010-02-09 12:38:24.178000 UTC",
"_rev"=>0}
--->8---
(note that you never call the participant alpha with your code).
OK... Let's have a look at your error message :
---8<---
"#\u003CArgumentError: wrong # of arguments(0 for 1)\u003E",
"trace":
"/Users/francisco/realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/ruote/exp/fe_participant.rb:204:in
`schedule_timeout'
/Users/francisco/realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/ruote/exp/fe_participant.rb:145:in
`apply'
/Users/francisco/realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/ruote/exp/flowexpression.rb:197:in
`do_apply'
/Users/francisco/realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/ruote/worker.rb:329:in
`launch'
/Users/francisco/realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/ruote/worker.rb:227:in
`process'
/Users/francisco/realtravel/rtsite/realtravel.com/gems/jruby/1.8/gems/ruote-2.1.5/lib/ruote/worker.rb:172:in
`step'
--->8---
The errors occurs when the participant alpha is invoked... Since your
participant works
(http://groups.google.com/group/openwferu-users/msg/50d550d215d4554d),
I have to admit I don't know what is wrong with your environment...
Maybe you should clean up your jruby dev environment or try in a new
fresh one...
Sorry not to be more helpful, best regards,