Cloud Composer in Google Cloud
A complete, friendly guide to Google Cloud's managed workflow orchestration service: how it runs Apache Airflow for you, how to design reliable pipelines, how to deploy, secure, and watch them, and how to keep the bill under control.
Think about what happens in a company every night. Fresh sales numbers arrive from the shops. A job cleans them. Another job loads them into a data warehouse. A third job builds reports, and a fourth sends a summary to the managers by morning. Each step needs the one before it to finish first. If a step fails, someone must be told, and the step should try again. If the whole chain must run again for last Tuesday, there has to be a way to do that without chaos.
For a while, teams handled this with a pile of scheduled scripts, each set to run at a guessed time, hoping the earlier ones had finished. This works until the first slow night, when a script starts before its input is ready, produces garbage, and nobody notices until the managers see wrong numbers. The real need is for a conductor: something that knows the order of the steps, starts each at the right moment, watches the results, retries the failures, and keeps a record of everything.
Cloud Composer is Google Cloud’s conductor. It runs Apache Airflow, the most popular open-source workflow tool, as a managed service, so you write the plan and Google keeps the machinery running. In this guide you will start from the basic ideas of workflows and Airflow, and then build up to environments, scheduling, security, monitoring, and cost. Every new term is explained the first time it appears, with an everyday comparison.
1What Is Cloud Composer?
Before any diagrams or details, let us get one clear picture of what this product is and what it is for.
Cloud Composer is a fully managed workflow orchestration service built on Apache Airflow. Let us unpack that sentence.
A workflow is a series of steps that must happen in a certain order to get a job done, such as “collect data, clean it, load it, report on it”. Orchestration means coordinating those steps: starting them on time, passing results along, handling failures, and keeping records. It does not mean doing the heavy work of each step yourself. Apache Airflow is a free, open-source program for writing, scheduling, and watching workflows. Fully managed means Google creates the servers, installs and upgrades Airflow, keeps it healthy, and connects it to the rest of Google Cloud, so you spend your time on workflows and not on infrastructure.
Think of the head chef in a busy restaurant kitchen. The chef does not chop every vegetable or wash every plate. The chef reads the order, tells the vegetable station to start, waits until the sauce is ready, signals the grill at the right moment, and sends the plate out only when every part is done. If the grill burns a steak, the chef orders another. Cloud Composer is that head chef for your data and cloud jobs. The stations are services like BigQuery, Dataflow, and Cloud Storage.
What Cloud Composer gives you
Dependencies
Say “run B only after A succeeds” and Airflow enforces it, including many steps running side by side when they do not depend on each other.
Scheduling
Run workflows on a calendar, such as every night at one o’clock, or when a related dataset is updated.
Retries and alerts
Failed steps can try again automatically, and people can be told when something stays broken.
A visual interface
A web page shows every workflow, every run, and every step’s status and logs, in green, red, and yellow.
Connections
Ready-made building blocks for BigQuery, Cloud Storage, Dataflow, Dataproc, Pub/Sub, Vertex AI, and many outside systems.
Managed operations
Google runs the scheduler, workers, database, and storage, and helps with upgrades and scaling.
Cloud Composer is an orchestrator, not a data processing engine. It tells other tools when to work and checks that they finished. It is a poor place to crunch large amounts of data directly. Heavy processing belongs in services built for it, such as BigQuery or Dataflow, which Composer simply starts and watches.
2The Problem: Why Plain Schedules Are Not Enough
Understanding the problems that orchestration solves makes every Composer feature easier to remember.
The cron approach and where it breaks
Cron is a tool found on Linux computers that starts a program at a fixed time, such as every day at two in the morning. It is simple and works well for a single job. But a chain of jobs reveals its limits.
- No knowledge of order. Cron starts job B at three o’clock because someone guessed that job A would be done by then. If A is slow tonight, B runs on incomplete data.
- No retries. If a job fails because of a short network glitch, nothing tries again. The failure is silent unless someone wrote extra code to report it.
- No overview. To learn which jobs ran last night, you must log in to each machine and read each log file.
- No history to rerun. If you need last Tuesday’s data rebuilt, there is no built-in way to say “run the whole chain again for that day”.
- No shared view of dependencies. Knowledge of what depends on what lives in people’s heads and old comments.
What a workflow system adds
| Need | Cron and scripts | Workflow orchestration |
|---|---|---|
| Run steps in the right order | Guess the timing | Explicit dependencies between steps |
| Recover from a short glitch | Usually manual | Automatic retries with delays |
| See what happened | Read logs on many machines | One screen with status for every step |
| Rebuild old days | Hand-written scripts | Built-in backfill and reruns |
| Know who depends on whom | Tribal knowledge | A drawn graph of the pipeline |
| Alert people | Extra code per job | Standard alerts on failure and lateness |
Cron is like telling five friends, “Please come to my house at six, six-thirty, seven, seven-thirty, and eight, in that order.” If the first friend is late, the second arrives and finds an unprepared house. A workflow system is a host standing at the door who says, “Come in once the previous person has finished and left.”
Why not build it yourself?
Some teams write their own scheduler, and many regret it. A reliable one must handle crashed machines, duplicated starts, clock problems, hung jobs, huge numbers of tasks, and secure access to many systems, plus a user interface. Airflow already does all this, with years of testing from thousands of companies. Cloud Composer then removes the burden of running Airflow itself, which is itself a complex system with many moving parts.
If your whole need is “run one thing every night” and nothing depends on anything else, a simple scheduler is cheaper and easier than Composer. Orchestration earns its place when there are several steps, dependencies, retries, and a need for visibility.
3A Short History: From Airbnb to Managed Airflow
Knowing where Airflow came from explains why it looks the way it does.
Before: scripts and early schedulers
Data teams stitched together scripts and schedulers. As data volumes grew, the number of jobs and the tangle of dependencies grew faster than anyone could manage by hand.
Around 2014: Airflow starts at Airbnb
Engineers at Airbnb built Airflow to manage their growing data pipelines. A key idea was to write workflows as code, which makes them reviewable, testable, and versioned like any other software.
2015 to 2019: open source and the Apache Foundation
The project was shared openly, grew a large community, entered the Apache Software Foundation, and later became one of its top-level projects.
Late 2010s: Cloud Composer appears
Running Airflow well is hard work: it needs a scheduler, workers, a database, a web server, and storage, all kept healthy and upgraded. Google introduced Cloud Composer to offer all of this as a managed service on Google Cloud.
Airflow 2 and new Composer generations
Airflow 2 brought a faster scheduler that could run in several copies, a cleaner way to write tasks, and better extension points. Newer generations of Composer made environments autoscale and simplified their infrastructure.
Today
Composer sits in the middle of many Google Cloud data platforms, coordinating warehouses, processing engines, machine learning jobs, and outside systems.
Composer generations
Cloud Composer has had several generations, usually called Composer 1, Composer 2, and Composer 3. In broad strokes, the first generation ran a fixed set of machines you had to size. The second generation made the worker count scale up and down automatically based on the work waiting. The third generation moved even more of the underlying infrastructure behind the scenes so that you manage fewer pieces, and simplified networking and sizing. Older generations are retired on a published schedule, so for any new project use the newest generation that Google recommends and check the documentation for current support dates.
Features, supported Airflow versions, limits, and prices change over time. Treat this guide as a map of the ideas, and check Google Cloud’s official documentation for current details before you finalize a design.
4Core Concepts: The Language of Airflow
A handful of words explain almost everything you will meet in Composer. Learn these and the rest is easy.
DAG
Short for directed acyclic graph. It is one workflow: a set of tasks joined by arrows that show their order. “Acyclic” means no loops, so a task can never end up waiting on itself.
Task
One unit of work inside a DAG, such as “run this query” or “copy these files”.
Operator
A ready-made kind of task. An operator knows how to do one type of thing, such as run a BigQuery job or start a Dataflow pipeline.
Sensor
A special task that waits for something to happen, such as a file appearing in storage or a message arriving, before the workflow moves on.
Hook
A helper that talks to an outside system, such as a database or a cloud service. Operators use hooks inside.
DAG run
One execution of a whole DAG for a particular time period. Each run has its own record of results.
Connection
Saved details for reaching an outside system, such as a hostname and login. Kept out of the DAG code.
Variable
A named value that DAGs can read, for example a project name or a folder path, changeable without editing code.
XCom
Short for cross-communication. A way for one task to leave a small message, such as a file name, for a later task to read.
Schedule
The rule that decides when new runs start: a calendar pattern, a time gap, or an event.
Logical date and data interval
The time slice of data a run is responsible for, which is not always the moment the run actually starts.
Pool
A limit on how many tasks of a certain kind may run at once, to avoid overwhelming a system.
The task lifecycle
Every task goes through a series of states, and the Airflow screen shows them in colors.
stateDiagram-v2
[*] --> Scheduled
Scheduled --> Queued: dependencies met
Queued --> Running: worker picks it up
Running --> Success: finished well
Running --> UpForRetry: failed, retries left
UpForRetry --> Scheduled: wait, then try again
Running --> Failed: failed, no retries left
Scheduled --> Skipped: branch not chosen
Scheduled --> UpstreamFailed: earlier task failed
Success --> [*]
Failed --> [*]
Skipped --> [*]
UpstreamFailed --> [*]
A DAG is a recipe card. Each task is one line, such as “chop onions”. An operator is a type of instruction, like “chop”, “boil”, or “bake”. A sensor is “wait until the dough has doubled”. A run is one actual evening you cook that recipe. The connection is the key to the pantry, and the XCom is a sticky note saying “I used the large pot”.
Remember that Airflow files describe the plan only. Reading a DAG file does not run any of the work. The work happens later, when the scheduler decides a task is due and a worker carries it out. This difference explains many surprises for beginners.
5A DAG in Practice: A Nightly Sales Pipeline
Let us build a small example in words and pictures, so the ideas feel real.
Imagine a retail company. Each night, the shops drop sales files into a Cloud Storage bucket. By morning, the managers want a clean report. Here is the pipeline as a DAG.
flowchart LR
A["Wait for files in Cloud Storage"] --> B["Load raw files into BigQuery"]
B --> C["Check row counts and quality"]
C --> D["Build daily sales summary"]
C --> E["Build product ranking table"]
D --> F["Refresh dashboard data"]
E --> F
F --> G["Send success message to the team"]
Reading the picture
Wait for the files
A sensor checks the bucket at intervals. Nothing else starts until the files arrive, so late files cannot cause half-finished reports.
Load into the warehouse
A BigQuery operator starts a load job. Composer does not move the data itself. It tells BigQuery to do it and waits for the answer.
Check quality
A task counts rows and tests basic rules. If the data looks wrong, the task fails and the rest of the pipeline stops, instead of publishing bad numbers.
Two builds in parallel
The summary and the ranking do not depend on each other, so Airflow starts both at once. This saves time.
Join and refresh
The dashboard refresh waits for both builds to finish before it starts.
Tell the team
A final task posts a message. Failure at any earlier step triggers an alert instead.
What the DAG file contains
The DAG is an ordinary Python file placed in a special folder. In words, it holds: a name for the DAG, the schedule, a start date, default settings such as how many times to retry and how long to wait between tries, the list of tasks with their settings, and the arrows that join them. Airflow reads the file regularly, discovers the DAG, and shows it in the web screen.
Settings that matter from day one
- Retries and retry delay: how many times to try a failed task again and how long to wait between tries, which helps with temporary glitches.
- Timeout: the longest a task may run before being stopped, so a hung task cannot block forever.
- Owner and alert contacts: who should be told when something fails.
- Catchup: whether to create runs for past time periods that were missed, covered in the scheduling chapter.
- Concurrency limits: how many runs and tasks may be active at the same time.
It is like the plan for a relay race. The plan says who runs first, who runs next, and that two runners may run on parallel tracks in the middle before handing over to the final runner. The plan is not the race itself. It is the instruction sheet the coach uses on race day.
Avoid doing real work while the file is being read, such as calling a database or an outside service at the top of the file. Airflow reads every DAG file over and over, many times an hour. Heavy work at the top slows down the whole system and can make the scheduler struggle.
6Architecture and Components
Now let us zoom out and see the machinery that Composer builds for you.
When you create a Composer environment, Google builds a complete, ready-to-use Airflow installation. The exact layout differs between Composer generations, but the main parts are the same.
flowchart TB
DEV["You: DAG files in Python"] --> GCS["Cloud Storage Bucket: dags, plugins, data, logs"]
GCS --> DP["DAG Processor: reads DAG files"]
DP --> DB[("Metadata Database")]
SCH["Scheduler: decides what runs when"] --> DB
SCH --> Q["Task Queue"]
Q --> W["Workers: run the tasks"]
W --> DB
TRG["Triggerer: waits for deferred tasks"] --> DB
WEB["Web Server: Airflow screen and API"] --> DB
W --> GCP["BigQuery, Dataflow, Dataproc, Cloud Storage, Pub/Sub"]
USER["Users and Operators"] --> WEB
W --> LOGS["Cloud Logging and Monitoring"]
The components, one at a time
Cloud Storage bucket
Every environment has a bucket with folders for DAG files, extra plugins, shared data, and logs. Uploading a file to the dags folder is how you deploy a workflow.
DAG processor
Reads the Python files, finds the DAGs inside them, and stores the structure so the scheduler can use it.
Scheduler
Constantly checks which tasks are due and whose earlier steps have finished, and places them in the queue. More than one scheduler can run for resilience and speed.
Workers
The machines or containers that actually run tasks. Their number grows and shrinks in newer generations according to the work waiting.
Triggerer
Handles tasks that wait for outside events in an efficient way, so waiting does not hold a worker busy.
Web server
Serves the Airflow screen where you see DAGs, runs, graphs, and logs, and where you can start or stop things.
Metadata database
A managed database that remembers every DAG, run, task state, connection, and variable. It is the single source of truth.
Task queue
The waiting line between the scheduler and the workers.
Logging and monitoring
Logs from each part go to Cloud Logging, and health numbers go to Cloud Monitoring.
Where things live
In some generations, Composer places part of the environment, such as a Kubernetes cluster for the scheduler and workers, inside your own project, while other parts such as the database and web server live in a Google-managed project. In the newest generation, even more of this is hidden behind the scenes, and you manage fewer pieces. Either way, you interact with an environment as a single unit through the console, the command line, or the API.
Imagine a small airline control center. The bucket is the folder of flight plans. The DAG processor reads the plans. The scheduler is the controller who says which plane takes off now. Workers are the planes and crews doing the real flying. The database is the big board that records every flight. The web server is the public screen showing the board.
Remember that the workers run your tasks, but those tasks mostly call other services. A worker that only starts a BigQuery job and waits needs little power. A worker that tries to do the data crunching itself needs far more, and that is usually the wrong design.
7Internal Working: The Life of a DAG Run
Let us follow one workflow from the moment you upload it to the moment its last task finishes.
sequenceDiagram
participant Dev as You
participant GCS as Cloud Storage
participant DP as DAG Processor
participant S as Scheduler
participant Q as Queue
participant W as Worker
participant DB as Metadata Database
participant BQ as BigQuery
Dev->>GCS: Upload DAG file
GCS->>DP: File syncs to Airflow
DP->>DB: Store DAG structure
S->>DB: Is a run due?
DB-->>S: Yes, create the run
S->>Q: Queue first task
Q->>W: Worker takes the task
W->>BQ: Start the job
BQ-->>W: Job finished
W->>DB: Record success
S->>DB: Which tasks are now ready?
The journey, step by step
You upload the DAG file
The file goes into the dags folder of the environment’s bucket. After a short delay, it is synced to the Airflow components.
The DAG processor reads it
It runs the Python file, finds the DAG and tasks defined inside, and saves their structure to the database. Errors in the file show up on the Airflow screen.
The scheduler creates a run
When the schedule says a run is due, the scheduler writes a new DAG run to the database and marks its tasks as waiting.
Ready tasks are queued
Tasks with no unfinished earlier steps become ready. The scheduler checks limits such as pools and concurrency, and puts them in the queue.
A worker runs the task
A worker takes the task, runs the operator’s logic, which usually calls a Google Cloud service, and records the result and logs.
The scheduler moves on
After each result, the scheduler checks which later tasks are now ready and repeats. If a task fails, it applies the retry rules.
The run completes
When every task has a final state, the run is marked as success or failed, and the history stays in the database for review.
Waiting without wasting workers
Some tasks mostly wait: for a file, for a long query, or for an outside job. A worker that sits idle waiting is wasteful. Airflow offers deferrable operators. Such an operator starts its job, then gives its worker back and hands the waiting to the triggerer, a very lightweight component that can watch thousands of waiting tasks at once. When the event arrives, the task is resumed on a worker. This can reduce the number of workers you need, and therefore your costs.
A waiter who stands at the oven until your pizza is done cannot serve any other table. A better restaurant gives you a buzzer, so the waiter serves others until the buzzer rings. The triggerer is that buzzer system, and deferrable tasks are customers holding a buzzer.
The scheduler works from the database. If the database is overloaded or slow, everything slows down: new tasks start late and the screen lags. Keep the number of tasks and the size of stored messages reasonable, and watch database health in monitoring.
8Environments: Sizes, Resilience, and Networking
An environment is the unit you create, pay for, and manage. Choosing its shape wisely is one of the first big decisions.
One environment hosts many DAGs. It is in a single region, with its own bucket, its own Airflow settings, its own installed packages, and its own permissions. You can create several environments in a project, for example one for development, one for testing, and one for production.
Choices you make when creating an environment
| Choice | Options | What to think about |
|---|---|---|
| Composer generation and Airflow version | The newest generation and a supported Airflow version | Pick a current version so you get fixes and support. Check that your code and packages work with it |
| Region | Any supported region | Put it near your data and other services, and respect data residency rules |
| Size | Small, medium, or large presets, plus tuning of components | Size by the number of DAGs and tasks, not by data volume |
| Resilience | Standard or highly resilient | High resilience runs more than one scheduler and spreads across zones, at higher cost |
| Worker scaling | Minimum and maximum worker counts | A minimum keeps tasks starting quickly, and a maximum caps cost |
| Networking | Public or private | Private environments avoid public addresses and fit stricter security needs |
| Encryption | Google-managed or customer-managed keys | Use customer-managed keys if rules require control over keys |
| Service account | The identity the environment uses | Give it only the access the DAGs need |
Sizing by workload, not data
Because Composer only coordinates work, the size you need depends on how many DAGs, how many tasks, how often they run, and how many run at the same time, not on how big your data is. A small environment can orchestrate petabytes of data processing, since the processing is done elsewhere. A very busy environment with tens of thousands of tiny tasks per day may need larger scheduler and database resources.
Networking basics
- Public environments are reachable on the internet at the service level, with access controlled by identity, and are the simplest to set up.
- Private environments keep components on private addresses inside your virtual private cloud, so traffic stays off the public internet. They need more planning for outside access, such as using NAT for downloads of packages or reaching outside APIs.
- The web interface can be restricted to chosen address ranges, in addition to requiring sign-in.
Many environments for many purposes
A single shared environment for everything is convenient, but a mistake or a heavy DAG in one team’s work can slow down everyone’s. Many organizations give each environment a clear purpose, such as separate environments for development, testing, and production, and sometimes one per team or domain. The right balance depends on how much isolation you need and how much you want to spend, since each environment has base costs even when idle.
An environment is like a kitchen. A small kitchen can produce a banquet if the real cooking is done by outside caterers, and you only need to coordinate them. But if ten chefs share one tiny kitchen and all start shouting orders, you need a bigger, better-organized one.
Start small, watch the metrics for scheduler delays and worker queues for a few weeks, and then adjust. It is easier to grow a right-sized environment than to guess correctly at the start.
9Scheduling: Time, Data Intervals, Catchup, and Backfill
Scheduling looks simple but hides the most confusing ideas in Airflow. Take them slowly.
Ways to schedule
Cron-style schedules
A short pattern such as “every day at one in the morning” or “every Monday at nine”. The most common choice.
Time gaps
Run every so many hours or minutes after the previous run is due.
Data-aware scheduling
Run when another workflow has updated a named dataset, so downstream pipelines follow their sources automatically.
No schedule
Only run when someone or something triggers the DAG, for example through the screen or the API.
The data interval: the idea that confuses everyone
Each run is responsible for a slice of time, called its data interval, with a start and an end. For a daily schedule, the run for Monday covers Monday’s data, from midnight to the next midnight. Because Monday’s data is only complete after Monday ends, the run for Monday starts at the end of the interval, early on Tuesday. So a run’s logical date, the label for its slice, is earlier than the moment it actually starts.
A bank statement for March is produced in early April. The statement is “for March”, but it is created after March is over. Airflow works the same way: a daily run labelled Monday processes Monday’s data and runs after Monday has finished.
Catchup and backfill
- Catchup: If a DAG has a start date in the past, or the system was down for some days, catchup tells Airflow whether to create and run all the missed intervals. With catchup on, a new DAG may start dozens of runs at once. With it off, only the latest interval runs.
- Backfill: A deliberate request to run a DAG for a chosen range of past intervals, such as when you fix a bug and need to rebuild last month’s data.
Idempotent tasks: the golden rule
A task is idempotent if running it twice for the same interval gives the same result as running it once. This is the single most important design habit, because retries, reruns, and backfills all run tasks more than once. A task that appends rows to a table without checking will create duplicates when it is retried. An idempotent version replaces that interval’s data or uses a safe merge, so repeats are harmless.
Idempotent style
- Writes results for one interval to a separate partition and replaces it on rerun
- Uses the run’s logical date to choose its data, not the current clock
- Safe to retry and to backfill
- Easy to reason about and test
Fragile style
- Appends blindly and creates duplicates on retry
- Reads “now” or “yesterday” from the clock inside the task
- Deletes input files after processing, so a rerun finds nothing
- Produces different results for the same interval each time
Other scheduling controls
- Maximum active runs: how many runs of the same DAG may overlap. Limiting it prevents one slow night from piling up work.
- Depends on past: a task waits for its own previous run to succeed, useful when each day builds on the last.
- Trigger rules: by default a task waits for all its parents to succeed. You can change this, for example to run a cleanup task whatever happened before.
- Time zones: be explicit. Clocks changing for daylight saving time can create skipped or doubled hours in local time. Many teams schedule in a single stable zone for this reason.
Do not set a dynamic start date such as “now” in a DAG. The start date moves every time the file is read, and the scheduler can never decide that a run is due. Use a fixed date in the past.
10Working With Google Cloud Services
Composer shines when it conducts the other services in Google Cloud. Here are the typical partners.
Composer comes with a large collection of ready-made operators, sensors, and hooks for Google Cloud, delivered in a provider package that is already installed. Using them is much better than writing your own code to call the services, because they handle authentication, waiting, and errors properly.
| Service | What Composer typically does with it |
|---|---|
| BigQuery | Start queries and load or export jobs, check data quality, create and refresh tables |
| Cloud Storage | Wait for files, copy and move objects, and send files to other systems |
| Dataflow | Launch batch or streaming pipelines and wait for them to finish |
| Dataproc | Create temporary clusters, submit jobs, and delete clusters afterwards to save money |
| Pub/Sub | Publish messages, or wait for messages as a trigger |
| Vertex AI | Start training and prediction jobs and manage machine learning steps in a larger pipeline |
| Cloud Run and Cloud Functions | Run containerized jobs or small functions as workflow steps |
| Cloud SQL and other databases | Run statements and move data between systems |
| Outside systems | Call web APIs, transfer files over secure protocols, or run commands on other machines |
Common pipeline shapes
ELT into the warehouse
Load raw data into BigQuery, then transform it using SQL inside BigQuery, with Composer sequencing the stages.
Ephemeral cluster
Create a Dataproc cluster, run jobs, and delete it, so you only pay for the time it exists.
Machine learning pipeline
Prepare data, train a model, evaluate it, and deploy it only if the quality is good enough.
Reporting chain
Refresh tables, then dashboards, then email the summary, with checks along the way.
Cross-system sync
Pull from a business application, land data in storage, load it, and tell the owner.
Housekeeping
Cleanups, archive moves, access reviews, and cost reports on a regular schedule.
Let the service do the work
The principle that keeps Composer healthy is this: orchestrate, do not process. A good task submits a job to the right service and then waits, ideally in a deferrable way, instead of pulling data through the worker. A good example is asking BigQuery to run a query that writes its results to a table, rather than fetching millions of rows into Python on the worker and writing them back.
A building manager who needs a wall painted calls the painters and checks that the work is done. They do not carry the paint cans up the stairs themselves. Composer is the manager, and BigQuery, Dataflow, and Dataproc are the painters.
Where an operator offers a deferrable mode, use it for long jobs. It frees workers during the wait and lets a smaller environment handle more concurrent work.
11Packages, Configuration, Connections, and Secrets
Real workflows need extra libraries, settings, and passwords. Here is how Composer handles each safely.
Extra Python packages
Composer ships with Airflow and many common libraries. If your tasks need more, you add them to the environment as Python packages from a public or private package index. Composer then installs them on every component. A few cautions apply.
- Packages can conflict with Airflow’s own libraries. Test changes in a development environment first.
- Installing or changing packages updates the environment and may take many minutes, during which it is busy.
- Pin exact versions so every environment behaves the same.
- For heavy or conflict-prone code, run the task in its own container, for example with a Kubernetes pod or a Cloud Run job, so its libraries stay separate.
Configuration overrides and environment variables
Airflow has hundreds of settings, such as how often to scan the DAG folder and how many tasks may run in parallel. Composer lets you override many of them for an environment. You can also set environment variables that your DAG code can read, for values that differ between development and production.
Connections and variables
A connection stores how to reach an outside system, such as the address and login of a database. A variable stores a simple named value. Both can be created in the screen or through the command line, but you should think carefully before storing sensitive data there, as covered next.
Secrets: keep passwords out of code
Never write a password, key, or token inside a DAG file. DAG files are copied, reviewed, stored in version control, and visible to many people. Composer can use Secret Manager, Google Cloud’s service for storing secrets, as a secrets backend. Airflow then looks up connections and variables from Secret Manager when needed. Benefits include central control, access logging, rotation without touching DAG code, and fine-grained permissions.
Store the secret
Create it in Secret Manager and give the environment’s service account permission to read just that secret.
Enable the backend
Turn on the Secret Manager backend in the environment’s settings.
Refer by name
DAGs refer to the connection or variable name, and Airflow fetches the real value at runtime.
Rotate when needed
Update the secret in one place, and every DAG uses the new value on its next run.
Identity, not passwords, where possible
For calls to Google Cloud services, you often need no password at all. The environment runs as a service account, a robot identity, and Google Cloud checks its permissions. Give each environment its own service account with only the roles its DAGs need. This is safer than long-lived keys, which can leak.
Secrets are like house keys. You do not write the key’s shape on the whiteboard in the office for everyone to read. You keep it in a locked key cabinet, you give each person only the keys they need, and you can change a lock without rewriting everyone’s job description.
Values stored as plain variables or connections in the Airflow database are visible to users who can see the Airflow screen, depending on their roles. Use a secrets backend for anything sensitive, and keep the Airflow roles of regular users limited.
12Deployment: Getting DAGs Into Composer Safely
Because workflows are code, they deserve the same careful delivery as any other software.
The simplest deployment is to upload a Python file into the dags folder of the environment’s bucket. That is fine for a first experiment, but dangerous for a team. Anyone can overwrite anything, nobody reviews the change, and a single typo can stop a nightly pipeline. Mature teams treat DAG files like application code and ship them through a pipeline.
flowchart LR
A["Developer writes DAG in Git branch"] --> B["Pull request and review"]
B --> C["Automated checks: import test, style, unit tests"]
C --> D["Merge to main"]
D --> E["Pipeline syncs files to Dev environment bucket"]
E --> F["Run test DAG runs in Dev"]
F --> G["Promote to Test or Staging environment"]
G --> H["Approval"]
H --> I["Sync to Production bucket"]
I --> J["Watch first runs and alerts"]
What the automated checks should do
- Import test: Load every DAG file and confirm that it parses without errors and within a short time. A DAG that cannot be read is the most common cause of a missing workflow.
- Structure checks: Confirm required settings exist, such as owner, retries, and tags, and that there are no loops.
- Unit tests: Test the small pieces of logic inside tasks, using fake inputs, without needing the real cloud.
- Style and safety rules: Catch heavy work at the top of files, hard-coded secrets, and a dynamic start date.
- Dry runs: In a development environment, run the DAG for a small interval and check its outputs.
How files reach the workers
When you upload to the bucket, Composer copies the changes to the components that need them. This takes a short time, usually seconds to a minute or so. So a new or changed DAG is not live the instant the upload ends. Likewise, the screen may briefly show an old version. Plan deployments with that small delay in mind, and avoid changing a DAG while one of its runs is in progress, because running tasks may see a mixture of old and new code.
Separate environments for separate purposes
| Environment | Purpose | Typical rules |
|---|---|---|
| Development | Experiments and first tests | Small size, test data only, relaxed permissions for authors |
| Test or staging | Full-size rehearsals before release | Production-like settings, realistic but safe data |
| Production | Real business workflows | Strict permissions, deployments only through the pipeline, alerts on every failure |
Keep DAG code small and put logic elsewhere
A healthy approach is to keep DAG files thin: they describe the order and the settings, while the real logic lives in tested libraries, SQL files, or containers. This makes DAGs quick to read, easy to review, and cheap for the scheduler to parse. Shared helper code can go in a common module deployed alongside the DAGs.
A newspaper does not publish stories as soon as a reporter finishes typing. Each story is edited, fact-checked, and approved before the presses roll. Shipping a DAG straight into production without review is like printing the first draft.
Tag every DAG with its team and purpose. When there are hundreds of DAGs, tags let people filter the screen to just their own and make ownership clear when something fails.
13Performance and Scalability
An orchestrator that is slow to start tasks wastes the time of every pipeline. Here is how to keep it quick.
What actually limits Composer
Remember that Composer coordinates; it does not crunch data. So its limits come from coordination work: how many DAG files must be read, how many tasks must be tracked, how many may run at once, how busy the database is, and how many workers are available. Data volume rarely matters directly.
Levers you can pull
Fast DAG files
Keep imports light and avoid work at the top of files. Slow parsing eats scheduler time and delays every other DAG.
Autoscaling
Set a sensible minimum and maximum number of workers. Workers are added when tasks are waiting and removed when idle.
Parallelism settings
Control how many tasks run at once overall, per DAG, and per worker. Raise them only if the workers and downstream systems can cope.
Pools
Reserve a limited number of slots for a fragile resource, such as a database that can handle only five connections at once.
Deferrable operators
Hand long waits to the triggerer so that workers are free for real work.
Scheduler capacity
More than one scheduler, and enough CPU for each, keeps task starts prompt in large environments.
Task size and count
Each task has overhead: records in the database, scheduling decisions, queueing, and a worker start. A DAG with ten thousand tiny tasks can overwhelm the system, while a few well-sized tasks do the same work with less strain. On the other hand, one giant task that runs for hours hides progress and makes retries painful. Aim for tasks that take a meaningful amount of time and have a clear outcome, such as a minute to an hour, and let the underlying service run its work in parallel inside.
Passing data between tasks
XComs are stored in the metadata database, so they should hold only small values such as a file name or a row count. Never pass a table or a large file through an XCom. Put the data in Cloud Storage or BigQuery, and pass its location instead. Large XComs slow the database and affect everyone.
Dynamic task mapping
When a pipeline must do the same thing for many items, such as one task per file in a folder, Airflow can create the tasks at run time from a list. This is far tidier than generating hundreds of DAG files, but still be mindful of the total count of tasks.
Signs of a healthy environment
- Tasks start within seconds of becoming ready
- DAG files parse in a fraction of a second each
- Workers scale up for bursts and back down afterwards
- Database load stays moderate
Signs of trouble
- Long gaps between a task becoming ready and starting
- Parse times climbing for many files
- Queued tasks piling up with workers at the maximum
- The screen slow or timing out
A dispatcher at a taxi company has a limit to how many rides they can assign per minute. Giving them a hundred tiny one-block rides wastes their time, while giving them fewer, longer rides keeps things smooth. Passing huge parcels through the dispatcher’s notepad would bury them in paper.
If you raise parallelism without checking the systems your tasks call, you may simply move the bottleneck. Hundreds of simultaneous queries to a small database can bring it down, and the failures will then look like Composer errors.
14Availability, Recovery, and Upgrades
Pipelines often run while everyone is asleep. When something breaks at night, the system should recover by itself or be easy to rebuild.
Resilience inside one region
A highly resilient environment runs several copies of key parts, such as more than one scheduler, spread across separate zones, which are isolated parts of a region. If one copy or one zone fails, others carry on. Workers that crash are replaced, and a task that was running on a lost worker is retried according to its retry settings. The managed database also keeps standby copies, as is usual for Google Cloud managed databases.
When a whole region has trouble
An environment lives in one region. If that region becomes unavailable for a long time, recovery means bringing up an environment elsewhere. Composer offers snapshots, which save the state of an environment, including its DAG files, its settings, connections, variables, and run history, into a bucket. You can later load a snapshot into a new environment, even in another region, and continue from there. This also helps with moving between versions and between projects.
Keep everything as code
DAGs, settings, and infrastructure definitions in version control mean you can rebuild without needing a lucky backup.
Take regular snapshots
Schedule snapshots of production, and keep copies in a bucket in a different region.
Choose a recovery plan
Decide between keeping a second environment ready, or creating one only when needed. A ready one recovers faster but costs more.
Make tasks safe to repeat
Idempotent tasks mean a recovered environment can rerun intervals without creating duplicates.
Rehearse
Practice the recovery in a test project so that the steps are known when the real day comes.
Upgrades
Airflow and Composer both release new versions. Upgrading brings fixes, security patches, and features, and Google retires old versions on a schedule, so upgrades cannot be put off forever. A safe approach follows these steps.
- Read the release notes for both Composer and Airflow, watching for changes that affect your DAGs and packages.
- Create a test environment on the new version, load a snapshot of production, and run your key DAGs.
- Fix any warnings about features that are being removed.
- Upgrade production in a quiet period, or build a new environment and switch over, depending on your risk tolerance.
- Take a snapshot immediately before the upgrade, as a way back.
Maintenance windows
Composer needs occasional maintenance for the managed parts. You can set a preferred window, so that maintenance happens at a time that disturbs your pipelines least, such as a quiet weekend period.
It is like owning a second set of keys and a floor plan of your house stored at a friend’s place. If your house burns down, you do not have to remember where every room was. You just rebuild from the plan and move in the saved belongings.
Do not let versions fall behind until support ends. Large jumps across many versions are harder and riskier than small regular steps, and unsupported versions may stop receiving security fixes.
15Security: Who Can Do What
An orchestrator holds the keys to many systems. That makes it a powerful target and a place that deserves careful protection.
Think of Composer as a robot that can open many doors. The robot’s identity, its permissions, and who may give it orders must all be controlled. Security here has several layers.
Layer 1: Who may manage environments (IAM)
IAM, Identity and Access Management, decides who can do what in Google Cloud. Composer has roles for administrators who create and change environments, for users who can use them and see the Airflow screen, and for the environment’s own service account that needs permissions to run. Keep administrator rights for a small group, since an administrator can change settings that affect every DAG.
Layer 2: The environment’s identity
Every environment runs as a service account. Whatever that account may do in Google Cloud, every DAG in the environment may do too. So if a DAG author can write any Python code, they effectively get all the permissions of that account.
- Give each environment its own service account, not a shared all-powerful one.
- Grant only the roles the DAGs really need, on the specific datasets and buckets, not on the whole project.
- Separate environments by trust level. Do not put highly sensitive workflows and experimental ones from many authors in the same environment.
Layer 3: Who may use the Airflow screen
Inside Airflow, a second set of roles controls what a signed-in person can do. Typical roles range from read-only viewers, who can see DAGs and runs, to users who can trigger and clear tasks, to administrators who can manage connections and users. Map these roles to groups of people thoughtfully. Signing in is tied to Google identity, and access to the screen can also be limited to certain network ranges.
Layer 4: Network protection
- Private environments keep components on private addresses inside your network.
- Firewall rules and routes limit what the environment may reach, and what may reach it.
- VPC Service Controls can draw a protective boundary around Google Cloud services to reduce the risk of data leaving to unapproved places.
Layer 5: Data and secrets
- Encryption at rest is on by default with Google-managed keys. Customer-managed keys are available if your policies require them.
- Secret Manager keeps passwords and keys out of code and out of the Airflow database.
- Logs can contain sensitive values if tasks print them. Do not print secrets or personal data in task code.
Layer 6: Auditing
Cloud Audit Logs record who changed an environment, and Airflow keeps its own record of who triggered or cleared tasks. Send these to a protected location, and alert on unusual changes, such as a new connection being added to a production environment at an odd hour.
A hotel master key opens every room. The hotel therefore gives it only to a few trusted people, writes down who took it and when, keeps sensitive rooms on a different set of keys, and does not leave the key lying on the front desk.
The most common security mistake is a single environment with a very powerful service account shared by many teams. One careless or malicious DAG then has the keys to everything. Split by trust, and shrink permissions.
16Monitoring, Logging, and Alerting
The goal is simple: know about a broken pipeline before your customers or managers do.
Two kinds of health
There are two different questions to ask. The first is about your workflows: did last night’s runs succeed, and on time? The second is about the environment: is the scheduler alive, are workers keeping up, is the database healthy? Both need watching.
The Airflow interface
Shows each DAG’s recent runs in color, with task logs a click away. The first place to look when something fails.
Cloud Monitoring
Numbers for environment health: scheduler heartbeat, DAG parse times, queued and running tasks, worker counts, database load.
Cloud Logging
Logs from the scheduler, workers, DAG processor, and web server, searchable in one place.
Console dashboards
Composer provides monitoring views for each environment that summarize the main health numbers.
Airflow callbacks and emails
Run your own code when a task or DAG fails, succeeds, or is late, for example posting a message to a chat or paging someone.
Service level targets
Define how late a pipeline may finish, and alert when a run misses its target.
Useful alerts
- A DAG run failed, with the name and a link to the logs.
- A pipeline has not finished by its deadline, which also catches runs that are stuck, not just failed ones.
- A DAG did not run at all when it should have, which catches broken scheduling or a DAG file that failed to parse.
- The scheduler stopped reporting its heartbeat, a sign the core is unhealthy.
- Tasks queued for too long, which signals too few workers or a limit set too low.
- High database load or very slow DAG parsing.
- Spending above a budget.
Alert fatigue
If every small, self-healing blip pages a person, people stop listening. Use retries so that temporary glitches fix themselves quietly, alert only when retries are exhausted, send low-urgency problems to a chat channel, and reserve pages for failures that need action now. Give every alert an owner and a runbook step describing what to check first.
flowchart TD
T["Task fails"] --> R{"Retries left?"}
R -->|"Yes"| W["Wait, then retry quietly"]
W --> T
R -->|"No"| F["Task marked failed"]
F --> C["Failure callback runs"]
C --> SEV{"Business critical?"}
SEV -->|"Yes"| PG["Page the on-call person"]
SEV -->|"No"| CH["Post to team chat channel"]
F --> UP["Downstream tasks marked upstream failed"]
A smoke detector that beeps whenever you toast bread soon gets its battery removed. A good one waits for real smoke, and then wakes the whole house. Alerts should work the same way: loud only when it matters.
Add a simple “heartbeat” DAG that runs often and does almost nothing. If it stops succeeding, you know that the scheduler, the workers, or the pipeline plumbing is unhealthy, even when no business DAG is due.
17Understanding and Controlling Cost
Composer is not free to leave running. Knowing what you pay for is the first step to paying less.
Unlike some serverless services that cost nothing when idle, a Composer environment has always-on components, such as the scheduler, the web server, and the database, and so has a base cost even when no DAG is running. On top of that, workers and extra storage add cost when work happens.
| Cost driver | What counts | Plain-language tip |
|---|---|---|
| Environment base | The always-on parts such as scheduler, web server, and triggerer, billed by size and time | Choose the smallest size that meets your needs and review it regularly |
| Workers | Compute used by workers, which scales with the work waiting | Set a sensible maximum and use deferrable operators for waits |
| Metadata database | Storage and compute for Airflow’s database | Clean up old run history so the database does not grow forever |
| Bucket storage | DAG files, logs, and data in Cloud Storage | Set lifecycle rules to delete old logs |
| Network | Data moving between regions or out to the internet | Keep the environment in the same region as the data it touches |
| Services you start | BigQuery queries, Dataflow jobs, Dataproc clusters, and so on, billed by those services | Usually the largest cost by far. Optimize the jobs themselves |
| Logging and monitoring | Log ingestion and storage | Avoid very chatty task logs |
Newer generations of Composer describe compute using standard units, so you will see usage measured in a single kind of capacity unit rather than in separate counts of machines and memory. Check the current pricing page for exact rates and units, because they change over time and differ between generations and regions.
Practical ways to spend less
- Right-size the environment. Use metrics to confirm whether the scheduler, workers, and database are mostly idle, and trim if so.
- Use deferrable operators. Do not pay for workers to sit and wait.
- Create temporary clusters. For Dataproc work, create the cluster in the DAG and delete it afterwards, instead of keeping one running all day.
- Do not keep idle environments. Development environments still cost money when idle. Delete them when not needed, and rebuild from code and snapshots when you need them.
- Prune history. Remove old task records and logs on a schedule.
- Consolidate carefully. Several tiny environments each carry base costs. But do not merge them if that breaks isolation you need for security.
- Set budget alerts. A runaway DAG that launches expensive jobs in a loop is a classic surprise.
An environment is like renting a small office for your project manager. You pay the rent every month whether or not meetings happen. The meeting rooms and the contractors they hire cost extra when used. Cutting costs means a smaller office, hiring contractors only when needed, and not paying for rooms nobody uses.
The costliest mistake is often not in Composer at all, but in the jobs it starts. A DAG that accidentally runs a huge query every few minutes can cost far more than the environment itself. Monitor spending by service, and put guardrails such as query size limits on the jobs.
18Advantages, Disadvantages, and Alternatives
Every tool has strengths and weak spots. Knowing both lets you choose with open eyes.
Advantages
- Managed Airflow: no installation, patching, or scaling work
- Workflows as code, with review and version control
- Rich ready-made connections to Google Cloud and outside systems
- Clear dependencies, retries, backfills, and history
- A visual screen for every run and every task
- Large community, many examples and add-ons
- Autoscaling workers in current generations
- Integration with IAM, logging, monitoring, and Secret Manager
Disadvantages
- Always-on base cost, even when idle
- Airflow itself has a learning curve and subtle ideas such as data intervals
- Not suited to very low-latency or high-frequency event handling
- Scheduler and database limits appear with very large numbers of tasks
- Package conflicts can make upgrades tricky
- Environment creation and changes take many minutes
- Tied to Airflow’s model, so moving off it takes real effort
The trade-offs behind the choice
Power vs simplicity
Airflow can express almost any pipeline, but simple jobs may be easier with a lightweight scheduler.
Shared vs separate environments
Sharing saves base costs, but separating gives safety, isolation, and independent upgrades.
Managed vs self-run
Self-running gives full control and avoids the base fee, but requires your team to operate a complex system.
Batch vs event-driven
Composer excels at scheduled and dependency-driven work, and is not the best tool for reacting to every single event within milliseconds.
How it compares with other options
| Option | Role | Shines at | Think twice when |
|---|---|---|---|
| Cloud Composer | Managed Airflow for complex pipelines | Many steps, dependencies, retries, backfills, and many systems | You have one or two simple jobs |
| Cloud Scheduler | A managed cron service | Simple timed triggers of one function or endpoint | You need dependencies, history, or retries between steps |
| Workflows | Serverless orchestration of service calls | Low-cost, quick, event-triggered chains of API calls | You need rich scheduling, backfills, or a large library of connectors |
| BigQuery scheduled queries and Dataform | SQL scheduling and SQL pipeline management | Warehouse-only transformations | Your pipeline reaches beyond the warehouse |
| Vertex AI Pipelines | Machine learning pipeline orchestration | Tracked, repeatable model training flows | Your workflows are mostly general data movement |
| Self-run Airflow | Airflow on your own servers | Total control of version and setup | You lack staff to operate and secure it |
| Other orchestrators | Open-source or commercial tools with different styles | Teams that prefer another programming model | You want the biggest ecosystem and Google Cloud integration |
flowchart TD
S["What do you need to run?"] --> Q1{"One simple timed trigger?"}
Q1 -->|"Yes"| SCH["Cloud Scheduler"]
Q1 -->|"No"| Q2{"Only SQL inside BigQuery?"}
Q2 -->|"Yes"| BQ["Scheduled queries or Dataform"]
Q2 -->|"No"| Q3{"Short chain of service calls, event driven?"}
Q3 -->|"Yes"| WF["Workflows"]
Q3 -->|"No"| Q4{"Many steps, dependencies, backfills, many systems?"}
Q4 -->|"Yes"| COMP["Cloud Composer"]
Q4 -->|"No"| REV["Re-check the requirements"]
It is common to use several of these together. For example, Cloud Scheduler or Pub/Sub may trigger a Composer DAG, and a Composer DAG may call Workflows for a sub-task. Pick the lightest tool that honestly fits each job.
19Design Patterns and Anti-Patterns
Teams keep solving the same orchestration problems. Here are the patterns that work, and the traps that catch people.
Patterns that work
Orchestrate, do not process
Tasks submit jobs to BigQuery, Dataflow, or Dataproc and wait. The heavy lifting stays in the specialist service.
Idempotent by interval
Each run writes one slice of data and replaces it on rerun, so retries and backfills are safe.
Sensor then process
Wait for the inputs, ideally in a deferrable way, before any processing starts.
Quality gate
Check the data before publishing it. If checks fail, stop the pipeline and alert.
Ephemeral resources
Create a processing cluster at the start of the workflow and delete it at the end, even on failure.
Thin DAGs, tested libraries
DAG files describe order. Logic lives in versioned, tested code or containers.
Anti-patterns to avoid
What it looks like
A task that downloads millions of rows into the worker, transforms them in Python, and uploads the result.
Why it hurts
Workers run out of memory, tasks crawl, costs rise, and one big job starves other pipelines of resources.
Do this instead
Let BigQuery or Dataflow do the processing, and use the task only to start the job and watch it.
What it looks like
Heavy work at the top of a DAG file, such as querying a database to decide which tasks to create.
Why it hurts
The file is read many times an hour. Each read repeats the work, slowing the scheduler and hammering the database.
Do this instead
Keep file reading cheap. Move such lookups into tasks, or use dynamic task mapping to create tasks at run time.
What it looks like
Tasks that append to tables or send emails without regard to repeats, and read the current clock instead of the run’s date.
Why it hurts
Retries and backfills create duplicates and wrong data. Rebuilding an old day gives results for today instead.
Do this instead
Use the run’s logical date, and write results so a rerun replaces the earlier output.
What it looks like
One environment shared by every team, with a powerful service account and authors who can change production DAGs directly.
Why it hurts
A mistake or misuse in one DAG can damage everything, and nobody can upgrade without risking everyone.
Do this instead
Split environments by trust and purpose, restrict who deploys, and deliver changes through a reviewed pipeline.
20Best Practices, Common Mistakes, and Troubleshooting
A practical checklist, followed by a simple method for finding out why a pipeline is not behaving.
Best practices
Orchestrate, do not process
Push heavy work to services designed for it.
Design idempotent tasks
Safe repeats make retries, reruns, and recovery painless.
Set retries, timeouts, and owners
Give every task a sensible retry policy, a maximum run time, and a named owner.
Ship through a pipeline
Review, test, and promote DAGs from development to production.
Keep secrets in Secret Manager
And grant the environment’s service account only the access it needs.
Monitor both pipelines and platform
Alert on failures, lateness, missing runs, and scheduler health.
Plan for recovery and upgrades
Take snapshots, keep everything in code, and rehearse.
Watch the cost
Right-size, use deferrable operators, delete idle environments, and set budget alerts.
Common mistakes
- A dynamic start date. Using the current time as the start date means the scheduler never sees a past interval to run.
- Confusing the logical date with the start time. Daily runs for Monday start on Tuesday, and many people expect otherwise.
- Big values in XComs. Slows the database and breaks later tasks.
- No timeouts. A hung task blocks its slot forever.
- Catchup surprises. A new DAG with an old start date launches dozens of runs at once.
- Editing DAGs in place during a run. Running tasks may mix old and new logic.
- Forgetting package conflicts. A new library breaks the environment’s own components.
- No alert for “did not run”. A DAG that failed to parse silently stops, and nobody notices for days.
A simple troubleshooting path
flowchart TD
A["A pipeline did not behave as expected"] --> B{"Is the DAG visible in the Airflow screen?"}
B -->|"No"| C["Check DAG import errors and parse logs"]
B -->|"Yes"| D{"Did a run start?"}
D -->|"No"| E["Check pause switch, schedule, start date, catchup, and scheduler health"]
D -->|"Yes"| F{"Is a task failed or stuck?"}
F -->|"Failed"| G["Read the task log and the error from the called service"]
F -->|"Queued too long"| H["Check pools, parallelism limits and worker scaling"]
F -->|"Running too long"| I["Check the called service and the task timeout"]
G --> J["Fix, clear the task and rerun the interval"]
H --> J
I --> J
Find the run and the task
Use the grid view in the Airflow screen to see exactly which interval and which step went wrong.
Read the task log
Most failures are explained there, often with the error returned by the Google Cloud service the task called.
Check platform health
If many unrelated tasks fail or start late, look at scheduler, worker, and database metrics, not at the individual DAG.
Fix the cause, not the symptom
Correct the code, permission, or limit that caused the failure, and not only clear the red box.
Rerun safely
Clear the failed tasks so the scheduler retries them for that interval. Idempotent tasks make this safe.
21Real-World Usage Scenarios
These illustrative scenarios show how the ideas combine in typical organizations. They are teaching examples, not descriptions of specific companies.
A retailer builds its nightly reporting
Shops drop daily sales files into storage. A Composer DAG waits for them with a deferrable sensor, loads them into BigQuery, runs quality checks, builds summary tables in parallel, refreshes dashboards, and posts a success message. If a file is late, the managers get an alert instead of wrong numbers, and the next run catches up safely because every step replaces its own day’s output.
A media company manages a data platform
Several teams contribute DAGs for ingest, transformation, and reporting. The platform team provides separate development, test, and production environments, a shared library of tested helpers, and a delivery pipeline. Data-aware scheduling lets reporting DAGs start automatically when the ingest DAGs update the datasets they need.
A bank runs a controlled machine learning pipeline
A weekly DAG prepares features, trains a model on a short-lived cluster, evaluates it against agreed thresholds, and deploys it only if it passes. Every run and its settings are recorded, giving auditors a clear history. The production environment is private, uses customer-managed keys, and allows only a small group to change DAGs, through reviewed code.
A startup saves money on processing clusters
Early on, the startup kept a large processing cluster running all day for a one-hour job. They changed the DAG to create the cluster at the start, run the job, and delete the cluster at the end, even when the job fails. The processing bill dropped sharply, and failures were easier to understand because every run started from a clean cluster.
An operations team automates housekeeping
A set of small DAGs archives old files, prunes old records, checks access permissions, and produces a weekly cost summary. Each is simple, but together they replace a pile of forgotten scripts with workflows that have owners, alerts, and a visible history.
A team recovers from a regional problem
A team kept their DAGs and environment settings in code and took regular snapshots into a bucket in another region. When their main region had an extended problem, they created a new environment elsewhere, loaded the latest snapshot, and let the scheduler resume. Because tasks were idempotent, the intervals affected by the outage were rerun with no duplicates.
22Frequently Asked Questions
Quick answers to the questions beginners ask most often.
23Summary and Key Takeaways
If you remember only a few things from this guide, remember these.
Cloud Composer is Google Cloud’s managed Apache Airflow. You describe workflows as Python code, and Composer schedules them, runs them on managed workers, retries failures, records every run, and shows it all on one screen. It works best as a conductor that starts and watches jobs in other services, with idempotent tasks, safe delivery through a pipeline, tight security, steady monitoring, and an eye on cost.
Key Takeaways
- Managed Airflow. Cloud Composer runs Apache Airflow for you, so you write DAGs and Google runs the scheduler, workers, database, and web screen.
- Orchestrate, do not process. Tasks should start and watch jobs in BigQuery, Dataflow, Dataproc, and other services, and not move large data through workers.
- Make tasks idempotent. Use the run’s logical date and replace each interval’s output, so retries, reruns, and backfills are safe.
- Deliver like software. Keep DAGs in version control, test them, and promote them through development, test, and production environments.
- Secure by design. Use least-privilege service accounts, Secret Manager, private networking where needed, and separate environments by trust.
- Watch pipelines and platform. Alert on failures, lateness, missing runs, and scheduler health, and design alerts to avoid noise.
- Mind cost and the future. An environment costs money even when idle, so right-size it, use deferrable operators, delete what you do not need, and keep snapshots and code ready for recovery and upgrades.