Building a DAG for Cloud Composer
Cloud Composer is Google Cloud's managed Apache Airflow service, and DAGs are Python files that define workflows as tasks with dependencies, which you upload to Composer's environment to schedule and orchestrate data pipelines. Understanding DAG authoring, scheduling, and GCS-based deployment is essential for automating ETL/ELT workloads on Google Cloud.
1 · Learn the must-know
- DAGs are deployed by uploading Python files to the /dags folder in the Cloud Composer environment's associated Cloud Storage bucket, and Airflow automatically picks them up.
- Composer provides Google Cloud-specific operators and hooks (e.g., for BigQuery, Dataproc, Dataflow, GCS, Pub/Sub) via the apache-airflow-providers-google package, reducing the need for custom code to interact with GCP services.
- Task dependencies are set using bitshift operators (>> and <<) or
set_upstream/set_downstreammethods, and DAG structure determines execution order, retries, and parallelism. - Use Airflow Variables and Connections (stored encrypted in the environment's metadata database) to parameterize DAGs instead of hardcoding credentials or environment-specific values, and prefer Secret Manager backend integration for sensitive data.
- The
schedule_interval(or newer schedule parameter) combined with the DAG'sstart_dateand catchup setting determines whether past runs are backfilled; setting catchup=False avoids unintended historical DAG runs. - Sensors (e.g., for GCS object existence or BigQuery job completion) and deferrable operators help avoid worker slot exhaustion by waiting efficiently for external conditions before triggering downstream tasks.
2 · Check your understanding
A data engineer deploys a new DAG to a Cloud Composer environment. The DAG definition uses schedule_interval='@daily' and start_date set to 45 days before the deployment date. The catchup parameter is left at its default value. Immediately after deployment, Airflow begins launching dozens of DAG runs for past dates, consuming worker slots and delaying the current day's run. The engineer wants the DAG to run once per day going forward without processing the missed historical intervals. What should the engineer change?
What you have tried across GCP PDE's objectives, not a readiness score.
Designing data processing systems~22% of the exam0 of 17 tried
Ingesting and processing the data~25% of the exam0 of 11 tried
Storing the data~20% of the exam0 of 13 tried
Preparing and using data for analysis~15% of the exam0 of 11 tried
Maintaining and automating data workloads~18% of the exam0 of 15 tried
3 · Keep going
Ready for more? Take a weighted mock or try free practice questions.