Skip to main content

Serial and parallel looping

TLDR;

Opctl supports using serialLoop and/or parallelLoop statements to make parts of your op run in a loop.

Example

  1. Start this op:
    name: serialAndParallelLooping
    run:
    serial:
    - parallelLoop:
    range: [1,2,3]
    vars:
    index: $(index)
    value: $(value)
    run:
    container:
    cmd: [echo, "parallelLoop| index: $(index), value: $(value)"]
    image: { ref: alpine }
    - serialLoop:
    range: [1,2,3]
    vars:
    index: $(index)
    value: $(value)
    run:
    container:
    cmd: [echo, "serialLoop| index: $(index), value: $(value)"]
    image: { ref: alpine }
  2. Observe:
    1. for the parallelLoop statement, containers for all values in range are run in parallel (all at once without order)
    2. for the serialLoop statement, containers for all values in range are run serially (one by one in order)