Complete the airflow survey & get a free airflow 3 certification!

airflow.providers.google.cloud.bundles.gcs

Classes

GCSDagBundle

GCS Dag bundle - exposes a directory in GCS as a Dag bundle.

Module Contents

class airflow.providers.google.cloud.bundles.gcs.GCSDagBundle(*, gcp_conn_id=GoogleBaseHook.default_conn_name, bucket_name, prefix='', **kwargs)[source]

Bases: airflow.dag_processing.bundles.base.BaseDagBundle

GCS Dag bundle - exposes a directory in GCS as a Dag bundle.

This allows Airflow to load Dags directly from a GCS bucket.

Parameters:
  • gcp_conn_id (str) – Airflow connection ID for GCS. Defaults to GoogleBaseHook.default_conn_name.

  • bucket_name (str) – The name of the GCS bucket containing the Dag files.

  • prefix (str) – Optional subdirectory within the GCS bucket where the Dags are stored. If None, Dags are assumed to be at the root of the bucket (Optional).

supports_versioning = False[source]
gcp_conn_id = 'google_cloud_default'[source]
bucket_name[source]
prefix = ''[source]
gcs_dags_dir: pathlib.Path[source]
initialize()[source]

Initialize the bundle.

This method is called by the DAG processor and worker before the bundle is used, and allows for deferring expensive operations until that point in time. This will only be called when Airflow needs the bundle files on disk - some uses only need to call the view_url method, which can run without initializing the bundle.

This method must ultimately be safe to call concurrently from different threads or processes. If it isn’t naturally safe, you’ll need to make it so with some form of locking. There is a lock context manager on this class available for this purpose.

If you override this method, ensure you call super().initialize() at the end of your method, after the bundle is initialized, not the beginning.

property gcs_hook[source]
__repr__()[source]
get_current_version()[source]

Return the current version of the Dag bundle. Currently not supported.

property path: pathlib.Path[source]

Return the local path to the Dag files.

refresh()[source]

Refresh the Dag bundle by re-downloading the Dags from GCS.

view_url(version=None)[source]

Return a URL for viewing the Dags in GCS. Currently, versioning is not supported.

This method is deprecated and will be removed when the minimum supported Airflow version is 3.1. Use view_url_template instead.

view_url_template()[source]

Return a URL for viewing the Dags in GCS. Currently, versioning is not supported.

Was this entry helpful?