Prepare and test your skills

Prepare and test your skills

A directed acyclic graph (DAG) is a Python workflow file that defines tasks and their dependencies in an order that never loops back. The Managed Service for Apache Airflow (formerly Cloud Composer) (opens in a new tab) evaluates the whole file to build the execution graph, so every dependency must move forward from start to end without cycles.
A DAG definition is the workflow container that holds all tasks and controls when the workflow can run. The definition uses with DAG(dag_id="controller_dag_to_trigger_other_dags", default_args={"owner": "airflow"}, start_date=days_ago(1), schedule_interval="@once") as dag: to bind the workflow identity, owner, start date, and schedule together. Tasks such as DummyOperator are created inside that context with a unique task_id, and the bitshift operator >> connects them. Control flows from the upstream task on the left of >> to the downstream task on the right, and the scheduler starts a downstream task only after its upstream dependencies complete.
Parallel branches and ordered progression are expressed by combining single tasks and task lists with >>. A list such as [task_1, task_2] means the workflow depends on both tasks in parallel, while start >> [task_1, task_2] means control flows from start to both task_1 and task_2 at the same time. The pattern start >> [task_1, task_2] >> some_other_task >> [task_3, task_4] >> end executes in a fixed order:
start to task_1 and task_2, which run in parallel.task_1 and task_2 to some_other_task, which runs only after both parallel tasks succeed.some_other_task to task_3 and task_4, which run in parallel.task_3 and task_4 to end, which closes the workflow.This structure preserves acyclic properties because no downstream task points back to an upstream task. Logical progression is maintained by narrowing parallel branches back to a single task before fanning out again, which prevents ambiguous ordering and skipped dependencies.
TriggerDagRunOperator is the operator that triggers a child DAG run from within a parent controller DAG. The parent task defines task_id="dag_1", trigger_dag_id="dag-to-trigger", and conf={"message": "Hello World"}, where control flows from the parent task to a new run of the child DAG and the conf dictionary flows from the parent to the triggered run as configuration. The implementation requires two separate DAG files uploaded to the same Managed Airflow environment, with the parent using schedule_interval="@once" and the sequence start >> trigger_1 >> some_other_task >> trigger_2 >> end. The child DAG defines DAG_NAME = "dag-to-trigger" with schedule_interval="None", so the child DAG does not run on its own schedule and runs only when the parent task triggers it.
Exam tip: The value of trigger_dag_id in TriggerDagRunOperator must exactly match the dag_id of the DAG to trigger, and the triggered DAG uses schedule_interval="None" so it waits for the trigger.
Implementing error handling and operational resilience means designing Airflow DAGs and their environments so failures are contained, diagnosed, and recovered without corrupting data or duplicating work. Resilience for Cloud Composer (opens in a new tab) comes from pausing faulty DAGs, checking for syntax and scheduling errors, monitoring environment health, and investigating failed runs until they succeed.
Pausing an Airflow DAG is the operational control that stops the scheduler from launching new DAG runs while a failure is investigated. An operator pauses from the Scheduling page in the Google Cloud console by either opening the name of the DAG and then clicking Pause DAG on the DAG details page, or by clicking View actions in the Actions column for that row and then clicking Pause DAG. Pausing does not fix the underlying error, but it prevents additional failed runs, downstream tasks from consuming partial data, and alert noise while troubleshooting proceeds. Only after the DAG runs successfully should the DAG be unpaused to resume its schedule.
Checking for DAG errors is the ordered verification that confirms a DAG is syntactically valid and scheduled correctly in the Managed Airflow (Gen 3) environment. The check moves from static errors to runtime behavior:
This sequence matters because a DAG that parses cleanly can still fail at runtime, and a DAG that succeeds once in Gen 3 proves that its dependencies, connections, and timing are correct in the new environment. Skipping the wait-and-verify step risks leaving a latent scheduling or compatibility error undetected.
Exam tip: If a DAG run was successful in Managed Airflow (Gen 3), do not unpause it in the legacy Gen 1 or Gen 2 environment, because unpausing creates a duplicate DAG run for the same time and date in the legacy environment.
Monitoring environment health is the ongoing observation of failed DAG runs and overall environment status after all DAGs and configuration are transferred. The Managed Airflow (Gen 3) environment is the system of record during migration, so failed runs, scheduling delays, and health signals in Gen 3 determine whether the migration is stable. The legacy Gen 1 or Gen 2 environment remains only as a safety boundary until Gen 3 runs without problems for a sufficient period of time. Only after that stable period should the legacy environment be deleted, which removes the risk of accidental duplicate execution across generations.
Investigating a failed run is the recovery workflow that moves a pipeline from a failed state back to a successful state while preserving data integrity. In the development workspace, the operator opens the Executions tab, finds the failed data pipeline run in the Status column, hovers over the failure icon, and clicks Investigate. The analysis reviews logs to identify root causes such as schema drift or data type mismatches, and then presents a suggested fix in the Ask Agent panel. The operator applies the suggested fix to the pipeline or manually updates the code, then waits for a successful rerun before considering the incident closed. This investigate-then-fix order ensures the same failure does not repeat and downstream tables are not loaded with incomplete or mismatched data.
Optimizing DAG performance means reducing wasted scheduling and execution work while keeping the Managed Airflow environment healthy. Optimization in Managed Service for Apache Airflow (formerly Cloud Composer) (opens in a new tab) comes from pausing unneeded DAGs, verifying that remaining DAGs are scheduled correctly, monitoring run health, and preventing failures caused by network and security boundaries.
Pausing a DAG is the control that stops the scheduler from creating new DAG runs for that DAG, so idle or migrating workflows do not consume scheduling attention. The Scheduling page in the Google Cloud console lists DAGs and supports optional detail columns through column display options. From that page, a DAG can be paused either by opening its name to the DAG details page and selecting Pause DAG, or by selecting View actions in the Actions row and then selecting Pause DAG. Pausing is reversible and is especially useful during migration, testing, or seasonal workloads when a DAG should remain defined but not run.
Verifying scheduling correctness is the check that prevents wasted resources from retries, blocked downstream tasks, and repeated troubleshooting. The Airflow web interface exposes syntax errors in the DAGs view before performance tuning begins. Verification in a Managed Airflow (Gen 3) environment follows an ordered sequence:
A DAG that fails or runs at the wrong time wastes resources even if the environment is sized correctly, so this verification must come before resource tuning.
Exam tip: If a DAG run was successful in Managed Airflow (Gen 3), do not unpause it in the Managed Airflow (Gen 2) environment, because a duplicate DAG run for the same time and date will happen in the Gen 2 environment.
Monitoring the Managed Airflow environment is the ongoing tracking of failed DAG runs, scheduling problems, and overall environment health after DAGs and configuration are transferred. The Scheduling page with additional DAG detail columns helps identify which DAGs are active, paused, or failing without opening each DAG individually. After transfer, the Managed Airflow (Gen 3) environment should be monitored for potential issues and failed runs over a sufficient stable period. If the Gen 3 environment runs without problems, deleting the older Managed Airflow (Gen 2) environment removes duplicate infrastructure and management overhead.
Service perimeters and network boundaries are security controls that can block DAG work when required services are not allowed. Managed Airflow (Gen 3) environments protected by VPC Service Controls block calls to Google APIs, services, and domains that are not in the required set, and blocked calls cause DAG task failures and wasted retries. The perimeter must protect the core services that Managed Airflow depends on:
composer.googleapis.com)artifactregistry.googleapis.com)compute.googleapis.com)container.googleapis.com)containerfilesystem.googleapis.com)dns.googleapis.com)iamcredentials.googleapis.com)logging.googleapis.com)monitoring.googleapis.com)pubsub.googleapis.com)sqladmin.googleapis.com)storage.googleapis.com)For any additional service used by DAGs, such as aiplatform.googleapis.com for a Vertex AI Operator, the service must first be added to restricted services and then added to VPC accessible services. Services that do not support VPC Service Controls and are not available through restricted.googleapis.com cannot be accessed from protected Gen 3 environments. If the environment uses Shared VPC or Customer-Managed Encryption Keys (CMEK), the service project containing the environment, the host project containing the Shared VPC network, and the project hosting the Cloud Key Management Service keys must sit in the same service perimeter, because perimeter misalignment can block database management operations and cause environment creation or update failures.
>> to define execution order, where control flows from the upstream task on the left to the downstream task on the right.dag_id exactly matches trigger_dag_id, and the child DAG uses schedule_interval="None" so it runs only when triggered.A directed acyclic graph defines tasks and their dependencies in forward order that never loops back, with control flowing from the upstream task on the left of the bitshift operator to the downstream task on the right. The scheduler starts a downstream task only after its upstream dependencies complete, and parallel branches use task lists so control can fan out from one task to multiple tasks and then narrow back to a single task before fanning out again.
TriggerDagRunOperator triggers a child DAG run from within a parent controller DAG and passes configuration through the conf dictionary to the triggered run. The value of trigger_dag_id must exactly match the dag_id of the DAG to trigger, and the child DAG uses schedule_interval None so it does not run on its own schedule and runs only when the parent task triggers it. The implementation requires two separate DAG files uploaded to the same Managed Airflow environment.
Pausing a DAG stops the scheduler from launching new DAG runs while preserving the DAG definition, which prevents additional failed runs and downstream tasks from consuming partial data while a failure is investigated. You pause from the Scheduling page in the Google Cloud console by either opening the name of the DAG and then selecting Pause DAG on the DAG details page or by selecting View actions in the Actions column and then selecting Pause DAG.
Managed Airflow (Gen 3) environments protected by VPC Service Controls block calls to Google APIs, services, and domains that are not in the required set, which causes DAG task failures and wasted retries. The perimeter must protect the core services that Managed Airflow depends on such as the Cloud Composer API, Compute Engine API, Kubernetes Engine API, Cloud Storage API and Cloud SQL Admin API, and any additional service used by DAGs must first be added to restricted services and then to VPC accessible services.
A data engineering team is deploying a critical daily data pipeline in Google Cloud Composer. The pipeline extracts transactional records, transforms them, and writes them to BigQuery.
The pipeline must satisfy the following operational resilience and error handling requirements:
Which configuration should you implement in the DAG definition?
Last updated