Registry / gcp / google-cloud-orchestration-airflow

google-cloud-orchestration-airflow

JSON →
library1.20.0pypypi✓ verified 47d ago

Cloud Composer is a fully managed Apache Airflow service that simplifies the creation, scheduling, monitoring, and management of workflows. This client library provides programmatic access to the Google Cloud Orchestration Airflow API, allowing Python developers to interact with Cloud Composer environments and their underlying Airflow instances. The current version is 1.20.0, and Google Cloud client libraries typically follow a continuous release cadence with frequent updates for new features, bug fixes, and API changes.

gcpdataworkflowaws
pip install google-cloud-orchestration-airflow
Install & Compatibility
Where this runs
tested against v1.21.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
4/5 runs
4/5 runs
py 3.11
4/5 runs
4/5 runs
py 3.12
4/5 runs
4/5 runs
py 3.13
4/5 runs
4/5 runs
py 3.9
4/5 runs
4/5 runs
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EnvironmentsClient
from google.cloud.orchestration.airflow.service import EnvironmentsClient
from google.cloud.orchestration.airflow.service.v1 import EnvironmentsClient

This quickstart code initializes the `EnvironmentsClient` and attempts to list all Cloud Composer environments within a specified Google Cloud project and location. Authentication is handled implicitly by the Google Cloud client libraries, typically through environment variables (e.g., `GOOGLE_APPLICATION_CREDENTIALS`) or the default service account if running on GCP. Users should replace `your-gcp-project-id` and specify a `location` (e.g., 'us-central1', 'europe-west1') where their Composer environments might reside.

import os from google.cloud.orchestration.airflow.service.v1 import EnvironmentsClient from google.cloud.orchestration.airflow.service.v1 import types def list_composer_environments(project_id: str, location: str): """Lists Cloud Composer environments in a given project and location.""" client = EnvironmentsClient() parent = f"projects/{project_id}/locations/{location}" try: request = types.ListEnvironmentsRequest(parent=parent) page_result = client.list_environments(request=request) print(f"Cloud Composer Environments in {location}:") found_any = False for environment in page_result: print(f" - {environment.name} (State: {environment.state.name})") found_any = True if not found_any: print(" No environments found.") except Exception as e: print(f"Error listing environments: {e}") if __name__ == "__main__": project_id = os.environ.get('GOOGLE_CLOUD_PROJECT', 'your-gcp-project-id') location = os.environ.get('GOOGLE_CLOUD_LOCATION', 'us-central1') # e.g., 'us-central1', 'europe-west1' if project_id == 'your-gcp-project-id': print("Please set the GOOGLE_CLOUD_PROJECT environment variable or replace 'your-gcp-project-id'.") elif location == 'us-central1': print("Please set the GOOGLE_CLOUD_LOCATION environment variable or choose your desired location.") else: list_composer_environments(project_id, location)
Debug
Known issues
breakingWhen upgrading Cloud Composer or Airflow versions, ensure your existing DAGs and any custom PyPI packages are compatible. Incompatible changes can cause DAGs to fail. It's crucial to check the changelogs for the new Airflow version and associated provider packages.
fix
Review the Cloud Composer and Airflow release notes for breaking changes before upgrading. Test DAGs thoroughly in a staging environment.
affects: All versions (during environment upgrades)
gotchaThe library's logging events are not handled by default and may contain sensitive information. Users must explicitly configure Python's standard logging functionality to capture and handle these events.
fix
Configure logging handlers and formatters for Python's `logging` module. Consider setting the `GOOGLE_SDK_PYTHON_LOGGING_SCOPE` environment variable for basic structured logging. Restrict access to logs containing sensitive data.
affects: All versions
breakingThe `apache-airflow-providers-google` package, which is heavily used by Cloud Composer users, has undergone several breaking changes, including the removal or renaming of various operators and hooks (e.g., `LifeSciencesRunPipelineOperator`, `BigQueryCreateEmptyTableOperator`).
fix
Consult the changelog for `apache-airflow-providers-google` to identify replacements for deprecated operators and hooks. Migrate to the recommended alternatives, such as `Google Cloud Batch operators` or specific Vertex AI operators.
affects: apache-airflow-providers-google >= 6.0.0 (and subsequent versions)
deprecatedPython versions 3.6 and below are no longer supported. Using an unsupported Python version can lead to installation failures, runtime errors, and security vulnerabilities.
fix
Upgrade your Python environment to Python 3.9 or higher. Google Cloud client libraries are compatible with all active and maintenance versions of Python.
affects: <= 3.6
breakingAttempting to import `EnvironmentsClient` from `google.cloud.orchestration.airflow.service.v1` resulted in a `ModuleNotFoundError`. The correct module path for the Google Cloud Composer service client is typically `google.cloud.orchestration.airflow.service_v1` (using an underscore instead of a dot for the version part). This error also occurs if the `google-cloud-orchestration-airflow` client library is not installed.
fix
Correct the import statement to `from google.cloud.orchestration.airflow.service_v1 import EnvironmentsClient`. Ensure the `google-cloud-orchestration-airflow` package is installed in your environment (`pip install google-cloud-orchestration-airflow`).
affects: All versions (if using incorrect import path or missing `google-cloud-orchestration-airflow`)
breakingThe `ModuleNotFoundError: No module named 'google.cloud.orchestration.airflow.service.v1'` indicates that the Google Cloud Composer service client library is not installed or accessible in your Python environment. This library is required to interact with the Cloud Composer API.
fix
Ensure the `google-cloud-orchestration-airflow` Python package is installed in your environment using `pip install google-cloud-orchestration-airflow`. If running in a Cloud Composer environment, ensure the package is specified in the environment's PyPI packages list.
affects: All versions (when the library is not installed)
Upgrade
Version history
1.21.0latest on PyPI
Audit
Dependencies
PythonrequiredRequires Python 3.9 or higher for the current version. Python <= 3.6 is explicitly unsupported.
Agent activity
53 hits · last 30 days
node
8
ahrefsbot
3
bytedance
2
Amazon
1
mj12bot
1
seranking-bot
1
Resources