airflow.providers.google.cloud.sensors.cloud_composer

This module contains a Cloud Composer sensor.

Module Contents

Classes

CloudComposerDAGRunSensor

Check if a DAG run has completed.

class airflow.providers.google.cloud.sensors.cloud_composer.CloudComposerDAGRunSensor(*, project_id, region, environment_id, composer_dag_id, allowed_states=None, execution_range=None, 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

Check if a DAG run has completed.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • environment_id (str) – The name of the Composer environment.

  • composer_dag_id (str) – The ID of executable DAG.

  • allowed_states (collections.abc.Iterable[str] | None) – Iterable of allowed states, default is ['success'].

  • execution_range (datetime.timedelta | list[datetime.datetime] | None) – execution DAGs time range. Sensor checks DAGs states only for DAGs which were started in this time range. For yesterday, use [positive!] datetime.timedelta(days=1). For future, use [negative!] datetime.timedelta(days=-1). For specific time, use list of datetimes [datetime(2024,3,22,11,0,0), datetime(2024,3,22,12,0,0)]. Or [datetime(2024,3,22,0,0,0)] in this case sensor will check for states from specific time in the past till current time execution. Default value datetime.timedelta(days=1).

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | collections.abc.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).

  • poll_interval (int) – Optional: Control the rate of the poll for the result of deferrable run.

  • deferrable (bool) – Run sensor in deferrable mode.

template_fields = ('project_id', 'region', 'environment_id', 'composer_dag_id', 'impersonation_chain')[source]
poke(context)[source]

Override when deriving this class.

execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

execute_complete(context, event)[source]

Was this entry helpful?