Deploying and running pipelines
Professional Data Engineer · Lesson 10 of 23 · 1:06:34
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Google Cloud Professional Data Engineer exam, on the official exam guide. In this lesson: Managed Service for Apache Airflow (formerly Cloud Composer), Workflows, CI/CD for pipelines with Cloud Build and Flex Templates, and running and updating streaming jobs. Includes three original practice questions, with Cymbal Mobility, a fictional ride-hailing and scooter company, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
A dozen pipelines
Cymbal Mobility now has a dozen pipelines: nightly loads, Spark jobs, Dataflow streams, and Dataform transformations. Some depend on others, some fail at night, and changes are copied to production by hand. The data engineer needs orchestration, and a safe path from code to production.
Managed Airflow
Managed Service for Apache Airflow, formerly Cloud Composer, runs Apache Airflow for you. A workflow is a DAG, a directed acyclic graph, written in Python: tasks, their dependencies, and a schedule. Operators start the work, like a BigQuery job, a Dataflow pipeline, or a Spark batch, and there are more than one hundred fifty for Google Cloud alone. DAGs run on a schedule, by hand, or on an event, and Airflow retries failed tasks, and can backfill past dates. It suits batch data pipelines that can accept a few seconds between tasks, wherever the work runs, even on premises or in other clouds.
Workflows
Workflows is a serverless orchestrator, written in YAML or JSON, that calls services over HTTP in the order you define. It has low latency, handles many executions, holds state, retries, and can wait for up to a year, with no charge while idle. Use it to chain services, like Cloud Run functions and other APIs, and for simple sequences in BigQuery or Cloud Storage, started by Cloud Scheduler or by an event. Choose Managed Airflow for data pipelines with many dependencies, and Workflows for light, event-driven chains of services.
CI/CD for pipelines
Pipeline code belongs in a Git repository, like any other code. Continuous integration runs tests on every change: unit tests on transforms with the Direct Runner, then integration and end-to-end tests in a preproduction environment. Cloud Build can run those tests on each pull request, deploy DAGs to a development Airflow environment, and then to production once they work. Dataflow Flex Templates package a pipeline as a Docker image, with parameters, so anyone allowed can launch it without the code or its dependencies. Dataform works the same way: SQL in a repository, with separate development and production environments.
Running streaming jobs
Streaming pipelines run for months, so changes need care. Some job options can be changed in flight, on jobs that use Streaming Engine, while new code needs a replacement job, which Dataflow checks for compatibility before it takes over the running job's state. To stop a streaming job, drain it: it stops reading new data, but finishes the data it has already buffered. Cancel stops everything at once, including buffered data, and force cancel is the last resort. And watch every job and DAG with Cloud Monitoring alerts, as lesson twenty-two explains.
Recap
Let's recap. Managed Service for Apache Airflow runs DAGs in Python, with operators, schedules, retries, and backfills, for batch data pipelines. Workflows chains services over HTTP, serverless and event-driven, for lighter orchestration. Keep pipeline code in Git, test it with the Direct Runner and in a preproduction environment, and deploy with Cloud Build. Flex Templates package Dataflow pipelines with parameters, so others can launch them. And change streaming jobs in flight or with a compatible replacement job, and drain them to stop without losing buffered data.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Every night, four steps must run in order: load files, Spark batch, Dataform transformations, report refresh. Failed steps must be retried, and the team wants Python code with clear dependencies. Which option fits?
- Workflows calling each service over HTTP
- Cloud Scheduler starting each step at a fixed time
- A cron job on a virtual machine
- A DAG in Managed Service for Apache Airflow
Show the answer
A DAG in Managed Service for Apache Airflow
A DAG in Managed Airflow expresses the four steps and their dependencies in Python, with retries. “Workflows calling each service over HTTP” is written in YAML or JSON, and is meant for lighter chains of services. “Cloud Scheduler starting each step at a fixed time” would start each step at a fixed time, even if the previous one failed. And “A cron job on a virtual machine” would leave the team running and patching a server.
Data scientists must launch the trips pipeline with their own dates and buckets, without installing Beam or seeing the code. What should the data engineer provide?
- A copy of the pipeline code for each scientist
- A Dataflow Flex Template with parameters
- A shared VM with the Beam SDK installed
- A Managed Airflow environment per scientist
Show the answer
A Dataflow Flex Template with parameters
A Flex Template packages the pipeline with its dependencies, and parameters let each run use its own dates and buckets. “A copy of the pipeline code for each scientist” would put Beam and the code on every machine. “A shared VM with the Beam SDK installed” would mean a server to maintain, with the code open to everyone. And “A Managed Airflow environment per scientist” would add whole environments, without packaging the pipeline itself.
The trips streaming pipeline must stop for a week, and no event it has already read from Pub/Sub may be lost. What should the data engineer do?
- Drain the Dataflow job
- Cancel the Dataflow job
- Force cancel the Dataflow job
- Delete the Pub/Sub subscription
Show the answer
Drain the Dataflow job
Draining stops reading new data, and finishes processing what the job has already buffered, so nothing it read is lost. “Cancel the Dataflow job” stops at once, and drops the buffered data. “Force cancel the Dataflow job” also drops it, and is meant only for a job that will not cancel. And “Delete the Pub/Sub subscription” would discard the messages waiting in the subscription.