Professional Data Engineer · Domain 2: Ingesting and processing the data · 25% of the exam
Task 2.3: Deploying and operationalizing the pipelines.
Automating and orchestrating jobs with Managed Service for Apache Airflow and Workflows, and continuous integration and deployment for pipelines, DAGs and SQL workflows.
Study it
Orchestration with Managed Service for Apache Airflow and Workflows
Try each one before opening the answer. Every option is explained, with the Google Cloud documentation page that proves it.
Question 1 · choose 1
An operations team must launch a Dataflow pipeline from the console with a few parameters and no development environment. Depending on one parameter, the pipeline reads from Pub/Sub or from Cloud Storage, so its job graph differs between launches, and it needs Python packages that are not on PyPI. What should the developers produce?
AA classic template with each runtime parameter wrapped in a ValueProvider
BA Flex Template whose container image includes the custom packages
CA Google-provided template with a JavaScript UDF that selects the source
DA Managed Airflow DAG that runs the pipeline code in a Python operator
Show the answer and why
AA classic template with each runtime parameter wrapped in a ValueProvider
Incorrect
A classic template stores one serialized, static job graph, so it cannot choose a different source at launch.
BA Flex Template whose container image includes the custom packages
Correct
A Flex Template is packaged as a container image and builds the job graph at launch from the runtime parameters, so it can pick its I/O, and the image carries the packages.
CA Google-provided template with a JavaScript UDF that selects the source
Incorrect
Google-provided templates have fixed sources and sinks; a UDF transforms elements, it does not change what the pipeline reads from.
DA Managed Airflow DAG that runs the pipeline code in a Python operator
Incorrect
Running the code from Airflow needs an environment and still has to package the dependencies; it is not a template that operations can launch in Dataflow.
Classic templates contain a serialized job graph and need ValueProvider for runtime parameters. Flex Templates package the pipeline as a Docker image in Artifact Registry with a template spec in Cloud Storage, and the graph is built when the job is launched, so parameters can change the graph. Google recommends Flex Templates for new templates.
A streaming Dataflow job aggregates sensor data with keyed state. Developers fixed a bug in a parsing step and renamed it from Parse to ParseV2; the windowing and the coders are unchanged. The fix must go live without losing buffered state or in-flight data. What should the data engineer do?
ADrain the job, then start the new code as a new job on the same subscription
BCancel the job, then launch the new version under the same job name
CUpdate the job in place and let Dataflow match the renamed step itself
DLaunch a replacement job with --update and a transform name mapping
Show the answer and why
ADrain the job, then start the new code as a new job on the same subscription
Incorrect
Draining closes open windows early, fires their triggers and stops the job; the new job does not inherit that state, so the aggregations restart from nothing.
BCancel the job, then launch the new version under the same job name
Incorrect
Cancelling stops processing at once and drops buffered data and state.
CUpdate the job in place and let Dataflow match the renamed step itself
Incorrect
Dataflow matches steps by name; without a mapping for the renamed transform, the compatibility check fails and the update is rejected.
DLaunch a replacement job with --update and a transform name mapping
Correct
An update replaces the job while preserving its intermediate state and in-flight data, and the name mapping tells Dataflow that ParseV2 is the old Parse step.
Updating a streaming job launches a replacement with the same name; if the compatibility check passes, the old job stops and its state and buffered records carry over. Renamed transforms need --transformNameMapping (Java) or --transform_name_mapping (Python and Go). Drain and cancel both end the job, so the next job starts without its state.
A Managed Airflow DAG must run a vendor's command-line tool. The tool is a compiled binary that needs system libraries missing from the Airflow worker image, and the vendor publishes a Docker image that contains it. What is the recommended way to run this task?
ARun the vendor's image as a task with the KubernetesPodOperator
BAdd the tool to the environment's custom PyPI packages list
CUse a BashOperator that downloads and runs the binary each time
DUse a PythonVirtualenvOperator that installs the tool's wrapper
Show the answer and why
ARun the vendor's image as a task with the KubernetesPodOperator
Correct
KubernetesPodOperator runs the task in a pod from any image, which Google recommends for binary dependencies that the worker image does not have.
BAdd the tool to the environment's custom PyPI packages list
Incorrect
PyPI packages install Python libraries into the environment; they do not bring the system libraries that a compiled binary needs.
CUse a BashOperator that downloads and runs the binary each time
Incorrect
The binary would still run on the worker image, which lacks its system libraries, and every run would download it again.
DUse a PythonVirtualenvOperator that installs the tool's wrapper
Incorrect
A virtualenv isolates Python packages only; the missing system libraries are still missing.
Python dependencies belong in the environment's PyPI packages, but custom binaries and system libraries that the stock worker image lacks are a case for the KubernetesPodOperator, which runs the task in its own pod from a container image that already holds them.
When an order is placed, a process must call a fraud-scoring Cloud Run service, write the result through the BigQuery API and notify a partner over HTTP, retrying failed calls with backoff. It runs tens of thousands of times a day, must start within milliseconds, and the company wants to pay only for what runs, with no environment to keep up. What should orchestrate it?
AA Managed Airflow DAG triggered once for each order
BA Cloud Scheduler job that runs the three calls each minute
CA Dataflow streaming job that calls the services per element
DA workflow in Workflows that calls each service in turn
Show the answer and why
AA Managed Airflow DAG triggered once for each order
Incorrect
Managed Airflow is built for data pipelines as DAGs, starts tasks in seconds and bills for provisioned capacity, a poor fit for many short service calls.
BA Cloud Scheduler job that runs the three calls each minute
Incorrect
A schedule runs on the clock, not when an order is placed, and has no steps or retries across calls.
CA Dataflow streaming job that calls the services per element
Incorrect
Dataflow processes data streams; using it to sequence API calls with retries means writing and running a pipeline for an orchestration task.
DA workflow in Workflows that calls each service in turn
Correct
Workflows orchestrates HTTP-based services with retries and error handling, starts in milliseconds, scales to zero and bills per step executed.
Google's guidance separates the two orchestrators: Workflows for service orchestration of HTTP and API calls (serverless, millisecond latency, usage-based billing), and Managed Airflow for data-driven ETL and ELT workflows written as Python DAGs, with backfills and reruns.
A team needs one SQL statement to run in BigQuery every night at 02:00, which rebuilds a summary table from a single source table. There are no other steps or dependencies, and the team wants the least setup and cost. What should the data engineer use?
AA Managed Airflow environment with a DAG that runs the query
BA BigQuery scheduled query with a destination table
CA Dataflow batch job launched from a template each night
DA Cloud Run job that calls the BigQuery API on a schedule
Show the answer and why
AA Managed Airflow environment with a DAG that runs the query
Incorrect
An environment adds provisioned cost and upkeep for a single statement with no dependencies.
BA BigQuery scheduled query with a destination table
Correct
Scheduled queries run a query on a recurring schedule in BigQuery itself, with nothing else to deploy.
CA Dataflow batch job launched from a template each night
Incorrect
Dataflow would read the data out of BigQuery and write it back, which is more moving parts than one SQL statement needs.
DA Cloud Run job that calls the BigQuery API on a schedule
Incorrect
A custom job works but is code to build and maintain for what scheduled queries do natively.
Orchestration should fit the job. A single recurring statement is what BigQuery scheduled queries are for; Dataform or Managed Airflow become worth it when there are many dependent steps, tests or cross-system dependencies.
A team is adding automated tests to the CI/CD pipeline for its Dataflow jobs. It wants fast tests of each transform's logic on every commit, without Google Cloud resources, and a final check of the whole pipeline before a release reaches production. Which TWO practices match Google's guidance? (Choose TWO.)
ATest each release by running it on production input data in production
BWrite unit tests with TestPipeline and PAssert run on the Direct Runner
CSkip unit tests and rely on Dataflow job metrics after each deploy
DRun each unit test as a separate Dataflow job on the Dataflow Runner
ERun end-to-end tests on the Dataflow Runner in a preproduction project
Show the answer and why
ATest each release by running it on production input data in production
Incorrect
Testing in production risks production data; end-to-end tests belong in a preproduction environment.
BWrite unit tests with TestPipeline and PAssert run on the Direct Runner
Correct
Unit tests check DoFns and composite transforms with TestPipeline and PAssert on the Direct Runner, using small test data in local memory.
CSkip unit tests and rely on Dataflow job metrics after each deploy
Incorrect
Metrics after deployment find problems late, after bad output has been written.
DRun each unit test as a separate Dataflow job on the Dataflow Runner
Incorrect
Unit tests are meant to be fast and local; launching jobs for them is slow and costly.
ERun end-to-end tests on the Dataflow Runner in a preproduction project
Correct
End-to-end tests run the full pipeline on the Dataflow Runner in a preproduction environment that closely resembles production.
Google's testing guidance for Dataflow layers the tests: unit tests of transforms with TestPipeline and PAssert on the Direct Runner, integration tests of the whole pipeline, and end-to-end tests on the Dataflow Runner in preproduction, with artifacts promoted to production only when those pass.
A team runs Managed Airflow environments for development, test and production, created by hand in the console. They have drifted apart in configuration, and an auditor wants every change reviewed. The team wants the environments defined as code, reviewed in Git and applied the same way to each stage. What should the data engineer use?
ATerraform configurations for the environments, applied per stage
BEnvironment snapshots copied from production into the other stages
CA shared document listing each setting to apply by hand in the console
DOne shared environment for the three stages with separate DAG folders per stage
Show the answer and why
ATerraform configurations for the environments, applied per stage
Correct
Managed Airflow environments can be created and changed with Terraform, so the same reviewed code produces each stage's environment.
BEnvironment snapshots copied from production into the other stages
Incorrect
Snapshots save an environment's state for recovery or migration; they are not reviewed definitions of configuration.
CA shared document listing each setting to apply by hand in the console
Incorrect
Manual steps are how the environments drifted in the first place.
DOne shared environment for the three stages with separate DAG folders per stage
Incorrect
Sharing one environment removes the isolation between test and production rather than making the stages consistent.
Infrastructure as code turns environment configuration into reviewed, versioned text. Google documents creating Managed Airflow environments with Terraform, which also covers related resources such as service accounts and buckets.