airflow.providers.google.cloud.sensors.dataflow

This module contains a Google Cloud Dataflow sensor.

Module Contents

Classes

DataflowJobStatusSensor

Checks for the status of a job in Google Cloud Dataflow.

DataflowJobMetricsSensor

Checks the metrics of a job in Google Cloud Dataflow.

DataflowJobMessagesSensor

Checks for the job message in Google Cloud Dataflow.

DataflowJobAutoScalingEventsSensor

Checks for the job autoscaling event in Google Cloud Dataflow.

class airflow.providers.google.cloud.sensors.dataflow.DataflowJobStatusSensor(*, job_id, expected_statuses, project_id=None, location=DEFAULT_DATAFLOW_LOCATION, gcp_conn_id='google_cloud_default', delegate_to=None, impersonation_chain=None, **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 (Union[Set[str], str]) – The expected state of the operation. See: https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobState

  • project_id (Optional[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.

  • delegate_to (Optional[str]) – The account to impersonate using domain-wide delegation of authority, if any. For this to work, the service account making the request must have domain-wide delegation enabled. See: https://developers.google.com/identity/protocols/oauth2/service-account#delegatingauthority

  • impersonation_chain (Optional[Union[str, Sequence[str]]]) – 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).

template_fields :Sequence[str] = ['job_id'][source]
poke(context)[source]

Function that the sensors defined while deriving this class should override.

class airflow.providers.google.cloud.sensors.dataflow.DataflowJobMetricsSensor(*, job_id, callback, fail_on_terminal_state=True, project_id=None, location=DEFAULT_DATAFLOW_LOCATION, gcp_conn_id='google_cloud_default', delegate_to=None, impersonation_chain=None, **kwargs)[source]

Bases: airflow.sensors.base.BaseSensorOperator

Checks the metrics 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.

  • callback (Callable[[dict], bool]) – 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 (Optional[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.

  • delegate_to (Optional[str]) – The account to impersonate using domain-wide delegation of authority, if any. For this to work, the service account making the request must have domain-wide delegation enabled.

  • impersonation_chain (Optional[Union[str, Sequence[str]]]) – 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).

template_fields :Sequence[str] = ['job_id'][source]
poke(context)[source]

Function that the sensors defined while deriving this class should override.

class airflow.providers.google.cloud.sensors.dataflow.DataflowJobMessagesSensor(*, job_id, callback, fail_on_terminal_state=True, project_id=None, location=DEFAULT_DATAFLOW_LOCATION, gcp_conn_id='google_cloud_default', delegate_to=None, impersonation_chain=None, **kwargs)[source]

Bases: airflow.sensors.base.BaseSensorOperator

Checks for the job message 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) – 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 (Optional[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) – Job location.

  • gcp_conn_id (str) – The connection ID to use connecting to Google Cloud.

  • delegate_to (Optional[str]) – The account to impersonate using domain-wide delegation of authority, if any. For this to work, the service account making the request must have domain-wide delegation enabled.

  • impersonation_chain (Optional[Union[str, Sequence[str]]]) – 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).

template_fields :Sequence[str] = ['job_id'][source]
poke(context)[source]

Function that the sensors defined while deriving this class should override.

class airflow.providers.google.cloud.sensors.dataflow.DataflowJobAutoScalingEventsSensor(*, job_id, callback, fail_on_terminal_state=True, project_id=None, location=DEFAULT_DATAFLOW_LOCATION, gcp_conn_id='google_cloud_default', delegate_to=None, impersonation_chain=None, **kwargs)[source]

Bases: airflow.sensors.base.BaseSensorOperator

Checks for the job autoscaling event 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) – 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 (Optional[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) – Job location.

  • gcp_conn_id (str) – The connection ID to use connecting to Google Cloud.

  • delegate_to (Optional[str]) – The account to impersonate using domain-wide delegation of authority, if any. For this to work, the service account making the request must have domain-wide delegation enabled.

  • impersonation_chain (Optional[Union[str, Sequence[str]]]) – 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).

template_fields :Sequence[str] = ['job_id'][source]
poke(context)[source]

Function that the sensors defined while deriving this class should override.

Was this entry helpful?