Starts flex templates with the Dataflow pipeline.

View on GitHub

Last Updated: Feb. 25, 2023

Access Instructions

Install the Google provider package into your Airflow environment.

Import the module into your DAG file and instantiate it with your desired params.


bodyThe request body. See:
locationThe location of the Dataflow job (for example europe-west1)
project_idThe ID of the GCP project that owns the job.
gcp_conn_idThe connection ID to use connecting to Google Cloud Platform.
delegate_toThe account to impersonate, if any. For this to work, the service account making the request must have domain-wide delegation enabled.
drain_pipelineOptional, set to True if want to stop streaming job by draining it instead of canceling during killing task instance. See:
cancel_timeoutHow long (in seconds) operator should wait for the pipeline to be successfully cancelled when task is being killed.
wait_until_finished(Optional) If True, wait for the end of pipeline execution before exiting. If False, only submits job. If None, default behavior. The default behavior depends on the type of pipeline: for the streaming pipeline, wait for jobs to start, for the batch pipeline, wait for the jobs to complete. Warning You cannot call PipelineResult.wait_until_finish method in your pipeline code for the operator to work properly. i. e. you must use asynchronous execution. Otherwise, your pipeline will always wait until finished. For more information, look at: Asynchronous execution The process of starting the Dataflow job in Airflow consists of two steps: running a subprocess and reading the stderr/stderr log for the job id. loop waiting for the end of the job ID from the previous step. This loop checks the status of the job. Step two is started just after step one has finished, so if you have wait_until_finished in your pipeline code, step two will not start until the process stops. When this process stops, steps two will run, but it will only execute one iteration as the job will be in a terminal state. If you in your pipeline do not call the wait_for_pipeline method but pass wait_until_finish=True to the operator, the second loop will wait for the job’s terminal state. If you in your pipeline do not call the wait_for_pipeline method, and pass wait_until_finish=False to the operator, the second loop will check once is job not in terminal state and exit the loop.
impersonation_chainOptional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).
deferrableRun operator in the deferrable mode.


Starts flex templates with the Dataflow pipeline.

See also

For more information on how to use this operator, take a look at the guide: Templated jobs

Was this page helpful?