liveBook · Manning

Directed acyclic graph

As explained in Designing Deep Learning Systems: A guide for software engineers

A directed acyclic graph is a directed graph whose edges encode dependencies and whose directed paths contain no cycles.

A directed acyclic graph (DAG) represents a workflow as tasks connected by directed dependency edges. Each task is a smallest resumable unit of computation: it performs an action such as fetching data or triggering a service, then succeeds or fails as a whole. The directed edges specify which tasks must finish before successor tasks can run; the absence of loops prevents execution from falling into a dead loop. section 9.1.1

In production machine-learning systems, DAGs provide the execution order that glues automations together. A workflow can launch training when a dataset is built, monitor and transform upstream data, deploy a model after it meets acceptance criteria, or watch performance metrics and alert developers on degradation. section 1.2.2 section 9.1.1

Figure 9.1 A DAG of a sample model training workflow with multiple steps. Both ovals and diamonds are steps, but different types. The solid arrows indicate the dependencies between steps, and the dotted-line arrows represent the external web requests sent from steps.

Read the solid arrows as dependency constraints: authorization runs first; dataset building and embedding retrieval may run in parallel afterward; downstream steps wait for both required predecessors. Dotted arrows are external requests rather than DAG dependencies. section 9.1.1

A workflow definition declares the tasks, their control flow, and each task’s action and parameters. An orchestration service stores the DAG and execution history in metadata storage, schedules active workflows, dispatches ready tasks to workers, and uses shared object storage to pass task outputs to successor tasks. Centralized metadata and artifacts let the web interface, scheduler, and workers operate independently. section 9.2.1 section 9.2.2

Training and release pipeline

A practical training DAG can be expressed as data parsing → data augmentation → dataset building → training → [online evaluation, offline evaluation] → model release. The bracketed evaluations can proceed after training, while release is held until its required evaluation conditions are satisfied. The workflow can also carry a monthly schedule and an external-event trigger; a training task may invoke a model-training service through a RESTful HTTP request. section 9.2.1

Airflow implements a DAG as Python code: define the DAG and tasks, then declare task dependencies. Tasks are operators, including predefined integrations such as MySqlOperator, SimpleHttpOperator, Docker operator, and custom Python functions through PythonOperator. Its UI and CLI can inspect DAGs, list tasks, display a dependency tree, and monitor execution. section 9.3.1

When building or evaluating DAG-based orchestration, emphasize:

  • Criticality, so important production work receives appropriate treatment. section 9.4
  • Usability and human centricity, to reduce workflow construction, testing, and debugging costs. section 9.4
  • Extensibility, task isolation, and scalability, so workflows can grow without tightly coupling execution concerns. section 9.4

How Designing Deep Learning Systems: A guide for software engineers covers it

How deep it goes
Defines tasks, directed dependencies, loop avoidance, scheduling, dispatch, shared outputs, and an Airflow implementation without graph-theory detail.
Examples
Uses an NLP training-and-release DAG, a YAML training workflow, and an Airflow data-processing definition with operators.
What it assumes
Starts by defining workflows and resumable tasks, while using Python, YAML, REST requests, and deployment scenarios in implementation examples.
What you can do after
Apply it via Airflow or an orchestration service to define task dependencies, schedules, triggers, and executable workflow steps.
How it connects
Connects workflow orchestration with task dependencies, schedulers, workers, metadata databases, object stores, Airflow, and model deployment.

Also explained in

Compare how 15 books explain directed acyclic graph →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Designing Deep Learning Systems: A guide for software engineers. The section links point to the parts of the book it draws on.