Orquesta: regarding items and getting that item value in the next task by publishing


(Peter Michael Gits) #1

Couple of questions regarding iterations…

  1. trying to carry the element item to the next task: need syntax help
  2. iterating… when doing this, it should be in sequence task1 item0, task2 item0, task1 item1, task2 item2… am I missing some critical thinking here?
example below:

version: 1.0

    description: A workflow demonstrating with items.
        input:
      - members
      - my_message: "empty"


    tasks:
      task1:
        with: <% ctx(members) %>
        action: core.noop
        next:
          - when:  <% succeeded() %>
            publish:
            - my_message: <% item() %> 
            do: task2

      task2:
        action: examples.echo message="<% ctx().my_message %>, resistance is futile!"
        #action: examples.echo message="<% item() %>, resistance is futile!"

    output:
      - items: <% task(task1).result.items.select($.result.stdout) %>

Thanks,

Peter M. Gits


(Lindsay Hill) #2

If you want to kick off a sequence of tasks for each item, call a separate workflow.

Otherwise it is going to run task1 with each item, then move to task2. Task 2 has no associated items.


(Peter Michael Gits) #3

Cool. Thanks. I will give it a try. I assume that the action is the workflow that does this. That is excellent. I think this is what I was indicating when I was discussing nested workflows but didn’t know how to ask it.

Peter


(Peter Michael Gits) #4

How do I keep it serialized? when iterating it appears that each one will get kicked off individually at the same time call their individual series, but then all series are kicked off at the same time. Do I use concurrent=1 to limit this to a single thread?

Thanks in advance,

Peter


(Peter Michael Gits) #5

Yes, that was the answer. Thanks for the assist. Working like a champ. Loving it.

Cheers,

Peter