Your team has packaged a nightly Apache Beam batch pipeline as a Dataflow Flex Template located at gs://analytics-pipelines/daily-etl.json. You need to expand an existing Cloud Composer DAG so that:
input_path and load_date values are passed to the template at run time
the Composer worker releases its slot immediately after the job is launched, yet downstream tasks must wait until the Dataflow job finishes successfully
any job still running after 6 hours is cancelled automatically to control costs
Which solution meets these requirements while requiring the least custom code?
Use DataflowStartFlexTemplateOperator with wait_until_finished=True and set its timeout to 6 hours, allowing the operator itself to block until completion or error.
Start the job with DataflowStartFlexTemplateOperator (wait_until_finished=False), passing input_path and load_date through the operator's body; chain a DataflowJobStatusSensor with a 6-hour timeout, and on sensor failure run a DataflowStopJobOperator to cancel the job before downstream tasks.
Invoke the template from a BashOperator that calls gcloud dataflow flex-template run, then use a PythonSensor to poll Cloud Logging for completion and a BashOperator to cancel the job if polling exceeds 6 hours.
Launch the template with DataflowTemplateOperator and set max_num_workers=0 so autoscaling stops the job after 6 hours, allowing downstream tasks to start immediately.
DataflowStartFlexTemplateOperator submits the Flex Template and exposes the wait_until_finished flag. Setting wait_until_finished to False causes the task to return as soon as the job is submitted, freeing the worker slot. Runtime values such as input_path and load_date are supplied in the body.launch_parameter.fields of the operator. A downstream DataflowJobStatusSensor, configured with a 6-hour timeout and soft_fail=False, blocks subsequent tasks until the Dataflow job reaches the DONE state. If the sensor fails on timeout, a DataflowStopJobOperator triggered by a failure-only rule cancels the running job, satisfying the automatic-cancellation requirement. The other options either block the worker, omit a guaranteed cancellation step, or rely on custom shell scripts.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the DataflowStartFlexTemplateOperator?
Open an interactive chat with Bash
How does DataflowJobStatusSensor work in Cloud Composer?
Open an interactive chat with Bash
Why is the wait_until_finished flag important in Dataflow workflows?
Open an interactive chat with Bash
What is the DataflowStartFlexTemplateOperator?
Open an interactive chat with Bash
What does the DataflowJobStatusSensor do?
Open an interactive chat with Bash
What is the purpose of the DataflowStopJobOperator?
Open an interactive chat with Bash
GCP Professional Data Engineer
Maintaining and automating data workloads
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99 $11.99
$11.99/mo
Billed monthly, Cancel any time.
$19.99 after promotion ends
3 Month Pass
$44.99 $26.99
$8.99/mo
One time purchase of $26.99, Does not auto-renew.
$44.99 after promotion ends
Save $18!
MOST POPULAR
Annual Pass
$119.99 $71.99
$5.99/mo
One time purchase of $71.99, Does not auto-renew.
$119.99 after promotion ends
Save $48!
BEST DEAL
Lifetime Pass
$189.99 $113.99
One time purchase, Good for life.
Save $76!
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .