airflow.providers.google.cloud.triggers.cloud_run

Module Contents

Classes

RunJobStatus

Enum to represent the status of a job run.

CloudRunJobFinishedTrigger

Cloud Run trigger to check if templated job has been finished.

Attributes

DEFAULT_BATCH_LOCATION

airflow.providers.google.cloud.triggers.cloud_run.DEFAULT_BATCH_LOCATION = 'us-central1'[source]
class airflow.providers.google.cloud.triggers.cloud_run.RunJobStatus[source]

Bases: enum.Enum

Enum to represent the status of a job run.

SUCCESS = 'Success'[source]
FAIL = 'Fail'[source]
TIMEOUT = 'Timeout'[source]
class airflow.providers.google.cloud.triggers.cloud_run.CloudRunJobFinishedTrigger(operation_name, job_name, project_id, location=DEFAULT_BATCH_LOCATION, gcp_conn_id='google_cloud_default', impersonation_chain=None, polling_period_seconds=10, timeout=None)[source]

Bases: airflow.triggers.base.BaseTrigger

Cloud Run trigger to check if templated job has been finished.

Parameters
  • operation_name (str) – Required. Name of the operation.

  • job_name (str) – Required. Name of the job.

  • project_id (str | None) – Required. the Google Cloud project ID in which the job was started.

  • location (str) – Optional. the location where job is executed. If set to None then the value of DEFAULT_BATCH_LOCATION will be used.

  • 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).

  • poll_sleep – Polling period in seconds to check for the status.

Timeout

The time to wait before failing the operation.

serialize()[source]

Serializes class arguments and classpath.

async run()[source]

Run the trigger in an asynchronous context.

The trigger should yield an Event whenever it wants to fire off an event, and return None if it is finished. Single-event triggers should thus yield and then immediately return.

If it yields, it is likely that it will be resumed very quickly, but it may not be (e.g. if the workload is being moved to another triggerer process, or a multi-event trigger was being used for a single-event task defer).

In either case, Trigger classes should assume they will be persisted, and then rely on cleanup() being called when they are no longer needed.

Was this entry helpful?