airflow.providers.google.cloud.sensors.dataflow
¶
This module contains a Google Cloud Dataflow sensor.
Module Contents¶
Classes¶
Checks for the status of a job in Google Cloud Dataflow. |
|
Checks for metrics associated with a single job in Google Cloud Dataflow. |
|
Checks for job messages associated with a single job in Google Cloud Dataflow. |
|
Checks for autoscaling events associated with a single job in Google Cloud Dataflow. |
- class airflow.providers.google.cloud.sensors.dataflow.DataflowJobStatusSensor(*, job_id, expected_statuses, project_id=PROVIDE_PROJECT_ID, location=DEFAULT_DATAFLOW_LOCATION, gcp_conn_id='google_cloud_default', impersonation_chain=None, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), poll_interval=10, **kwargs)[source]¶
Bases:
airflow.sensors.base.BaseSensorOperator
Checks for the status of a job in Google Cloud Dataflow.
See also
For more information on how to use this operator, take a look at the guide: Sensors
- Parameters
job_id (str) – ID of the job to be checked.
expected_statuses (set[str] | str) – The expected state(s) of the operation. See: https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobState
project_id (str) – Optional, the Google Cloud project ID in which to start a job. If set to None or missing, the default project_id from the Google Cloud connection is used.
location (str) – The location of the Dataflow job (for example europe-west1). See: https://cloud.google.com/dataflow/docs/concepts/regional-endpoints
gcp_conn_id (str) – The connection ID to use connecting to Google Cloud.
impersonation_chain (str | Sequence[str] | None) – Optional 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).
deferrable (bool) – If True, run the sensor in the deferrable mode.
poll_interval (int) – Time (seconds) to wait between two consecutive calls to check the job.
- class airflow.providers.google.cloud.sensors.dataflow.DataflowJobMetricsSensor(*, job_id, callback=None, fail_on_terminal_state=True, project_id=PROVIDE_PROJECT_ID, location=DEFAULT_DATAFLOW_LOCATION, gcp_conn_id='google_cloud_default', impersonation_chain=None, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), poll_interval=10, **kwargs)[source]¶
Bases:
airflow.sensors.base.BaseSensorOperator
Checks for metrics associated with a single job in Google Cloud Dataflow.
See also
For more information on how to use this operator, take a look at the guide: Sensors
- Parameters
job_id (str) – ID of the job to be checked.
callback (Callable | None) – callback which is called with list of read job metrics See: https://cloud.google.com/dataflow/docs/reference/rest/v1b3/MetricUpdate
fail_on_terminal_state (bool) – If set to true sensor will raise Exception when job is in terminal state
project_id (str) – Optional, the Google Cloud project ID in which to start a job. If set to None or missing, the default project_id from the Google Cloud connection is used.
location (str) – The location of the Dataflow job (for example europe-west1). See: https://cloud.google.com/dataflow/docs/concepts/regional-endpoints
gcp_conn_id (str) – The connection ID to use connecting to Google Cloud.
impersonation_chain (str | Sequence[str] | None) – Optional 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).
deferrable (bool) – If True, run the sensor in the deferrable mode.
poll_interval (int) – Time (seconds) to wait between two consecutive calls to check the job.
- execute_complete(context, event)[source]¶
Execute this method when the task resumes its execution on the worker after deferral.
If the trigger returns an event with success status - passes the event result to the callback function. Returns the event result if no callback function is provided.
If the trigger returns an event with error status - raises an exception.
- class airflow.providers.google.cloud.sensors.dataflow.DataflowJobMessagesSensor(*, job_id, callback=None, fail_on_terminal_state=True, project_id=PROVIDE_PROJECT_ID, location=DEFAULT_DATAFLOW_LOCATION, gcp_conn_id='google_cloud_default', impersonation_chain=None, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), poll_interval=10, **kwargs)[source]¶
Bases:
airflow.sensors.base.BaseSensorOperator
Checks for job messages associated with a single job in Google Cloud Dataflow.
See also
For more information on how to use this operator, take a look at the guide: Sensors
- Parameters
job_id (str) – ID of the Dataflow job to be checked.
callback (Callable | None) – a function that can accept a list of serialized job messages. It can do whatever you want it to do. If the callback function is not provided, then on successful completion the task will exit with True value. For more info about the job message content see: https://cloud.google.com/python/docs/reference/dataflow/latest/google.cloud.dataflow_v1beta3.types.JobMessage
fail_on_terminal_state (bool) – If set to True the sensor will raise an exception when the job reaches a terminal state. No job messages will be returned.
project_id (str) – Optional, the Google Cloud project ID in which to start a job. If set to None or missing, the default project_id from the Google Cloud connection is used.
location (str) – The location of the Dataflow job (for example europe-west1). If set to None then the value of DEFAULT_DATAFLOW_LOCATION will be used. See: https://cloud.google.com/dataflow/docs/concepts/regional-endpoints
gcp_conn_id (str) – The connection ID to use connecting to Google Cloud.
impersonation_chain (str | Sequence[str] | None) – Optional 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).
deferrable (bool) – If True, run the sensor in the deferrable mode.
poll_interval (int) – Time (seconds) to wait between two consecutive calls to check the job.
- execute_complete(context, event)[source]¶
Execute this method when the task resumes its execution on the worker after deferral.
If the trigger returns an event with success status - passes the event result to the callback function. Returns the event result if no callback function is provided.
If the trigger returns an event with error status - raises an exception.
- class airflow.providers.google.cloud.sensors.dataflow.DataflowJobAutoScalingEventsSensor(*, job_id, callback=None, fail_on_terminal_state=True, project_id=PROVIDE_PROJECT_ID, location=DEFAULT_DATAFLOW_LOCATION, gcp_conn_id='google_cloud_default', impersonation_chain=None, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), poll_interval=60, **kwargs)[source]¶
Bases:
airflow.sensors.base.BaseSensorOperator
Checks for autoscaling events associated with a single job in Google Cloud Dataflow.
See also
For more information on how to use this operator, take a look at the guide: Sensors
- Parameters
job_id (str) – ID of the Dataflow job to be checked.
callback (Callable | None) – a function that can accept a list of serialized autoscaling events. It can do whatever you want it to do. If the callback function is not provided, then on successful completion the task will exit with True value. For more info about the autoscaling event content see: https://cloud.google.com/python/docs/reference/dataflow/latest/google.cloud.dataflow_v1beta3.types.AutoscalingEvent
fail_on_terminal_state (bool) – If set to True the sensor will raise an exception when the job reaches a terminal state. No autoscaling events will be returned.
project_id (str) – Optional, the Google Cloud project ID in which to start a job. If set to None or missing, the default project_id from the Google Cloud connection is used.
location (str) – The location of the Dataflow job (for example europe-west1). If set to None then the value of DEFAULT_DATAFLOW_LOCATION will be used. See: https://cloud.google.com/dataflow/docs/concepts/regional-endpoints
gcp_conn_id (str) – The connection ID to use connecting to Google Cloud.
impersonation_chain (str | Sequence[str] | None) – Optional 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).
deferrable (bool) – If True, run the sensor in the deferrable mode.
poll_interval (int) – Time (seconds) to wait between two consecutive calls to check the job.
- execute_complete(context, event)[source]¶
Execute this method when the task resumes its execution on the worker after deferral.
If the trigger returns an event with success status - passes the event result to the callback function. Returns the event result if no callback function is provided.
If the trigger returns an event with error status - raises an exception.