[ruote:2242] Example Ruote/Rails app update, plus AMQP question

11 views
Skip to first unread message

threetee

unread,
May 7, 2010, 8:35:43 AM5/7/10
to ruote
First of all, as John mentioned in http://groups.google.com/group/openwferu-users/msg/f3029ef07c2825cd,
I'm building an example Rails app in which I am implementing a sample
workflow, diagrammed at http://wiki.github.com/threetee/ruote-rails-example/activity-diagram.
I am making good progress (with lots of help from John and Kenneth in
IRC and on the ruote and daemon-kit lists, and all of the human
participants in the workflow are now functioning properly. The example
app is available at http://github.com/threetee/ruote-rails-example.
See the Usage section of the project's README for instructions on how
to test it out.

So as I mentioned above, although the human participants in my process
are working perfectly, the AMQP participants are not. I have added the
participants to config/initializers/ruote_kit.rb, and have
incorporated them into the pdef in app/models/email.rb. However, once
the process reaches the AMQP participants, I get this error:

#<RuntimeError: unknown expression 'kitty'>

Full trace is below. Any thoughts on why this is happening? Maybe I'm
not registering my AMQP participants properly?

----------
$ cat work_development/errors/go/err_0_0_5_0\!\!20100507-
bodafugigo.json
{"msg":{"_rev":0,"variables":null,"put_at":"2010-05-07 11:45:49.836878
UTC","workitem":{"put_at":"2010-05-07 11:45:38.880416
UTC","wfid":"20100507-
bodafugigo","participant_name":"approver","_id":"wi!0_0_3!!20100507-
bodafugigo","fields":
{"address":"te...@test.com","forms_not_ok":false,"object_id":
11,"object_type":"email"},"type":"workitems","fei":
{"sub_wfid":null,"wfid":"20100507-
bodafugigo","engine_id":"engine","expid":"0_0_5_0"}},"action":"apply","_id":"13252!
2148237740!2010-05-07!1273232749.836819!024","type":"msgs","parent_id":
{"sub_wfid":null,"wfid":"20100507-
bodafugigo","engine_id":"engine","expid":"0_0_5"},"fei":
{"sub_wfid":null,"wfid":"20100507-
bodafugigo","engine_id":"engine","expid":"0_0_5_0"},"tree":["kitty",
{"command":"/sample/quote"},[]]},"_rev":0,"put_at":"2010-05-07
11:45:49.858716 UTC","_id":"err_0_0_5_0!!20100507-
bodafugigo","type":"errors","trace":"/Library/Ruby/Gems/1.8/gems/
ruote-2.1.10/lib/ruote/worker.rb:353:in
`raise_unknown_expression_error'
/Library/Ruby/Gems/1.8/gems/ruote-2.1.10/lib/ruote/worker.rb:337:in
`launch'
/Library/Ruby/Gems/1.8/gems/ruote-2.1.10/lib/ruote/worker.rb:236:in
`process'
/Library/Ruby/Gems/1.8/gems/ruote-2.1.10/lib/ruote/worker.rb:181:in
`step'
/Library/Ruby/Gems/1.8/gems/ruote-2.1.10/lib/ruote/worker.rb:68:in
`run'
/Users/edennis/Code/testing/ruote-rails-example/vendor/gems/ruote-
kit-2.1.7/lib/ruote-kit.rb:78:in `run_worker!'
/Users/edennis/Code/testing/ruote-rails-example/lib/tasks/
ruote_kit.rake:4
/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","message":"#<RuntimeError: unknown expression
'kitty'>","fei":{"sub_wfid":null,"wfid":"20100507-
bodafugigo","engine_id":"engine","expid":"0_0_5_0"}}
----------

Thanks in advance for any assistance.

--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to openwfe...@googlegroups.com
to unsubscribe : send email to openwferu-use...@googlegroups.com
more options : http://groups.google.com/group/openwferu-users?hl=en

John Mettraux

unread,
May 7, 2010, 8:49:41 AM5/7/10
to openwfe...@googlegroups.com, kenneth...@gmail.com

On Fri, May 07, 2010 at 05:35:43AM -0700, threetee wrote:
>
> #<RuntimeError: unknown expression 'kitty'>
>
> Full trace is below. Any thoughts on why this is happening? Maybe I'm
> not registering my AMQP participants properly?

Hello ThreeTee,

thanks for sharing your explorations ! Much appreciated.

The issue is related to ruote 2.1 and its potentially decoupled workers.

You are starting a separated worker, but are registering "stateful" participants.

Looking at :

http://github.com/threetee/ruote-rails-example/blob/master/config/initializers/ruote_kit.rb

---8<---
config.register do

#
# "stateless" participants, usable by any worker

participant :requestor, Ruote::StorageParticipant
participant :reviewer, Ruote::StorageParticipant
participant :approver, Ruote::StorageParticipant

#
# "stateful" (instantiated) participants, only accessible to the worker
# inside the engine where they are registered...

amqp = RuoteAMQP::Participant.new(:default_queue => 'work1')
amqp.map_participant('ashley', 'ingress_work1')
amqp.map_participant('kitty', 'ingress_work1')
amqp.map_participant('copper', 'mailbox_work1')

participant :ashley, amqp
participant :kitty, amqp
participant :copper, amqp

catchall
end
end
--->8---

Since you're not starting a worker inside of the engine where you register your "stateful" participants, they are not reachable.

It's vital for ruote-amqp 2.1 to support "stateless" (instantiate each time) operations.

Beanstalkd example :

http://github.com/jmettraux/ruote-beanstalk/blob/ruote2.1/lib/ruote/beanstalk/participant.rb

Ruote-amqp is still in the ruote 0.9.x mindset where there was a unique worker.

If Kenneth has no time to upgrade the ruote-amqp participant, I can help.


Best regards,

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

threetee

unread,
May 7, 2010, 2:09:02 PM5/7/10
to ruote
Hi John,

Thank you for the detailed explanation.

Kenneth and John, please let me know if you need any further
information from me on this. I would love to volunteer to help update
ruote-amqp, but I'm not sure I'm familiar enough with ruote yet to do
so. :)

On May 7, 5:49 am, John Mettraux <jmettr...@openwfe.org> wrote:
> On Fri, May 07, 2010 at 05:35:43AM -0700, threetee wrote:
>
> > #<RuntimeError: unknown expression 'kitty'>
>
> > Full trace is below. Any thoughts on why this is happening? Maybe I'm
> > not registering my AMQP participants properly?
>
> Hello ThreeTee,
>
> thanks for sharing your explorations ! Much appreciated.
>
> The issue is related to ruote 2.1 and its potentially decoupled workers.
>
> You are starting a separated worker, but are registering "stateful" participants.
>
> Looking at :
>
>  http://github.com/threetee/ruote-rails-example/blob/master/config/ini...
>
> ---8<---
>   config.register do
>
>     #
>     # "stateless" participants, usable by any worker
>
>     participant :requestor, Ruote::StorageParticipant
>     participant :reviewer, Ruote::StorageParticipant
>     participant :approver, Ruote::StorageParticipant
>
>     #
>     # "stateful" (instantiated) participants, only accessible to the worker
>     # inside the engine where they are registered...
>
>     amqp = RuoteAMQP::Participant.new(:default_queue => 'work1')
>     amqp.map_participant('ashley', 'ingress_work1')
>     amqp.map_participant('kitty', 'ingress_work1')
>     amqp.map_participant('copper', 'mailbox_work1')
>
>     participant :ashley, amqp
>     participant :kitty, amqp
>     participant :copper, amqp
>
>     catchall
>   end
> end
> --->8---
>
> Since you're not starting a worker inside of the engine where you register your "stateful" participants, they are not reachable.
>
> It's vital for ruote-amqp 2.1 to support "stateless" (instantiate each time) operations.
>
> Beanstalkd example :
>
>  http://github.com/jmettraux/ruote-beanstalk/blob/ruote2.1/lib/ruote/b...
>
> Ruote-amqp is still in the ruote 0.9.x mindset where there was a unique worker.
>
> If Kenneth has no time to upgrade the ruote-amqp participant, I can help.
>
> Best regards,
>
> --
> John Mettraux -http://jmettraux.wordpress.com

John Mettraux

unread,
May 8, 2010, 12:11:32 AM5/8/10
to openwfe...@googlegroups.com

On Fri, May 07, 2010 at 11:09:02AM -0700, threetee wrote:
>
> Thank you for the detailed explanation.
>
> Kenneth and John, please let me know if you need any further
> information from me on this. I would love to volunteer to help update
> ruote-amqp, but I'm not sure I'm familiar enough with ruote yet to do
> so. :)

Hello,

if you have time to fork ruote-amqp and to work toward a working version please do so. If not, please let me know and I will try (with you as QA).


Cheers,

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

threetee

unread,
May 10, 2010, 3:34:05 AM5/10/10
to ruote
Actually, looks like this was a case of me Doing It Wrong, as the
ruote-amqp participant already does support stateless operations.
Here's the updated code that made things work for me:

------ snipped from config/initializers/ruote_kit.rb -------
participant :ashley, RuoteAMQP::Participant
participant :kitty, RuoteAMQP::Participant
participant :copper, RuoteAMQP::Participant

RuoteAMQP::WorkitemListener.new( RuoteKit.engine )
------------------------------------------------------------

------ snipped from app/models/email.rb ------
PDEF_CREATE_EMAIL = Ruote.process_definition :name => 'create_email'
do
cursor do
requestor_notification :email_subject => "Additional Information
Required"
concurrence do
requestor :task => 'upload_account_application_form'
requestor :task => 'upload_nda'
end
reviewer :task => 'review_forms'
rewind :if => '${forms_not_ok}'
approver :task => 'approve_email_account'
cancel_process :if => '${account_denied}'
concurrence do
kitty :command => '/sample/quote', :queue => 'ingress_work1'
ashley :command => '/sample/quote', :queue => 'ingress_work1'
end
copper :command => '/sample/quote', :queue => 'mailbox_work1'
end
end
-----------------------------------------------

With these tweaks, I am able to make calls to remote AMQP participants
from my example Rails app. I'll update github soon.

On May 7, 9:11 pm, John Mettraux <jmettr...@openwfe.org> wrote:
> On Fri, May 07, 2010 at 11:09:02AM -0700, threetee wrote:
>
> > Thank you for the detailed explanation.
>
> > Kenneth and John, please let me know if you need any further
> > information from me on this. I would love to volunteer to help update
> > ruote-amqp, but I'm not sure I'm familiar enough with ruote yet to do
> > so. :)
>
> Hello,
>
> if you have time to fork ruote-amqp and to work toward a working version please do so. If not, please let me know and I will try (with you as QA).
>
> Cheers,
>
> --
> John Mettraux -http://jmettraux.wordpress.com
Reply all
Reply to author
Forward
0 new messages