On Wed, Dec 14, 2011 at 11:34:18AM -0800, Reed Law wrote:
>
> With this code the dollar notation doesn't seem to get evaluated. I
> get this as the params for the coauthor workitems:
>     "coauthor-
> [email protected]":null,"task":"complete_information","unless":""
>
> And the workitem is not skipped if I launch the process like so:
>     coauthor_emails = "[email protected],[email protected]"
>     RuoteKit.engine.launch(self.pdef, {'coauthor_emails' =>
> coauthor_emails, "[email protected]_info_present" => true})
>
> If I leave out the dollar notation in the process definition and
> use :unless => '[email protected]_info_present', the task is skipped for
> every participant.
>
> Can you make out if I'm doing anything else wrong?

Hello,

you're not doing anything wrong.

There's just a little known feature of the dollar notation:

---8<---
require 'rubygems'
require 'ruote'

engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new))

pdef = Ruote.process_definition do
  echo '${hash.foo.bar}' # => 'baz'
  echo '${nada.foo.bar}' # => ''
end

engine.noisy = true

wfid = engine.launch(
  pdef,
  'hash' => { 'foo' => { 'bar' => 'baz' } },
  'nada.foo.bar' => 'nada')

engine.wait_for(wfid)
--->8---

In your case, it thinks "[email protected]_info_present" is about something like
{ 'foo@bar' => { 'com_info_present' => '...' } }

Here is something that works (ruote 2.2.1 at least):

---8<---
require 'rubygems'
require 'ruote'

engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new))

pdef = Ruote.process_definition do

  concurrent_iterator :on => '$f:coauthors', :to_field => 'ca' do
    #
    # using "$f:x" instead of "${f:x}" so that actual array is used
    # instead of string representation of the array...

    concurrence do
      participant 'coauthor-${ca.id}', :task => 'complete_information', :unless 
=> '${${ca.id}_info_present}'
      participant 'coauthor-${ca.id}', :task => 'submit_copyright'
      participant 'coauthor-${ca.id}', :task => 'submit_disclosure'
    end
  end
end

class CoAuthor
  include Ruote::LocalParticipant

  def consume(wi)
    puts [
      wi.fei.expid, wi.participant_name,
      wi.params['task'], wi.fields['ca']['email']
    ].join(' ')
    reply_to_engine(wi)
  end
end

engine.register do
  participant 'coauthor-.+', CoAuthor
end

#engine.noisy = true

wfid = engine.launch(
  pdef,
  'coauthors' => [
    { 'id' => 'bar', 'email' => '[email protected]' },
    { 'id' => 'baz', 'email' => '[email protected]' }
  ],
  'bar_info_present' => true)

engine.wait_for(wfid)
--->8---


Sorry for the confusion, best regards,

--
John Mettraux - http://lambda.io/processi

-- 
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

Reply via email to