{"id":638,"library":"google-cloud-orchestration-airflow","title":"Google Cloud Orchestration Airflow API Client Library","description":"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.","status":"active","version":"1.20.0","language":"python","source_language":"en","source_url":"https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-orchestration-airflow","tags":["google cloud","airflow","composer","orchestration","workflow"],"install":[{"cmd":"pip install google-cloud-orchestration-airflow","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Requires Python 3.9 or higher for the current version. Python <= 3.6 is explicitly unsupported.","package":"Python","optional":false}],"imports":[{"symbol":"EnvironmentsClient","correct":"from google.cloud.orchestration.airflow.service.v1 import EnvironmentsClient"},{"note":"Used for request/response message types (e.g., types.ListEnvironmentsRequest).","symbol":"types","correct":"from google.cloud.orchestration.airflow.service.v1 import types"}],"quickstart":{"code":"import os\nfrom google.cloud.orchestration.airflow.service.v1 import EnvironmentsClient\nfrom google.cloud.orchestration.airflow.service.v1 import types\n\ndef list_composer_environments(project_id: str, location: str):\n    \"\"\"Lists Cloud Composer environments in a given project and location.\"\"\"\n    client = EnvironmentsClient()\n    parent = f\"projects/{project_id}/locations/{location}\"\n\n    try:\n        request = types.ListEnvironmentsRequest(parent=parent)\n        page_result = client.list_environments(request=request)\n\n        print(f\"Cloud Composer Environments in {location}:\")\n        found_any = False\n        for environment in page_result:\n            print(f\"  - {environment.name} (State: {environment.state.name})\")\n            found_any = True\n        if not found_any:\n            print(\"  No environments found.\")\n\n    except Exception as e:\n        print(f\"Error listing environments: {e}\")\n\nif __name__ == \"__main__\":\n    project_id = os.environ.get('GOOGLE_CLOUD_PROJECT', 'your-gcp-project-id')\n    location = os.environ.get('GOOGLE_CLOUD_LOCATION', 'us-central1') # e.g., 'us-central1', 'europe-west1'\n\n    if project_id == 'your-gcp-project-id':\n        print(\"Please set the GOOGLE_CLOUD_PROJECT environment variable or replace 'your-gcp-project-id'.\")\n    elif location == 'us-central1':\n        print(\"Please set the GOOGLE_CLOUD_LOCATION environment variable or choose your desired location.\")\n    else:\n        list_composer_environments(project_id, location)\n","lang":"python","description":"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."},"warnings":[{"fix":"Review the Cloud Composer and Airflow release notes for breaking changes before upgrading. Test DAGs thoroughly in a staging environment.","message":"When 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.","severity":"breaking","affected_versions":"All versions (during environment upgrades)"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"The `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`).","severity":"breaking","affected_versions":"apache-airflow-providers-google >= 6.0.0 (and subsequent versions)"},{"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.","message":"Python versions 3.6 and below are no longer supported. Using an unsupported Python version can lead to installation failures, runtime errors, and security vulnerabilities.","severity":"deprecated","affected_versions":"<= 3.6"},{"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`).","message":"Attempting 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.","severity":"breaking","affected_versions":"All versions (if using incorrect import path or missing `google-cloud-orchestration-airflow`)"},{"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.","message":"The `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.","severity":"breaking","affected_versions":"All versions (when the library is not installed)"}],"env_vars":null,"last_verified":"2026-05-12T17:05:23.930Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Ensure the user account initiating the environment creation/update has the 'Service Account User' role on the specified service account, and the service account itself has sufficient permissions (e.g., 'Cloud Composer API Service Agent Extension', 'Cloud Composer v2 API Service Agent Extension', 'Composer Worker') for the resources it needs to access.","cause":"The service account used to create or manage the Cloud Composer environment lacks the necessary IAM permissions, such as `iam.serviceAccounts.actAs` or other required roles for the Composer service account or the caller.","error":"PERMISSION_DENIED: User not authorized to act as service account <service-account-name>"},{"fix":"Inspect the Cloud Build logs (accessible from the 'Environments' page > 'Logs' tab > 'Composer logs' > 'Builds') to find the specific `pip` error detailing the package conflict. Adjust the version constraints of your custom PyPI packages (e.g., use `>=X.Y.Z` instead of `==X.Y.Z`) or install a compatible version.","cause":"This error often indicates a conflict when installing custom Python packages (PyPI dependencies) in the Cloud Composer environment, typically due to incompatible versions between your custom packages and pre-installed Airflow packages.","error":"UPDATE operation on this environment failed with the following error message: An error occurred before the new web server image has been created."},{"fix":"Review the detailed error messages in the Cloud Composer operation logs and Cloud Logging for the environment. Check for specific GKE cluster errors, IP address conflicts, network setup, and ensure all required Google Cloud APIs (like App Engine and Kubernetes Engine API) are enabled and resource quotas are sufficient.","cause":"This generic bad request error during environment creation can stem from various network configuration issues (e.g., overlapping IP ranges, incorrect VPC configuration, firewall rules), insufficient quotas, or problems with the underlying GKE cluster provisioning.","error":"CREATE operation on this environment failed ... Http error status code: 400 Http error message: BAD REQUEST"},{"fix":"Ensure the custom module or package is correctly installed as a PyPI package for the Composer environment or uploaded to the `/dags/data` folder (for Python modules/packages) or `/dags/plugins` folder (for Airflow plugins). Verify the import statement in your DAG matches the module's location and structure. For PyPI packages, check the build logs during installation for errors.","cause":"This occurs when a DAG attempts to import a Python module that is not available in the Cloud Composer environment's Python path. This could be due to incorrect PyPI package installation, the module not being placed in the correct `dags/data` or `dags/plugins` folder, or an incorrect import path within your DAG code.","error":"ModuleNotFoundError: No module named 'your_custom_module'"}],"ecosystem":"pypi","meta_description":null,"install_score":0,"install_tag":"stale","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"1.21.0","install_checks":{"last_tested":"2026-05-12","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"71.4M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":5.9,"import_time_s":null,"mem_mb":null,"disk_size":"69M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"76.4M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":5.2,"import_time_s":null,"mem_mb":null,"disk_size":"74M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"67.8M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":4.5,"import_time_s":null,"mem_mb":null,"disk_size":"66M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"67.5M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":4.5,"import_time_s":null,"mem_mb":null,"disk_size":"65M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"71.5M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":7,"import_time_s":null,"mem_mb":null,"disk_size":"69M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}