Skip to content

Argo Workflows DAGs: CAPA practice questions

A dag template describes work as tasks and the dependencies between them, rather than as a fixed list of stages. Each task names the template it runs and, optionally, the tasks it depends on.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Argo Workflows DAGs covers in CAPA

A dag template describes work as tasks and the dependencies between them, rather than as a fixed list of stages. Each task names the template it runs and, optionally, the tasks it depends on. Tasks without dependencies start as soon as the DAG starts, and every other task starts once the tasks it depends on have finished, so independent branches run in parallel without any extra configuration. Steps can express the same work as a list of lists, where the outer list runs in sequence and each inner list runs in parallel, but a DAG is usually simpler when the shape is a diamond or a wide fan-out.

Dependencies can be written in two ways. The dependencies field lists task names. The depends field takes an expression over task results, such as A.Succeeded, B.Failed, C.Errored, D.Skipped or E.Omitted, combined with &&, || and !. A bare task name inside depends means that the task Succeeded, was Skipped or is Daemoned. depends therefore lets a task run only when another one failed, for example to send a notification, which plain dependencies cannot express. The documentation does not allow both fields in the same task group.

Data moves between tasks with the tasks prefix: {{tasks.generate.outputs.result}} reads the standard output of a script task, and {{tasks.generate.outputs.parameters.name}} or the artifacts equivalent reads a declared output. A when expression on a task skips it unless the condition is true, and a skipped task counts as resolved for the default depends meaning. Tasks can loop with withItems, withParam or withSequence, which expand one task into several parallel copies.

Failure handling is the part that most often surprises people. By default a DAG fails fast: once one task fails, the controller schedules no new tasks, lets the running ones finish and then marks the DAG as failed. Setting failFast to false on the dag template lets every branch run to completion before the result is reported. A target field can also limit a run to a named task and the tasks it needs, which is useful for testing one branch of a large graph.

Key points

  • Tasks with no dependencies start immediately; the others wait for the tasks they depend on.
  • depends accepts results such as A.Failed and the operators &&, || and !.
  • A bare name in depends means Succeeded, Skipped or Daemoned.
  • DAGs fail fast by default; failFast: false lets the other branches finish.

Three sample questions

11 CAPA questions on Argo Workflows DAGs, 11 with explanations. How practice works

Question 1

Which of the following YAML defines a valid DAG task dependency?
dag:
  tasks:
  - name: A
    template: process
  - name: B
    dependencies: [A]
    template: analyze
  1. A.The syntax is incorrect
  2. B.The syntax is correct and B will run after A
  3. C.The syntax is correct but missing required fields
  4. D.Dependencies should use "depends" instead of "dependencies"

Correct answer: B

A DAG task lists the tasks it waits for in its dependencies array, so task B with dependencies: [A] starts only after A has finished. The documented diamond example uses exactly this shape, with name, template and dependencies per task. Why the other options are wrong. "The syntax is incorrect": the snippet matches the documented dag.tasks form, so there is no syntax error. "The syntax is correct but missing required fields": each task already carries name and template, the same fields the documented example uses; nothing else is required here. "Dependencies should use "depends" instead of "dependencies"": depends is a separate field for conditional logic such as A.Succeeded; dependencies remains valid, and the docs say both cannot be used in the same task group.

Sources: Argo Workflows docs: DAG, Argo Workflows docs: Enhanced Depends Logic

Question 2

Which Workflow template type allows you to define parallel execution with dependencies?
  1. A.Steps
  2. B.Container
  3. C.DAG
  4. D.Suspend

Correct answer: C

A DAG template lists tasks and gives each one a dependencies list, so a task starts as soon as the tasks it depends on have finished while independent tasks run in parallel; the docs describe this as allowing maximum parallelism. Why the other options are wrong. "Steps": a steps template is an ordered list of step groups where only the entries inside one group run together, and there is no per-task dependency graph. "Container": a container template only describes the work of a single container and does not orchestrate other tasks. "Suspend": a suspend template pauses execution for a duration or until it is resumed, it does not schedule tasks.

Sources: Argo Workflows docs: DAG, Argo Workflows docs: Steps, Argo Workflows docs: Core Concepts

Question 3

A task in a DAG template fails and failFast is left at its default. What happens next?
  1. A.Tasks that depend on it are skipped, but every independent task that has not started yet still starts
  2. B.No new tasks are scheduled; tasks already running finish, then the DAG is marked failed
  3. C.The whole workflow is terminated at once, including tasks that are still running
  4. D.The failed task is retried automatically three times before the DAG continues

Correct answer: B

DAGs fail fast by default: when one task fails, the controller stops scheduling new tasks, waits for the running ones to complete, and then marks the DAG as failed. Why the other options are wrong. "Tasks that depend on it are skipped, but every independent task ... still starts": that is the behaviour with failFast: false, where all branches run to completion. "The whole workflow is terminated at once ...": running tasks are allowed to finish. "The failed task is retried automatically three times ...": retries happen only when a retryStrategy is set.

Sources: Argo Workflows docs: DAG, Argo Workflows docs: Field Reference

Practice this topic

Focus mode keeps every question on Argo Workflows DAGs until you leave it. 10 free guest answers, then a free account; no credit card.

Or open CAPA practice across all topics.

Sources

The explanation above was checked against these official documents.