DataflowTemplatedJobStartOperator
GoogleStart a Templated Cloud Dataflow job. The parameters of the operation will be passed to the job.
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.
Parameters
Documentation
Start a Templated Cloud Dataflow job. The parameters of the operation will be passed to the job.
See also
For more information on how to use this operator, take a look at the guide: Templated jobs
It’s a good practice to define dataflow_* parameters in the default_args of the dag like the project, zone and staging location.
See also
https://cloud.google.com/dataflow/docs/reference/rest/v1b3/LaunchTemplateParameters https://cloud.google.com/dataflow/docs/reference/rest/v1b3/RuntimeEnvironment
default_args = {"dataflow_default_options": {"zone": "europe-west1-d","tempLocation": "gs://my-staging-bucket/staging/",}}
You need to pass the path to your dataflow template as a file reference with the template
parameter. Use parameters
to pass on parameters to your job. Use environment
to pass on runtime environment variables to your job.
t1 = DataflowTemplatedJobStartOperator(task_id="dataflow_example",template="{{var.value.gcp_dataflow_base}}",parameters={"inputFile": "gs://bucket/input/my_input.txt","outputFile": "gs://bucket/output/my_output.txt",},gcp_conn_id="airflow-conn-id",dag=my_dag,)
template
, dataflow_default_options
, parameters
, and job_name
are templated, so you can use variables in them.
Note that dataflow_default_options
is expected to save high-level options for project information, which apply to all dataflow operators in the DAG.
See also
https://cloud.google.com/dataflow/docs/reference/rest/v1b3 /LaunchTemplateParameters https://cloud.google.com/dataflow/docs/reference/rest/v1b3/RuntimeEnvironment For more detail on job template execution have a look at the reference: https://cloud.google.com/dataflow/docs/templates/executing-templates
- param deferrable
Run operator in the deferrable mode.