astronomer.providers.google.cloud.triggers.gcs

Classes

GCSBlobTrigger

A trigger that fires and it finds the requested file or folder present in the given bucket.

GCSPrefixBlobTrigger

A trigger that fires and it looks for all the objects in the given bucket

GCSUploadSessionTrigger

Checks for changes in the number of objects at prefix in Google Cloud Storage

GCSCheckBlobUpdateTimeTrigger

A trigger that makes an async call to GCS to check whether the object is updated in a bucket.

Module Contents

class astronomer.providers.google.cloud.triggers.gcs.GCSBlobTrigger(bucket, object_name, poke_interval, google_cloud_conn_id, hook_params)[source]

Bases: airflow.triggers.base.BaseTrigger

A trigger that fires and it finds the requested file or folder present in the given bucket.

This class is deprecated and will be removed in 2.0.0. Use :class: ~airflow.providers.google.cloud.triggers.gcs.GCSBlobTrigger instead

Parameters:
  • bucket (str) – the bucket in the google cloud storage where the objects are residing.

  • object_name (str) – the file or folder present in the bucket

  • google_cloud_conn_id (str) – reference to the Google Connection

  • poke_interval (float) – polling period in seconds to check for file/folder

bucket
object_name
poke_interval
google_cloud_conn_id: str
hook_params
serialize()[source]

Serializes GCSBlobTrigger arguments and classpath.

async run()[source]

Simple loop until the relevant file/folder is found.

class astronomer.providers.google.cloud.triggers.gcs.GCSPrefixBlobTrigger(bucket, prefix, poke_interval, google_cloud_conn_id, hook_params)[source]

Bases: GCSBlobTrigger

A trigger that fires and it looks for all the objects in the given bucket which matches the given prefix if not found sleep for certain interval and checks again.

This class is deprecated and will be removed in 2.0.0. Use :class: ~airflow.providers.google.cloud.triggers.gcs.GCSPrefixBlobTrigger instead

Parameters:
  • bucket (str) – the bucket in the google cloud storage where the objects are residing.

  • prefix (str) – The prefix of the blob_names to match in the Google cloud storage bucket

  • google_cloud_conn_id (str) – reference to the Google Connection

  • poke_interval (float) – polling period in seconds to check

prefix
serialize()[source]

Serializes GCSPrefixBlobTrigger arguments and classpath.

async run()[source]

Simple loop until the matches are found for the given prefix on the bucket.

class astronomer.providers.google.cloud.triggers.gcs.GCSUploadSessionTrigger(bucket, prefix, poke_interval, google_cloud_conn_id, hook_params, inactivity_period=60 * 60, min_objects=1, previous_objects=None, allow_delete=True)[source]

Bases: GCSPrefixBlobTrigger

Checks for changes in the number of objects at prefix in Google Cloud Storage bucket and returns Trigger Event if the inactivity period has passed with no increase in the number of objects.

This class is deprecated and will be removed in 2.0.0. Use :class: ~airflow.providers.google.cloud.triggers.gcs.GCSUploadSessionTrigger instead

Parameters:
  • bucket (str) – The Google Cloud Storage bucket where the objects are. expected.

  • prefix (str) – The name of the prefix to check in the Google cloud storage bucket.

  • poke_interval (float) – polling period in seconds to check

  • inactivity_period (float) – The total seconds of inactivity to designate an upload session is over. Note, this mechanism is not real time and this operator may not return until a interval after this period has passed with no additional objects sensed.

  • min_objects (int) – The minimum number of objects needed for upload session to be considered valid.

  • previous_objects (set[str] | None) – The set of object ids found during the last poke.

  • allow_delete (bool) – Should this sensor consider objects being deleted between intervals valid behavior. If true a warning message will be logged when this happens. If false an error will be raised.

  • google_cloud_conn_id (str) – The connection ID to use when connecting to Google Cloud Storage.

inactivity_period
min_objects
previous_objects
inactivity_seconds = 0.0
allow_delete
last_activity_time: datetime.datetime | None = None
serialize()[source]

Serializes GCSUploadSessionTrigger arguments and classpath.

async run()[source]

Simple loop until no change in any new files or deleted in list blob is found for the inactivity_period.

class astronomer.providers.google.cloud.triggers.gcs.GCSCheckBlobUpdateTimeTrigger(bucket, object_name, ts, poke_interval, google_cloud_conn_id, hook_params)[source]

Bases: airflow.triggers.base.BaseTrigger

A trigger that makes an async call to GCS to check whether the object is updated in a bucket.

This class is deprecated and will be removed in 2.0.0. Use :class: ~airflow.providers.google.cloud.triggers.gcs.GCSCheckBlobUpdateTimeTrigger instead

Parameters:
  • bucket (str) – google cloud storage bucket name cloud storage where the objects are residing.

  • object_name (str) – the file or folder present in the bucket

  • ts (datetime.datetime) – datetime object

  • poke_interval (float) – polling period in seconds to check for file/folder

  • google_cloud_conn_id (str) – reference to the Google Connection

  • hook_params (dict[str, Any]) – DIct object has delegate_to and impersonation_chain

bucket
object_name
ts
poke_interval
google_cloud_conn_id: str
hook_params
serialize()[source]

Serializes GCSCheckBlobUpdateTimeTrigger arguments and classpath.

async run()[source]

Simple loop until the object updated time is greater than ts datetime in bucket.