# DAG pipeline — diamond dependency graph with parallel: shorthand
# extract_a and extract_b run concurrently (no dependencies — roots)
# transform waits for both extractors to complete
# load waits for transform
#
# To debug sequentially, use group: { mode: SEQUENCE, branches: {...} } form.
# Branches will run one-at-a-time in topological order of dependencies.

flowmarkup:
  title: ETL Diamond Pipeline
  version: 1
  description: Demonstrates DAG ordering with dependencies on a parallel group.
  requires:
    SERVICES: [extractor_a, extractor_b, transformer, loader]

  vars:
    data_a:
    data_b:
    transformed:

  do:
  - log: Starting ETL pipeline

  - parallel:
      _label_: ETL diamond DAG
      timeout: 5m
      extract_a:
      - call:
          service: extractor_a
          operation: extract
          params:
            source: customers
          result:
            data_a: =RESULT.data
      extract_b:
      - call:
          service: extractor_b
          operation: extract
          params:
            source: orders
          result:
            data_b: =RESULT.data
      transform:
        dependsOn: [extract_a, extract_b]
        do:
        - call:
            service: transformer
            operation: transform
            params:
              a: =data_a
              b: =data_b
            result:
              transformed: =RESULT.output
      load:
        dependsOn: [transform]
        do:
        - call:
            service: loader
            operation: load
            params:
              data: =transformed

  - log: ETL pipeline complete
