process pattern question, getting field values to subprocesses

26 views
Skip to first unread message

Lukas Loesche

unread,
May 2, 2013, 9:26:18 AM5/2/13
to openwfe...@googlegroups.com
Hi,

I have a question that's somewhat technical but also workflow pattern related.

I defined a software deployment process called "deploy_package"

I can start it using:
wfid = engine.ruote.launch(deploy_package,
  'artifact_id' =>  'foo',
  'version' => '4.2.9-SNAPSHOT'
  )

This will deploy a single software package of a certain version onto a number of servers.

Now I'd like to define more specific processes like "deploy_entire_frontend", which should in turn call deploy_package for a number of packages.

I figured I could do something like
deploy_entire_frontend = %q{
  set artifact_id: foo
  set version: 4.2.9-SNAPSHOT
  deploy_package
  set artifact_id: bar
  set version: 3.1.10
  deploy_package
}

But even though it works, this feels very wrong. Esp. since I have more like 10 workitem fields that deploy_package is working with and not just two like in this example and I'd like to keep the process definition free of field values.

What would be a proper way to do this?

John Mettraux

unread,
May 2, 2013, 8:09:40 PM5/2/13
to openwfe...@googlegroups.com

On Thu, May 02, 2013 at 06:26:18AM -0700, Lukas Loesche wrote:
>
> (...)
>
> I figured I could do something like
> deploy_entire_frontend = %q{
> set artifact_id: foo
> set version: 4.2.9-SNAPSHOT
> deploy_package
> set artifact_id: bar
> set version: 3.1.10
> deploy_package
> }
>
> But even though it works, this feels very wrong. Esp. since I have more
> like 10 workitem fields that deploy_package is working with and not just
> two like in this example and I'd like to keep the process definition free
> of field values.
>
> What would be a proper way to do this?

Hello,

I just updated the doc at:

http://ruote.rubyforge.org/exp/subprocess.html

That information was missing (only present in tests), but you can do:

```ruby

def test_atts_to_fields

pdef = Ruote.define do
set 'address' => { 'city' => 'boston' }
subprocess(
'sub0',
'f:a' => 'fa',
'field:b' => 'mi',
'var:c' => 'sol',
'f:address.city' => 'nyc')
sub0(
'f:a' => 'fa',
'field:b' => 'mi',
'var:c' => 'sol',
'f:address.city' => 'nyc')
define 'sub0' do
echo '${a} ${b} ${v:c} ${address.city}'
end
end

wfid = @dashboard.launch(pdef)
@dashboard.wait_for(wfid)

assert_equal "fa mi sol nyc\nfa mi sol nyc", @tracer.to_s
end
```

So this should be OK:

```ruby

deploy_entire_frontend = %q{
deploy_package "f:artifact_id": foo, "f:version": 4.2.9-SNAPSHOT
deploy_package "f:artifact_id": bar, "f:version": 3.1.10
}
```

Best regards,

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

Reply all
Reply to author
Forward
0 new messages