how to register a process participant in ruote 2.0

3 views
Skip to first unread message

kiko

unread,
Nov 16, 2009, 12:07:35 AM11/16/09
to ruote
Previously with ruote-web2 I registered process participants using the
following syntax.

load 'public/defs/exec_process.rb'
load 'public/defs/restore_process.rb'

engine.register_participant(:execprocess,
OpenWFE::ProcessParticipant.new(ExecProcess))
engine.register_participant(:restoreprocess,
OpenWFE::ProcessParticipant.new(RestoreProcess))

The file would look like this:
file: public/defs/exec_process.rb
class ExecProcess < OpenWFE::ProcessDefinition
#_print "Init phase asdfasdfasdfa asdf ${f:restore_skip}"

sequence do
_if :test => "${f:phase} is not set" do
set :f => "phase", :value => "exec"
end
...


I can't find how to register process participants with ruote 2.0

John Mettraux

unread,
Nov 16, 2009, 12:15:56 AM11/16/09
to openwfe...@googlegroups.com
On Mon, Nov 16, 2009 at 2:07 PM, kiko <cisco...@gmail.com> wrote:
>
> load 'public/defs/exec_process.rb'
> load 'public/defs/restore_process.rb'
>
> engine.register_participant(:execprocess,
> OpenWFE::ProcessParticipant.new(ExecProcess))
> engine.register_participant(:restoreprocess,
> OpenWFE::ProcessParticipant.new(RestoreProcess))
>
> The file would look like this:
> file: public/defs/exec_process.rb
> class ExecProcess < OpenWFE::ProcessDefinition
>  #_print "Init phase asdfasdfasdfa asdf  ${f:restore_skip}"
>
> (...)

>
> I can't find how to register process participants with ruote 2.0

Hello,

you'd have to do it like that :

---8<---
engine.variables['execprocess'] = 'public/defs/exec_process.rb'
engine.variables['restoreprocess'] = 'public/defs/restore_process.rb'
--->8---

The value can be a URI, the path to the definition (like in the
snippet) or a ruote AST.


Best regards,

--
John Mettraux - http://jmettraux.wordpress.com

kiko

unread,
Nov 16, 2009, 4:31:27 PM11/16/09
to ruote
Sorry I still can't seem to get this to work.

I tried various things like:


$engine.variables['restoreprocess'] = Ruote.process_definition :name
=> 'restoreprocess' do
sequence do
echo "<<<<<<<<<<<<<<<<<<<<<<<<"
end
end


$engine.variables['restoreprocess'] = Ruote.define :restoreprocess do
sequence do
echo "<<<<<<<<<<<<<<<<<<<<<<<<"
end
end

or putting them in files respectively

:error:
- RuntimeError
- no subprocess named '/Users/francisco/realtravel/rtsite/
realtravel.com/vendor/plugins/ruote/examples/restoreprocess.rb' found
- - /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/exp/fe_subprocess.rb:190:in `lookup_subprocess'


$engine.variables['restoreprocess'] = "#{File.expand_path(File.dirname
(__FILE__))}/restoreprocess.rb"



I keep getting the following error, any pointers to what I'm doing
wrong?



---
- :fei: &id001 !ruby/object:Ruote::FlowExpressionId
engine_id: engine
expid: 0_0_0_3_0_0_0_2
wfid: 20091115-sonukudu_3036000
:message:
- :expressions
- :apply
- :workitem: !ruby/object:Ruote::Workitem
fei: *id001
fields:
console: "true"
log_file: init.out
timer: init_phase
restore_dbs: rtsite:db.db
remote_profile: production
restore: production
phase: init
participant_name: start_process
:parent_id: !ruby/object:Ruote::FlowExpressionId
engine_id: engine
expid: 0_0_0_3_0_0_0
wfid: 20091115-sonukudu_3036000
:tree:
- restore_process
- {}

- []

:fei: *id001
:variables:
:wfid: 20091115-sonukudu_3036000
:at: 2009-11-15 22:10:59.658963 -08:00
:parent_wfid: 20091115-sonukudu
:error:
- RuntimeError
- no subprocess named 'restoreprocess' found
- - /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/exp/fe_subprocess.rb:190:in `lookup_subprocess'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/exp/fe_subprocess.rb:160:in `apply'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/exp/flowexpression.rb:240:in `do_apply'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/pool/expression_pool.rb:244:in `apply'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/pool/expression_pool.rb:309:in `expressions_receive'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/pool/expression_pool.rb:282:in `receive'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/queue/workqueue.rb:100:in `send'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/queue/workqueue.rb:100:in `process'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/queue/workqueue.rb:100:in `each'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/queue/workqueue.rb:100:in `process'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/queue/thread_workqueue.rb:46:in `initialize'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/queue/thread_workqueue.rb:46:in `loop'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/queue/thread_workqueue.rb:46:in `initialize'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/queue/thread_workqueue.rb:45:in `new'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/queue/thread_workqueue.rb:45:in `initialize'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/engine/engine.rb:261:in `new'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/engine/engine.rb:261:in `add_service'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/engine/engine.rb:312:in `build_workqueue'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/lib/ruote/engine/engine.rb:86:in `initialize'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/examples/participants.rb:21:in `new'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/examples/participants.rb:21
- /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
- /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`require'
- /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:156:in `require'
- /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:521:in `new_constants_in'
- /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:156:in `require'
- /Users/francisco/realtravel/rtsite/realtravel.com/vendor/plugins/
ruote/examples/init_phase.rb:1
- /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
- /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`require'
- /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:156:in `require'
- /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:521:in `new_constants_in'
- /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/
active_support/dependencies.rb:156:in `require'
- /Users/francisco/realtravel/rtsite/realtravel.com/lib/tasks/
ruote.rake:64
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in
`execute'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in
`execute'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in
`invoke_with_call_chain'
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/monitor.rb:242:in `synchronize'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with_call_chain'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in
`invoke'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in
`invoke_task'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
`top_level'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
`each'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
`top_level'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
`standard_exception_handling'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in
`top_level'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
`standard_exception_handling'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
- /Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
- /usr/bin/rake:19:in `load'
- /usr/bin/rake:19
- -e:1:in `load'
- -e:1


On Nov 15, 9:15 pm, John Mettraux <jmettr...@openwfe.org> wrote:
On Nov 15, 9:15 pm, John Mettraux <jmettr...@openwfe.org> wrote:

John Mettraux

unread,
Nov 16, 2009, 7:53:02 PM11/16/09
to openwfe...@googlegroups.com
On Tue, Nov 17, 2009 at 6:31 AM, kiko <cisco...@gmail.com> wrote:
>
> Sorry I still can't seem to get this to work.
>
> I tried various things like:
>
> $engine.variables['restoreprocess'] = Ruote.process_definition :name
> => 'restoreprocess'  do
>      sequence do
>        echo "<<<<<<<<<<<<<<<<<<<<<<<<"
>      end
> end

Hello Francisco,

my bad. I fixed this :

http://github.com/jmettraux/ruote/commit/96646d184b3677f4d72f9b30812cfaa1e65c9b68

It now works :

http://github.com/jmettraux/ruote/commit/96646d184b3677f4d72f9b30812cfaa1e65c9b68#diff-1

> or putting them in files respectively
>

> $engine.variables['restoreprocess'] = "#{File.expand_path(File.dirname
> (__FILE__))}/restoreprocess.rb"

It worked for me with relative paths :

http://github.com/jmettraux/ruote/blob/master/test/functional/ft_27_var_indirection.rb#L65-76

I made sure it works with absolute path like yours (did not change my
code though, just added a test) :

http://github.com/jmettraux/ruote/commit/96646d184b3677f4d72f9b30812cfaa1e65c9b68#diff-2


Thanks for reporting that, best regards,

Reply all
Reply to author
Forward
0 new messages