airflow.providers.google.cloud.hooks.cloud_composer¶
類¶
用於 Google Cloud Composer API 的聯結器。 |
|
用於 Google Cloud Composer 非同步 API 的聯結器。 |
模組內容¶
- class airflow.providers.google.cloud.hooks.cloud_composer.CloudComposerHook(gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
基類:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook,airflow.providers.google.common.hooks.operation_helpers.OperationHelper用於 Google Cloud Composer API 的聯結器。
- create_environment(project_id, region, environment, retry=DEFAULT, timeout=None, metadata=())[source]¶
建立新環境。
- 引數:
project_id (str) – 必需。服務所屬的 Google Cloud 專案 ID。
region (str) – 必需。服務所屬的 Google Cloud 區域 ID。
environment (google.cloud.orchestration.airflow.service_v1.types.Environment | dict) – 要建立的環境。這對應於
request例項上的environment欄位;如果提供了request,則不應設定此欄位。retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- delete_environment(project_id, region, environment_id, retry=DEFAULT, timeout=None, metadata=())[source]¶
刪除環境。
- 引數:
project_id (str) – 必需。服務所屬的 Google Cloud 專案 ID。
region (str) – 必需。服務所屬的 Google Cloud 區域 ID。
environment_id (str) – 必需。服務所屬的 Google Cloud 環境 ID。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- get_environment(project_id, region, environment_id, retry=DEFAULT, timeout=None, metadata=())[source]¶
獲取現有環境。
- 引數:
project_id (str) – 必需。服務所屬的 Google Cloud 專案 ID。
region (str) – 必需。服務所屬的 Google Cloud 區域 ID。
environment_id (str) – 必需。服務所屬的 Google Cloud 環境 ID。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- list_environments(project_id, region, page_size=None, page_token=None, retry=DEFAULT, timeout=None, metadata=())[source]¶
列出環境。
- 引數:
project_id (str) – 必需。服務所屬的 Google Cloud 專案 ID。
region (str) – 必需。服務所屬的 Google Cloud 區域 ID。
page_size (int | None) – 要返回的最大環境數量。
page_token (str | None) – 前一次 List 請求返回的 next_page_token 值(若有)。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- update_environment(project_id, region, environment_id, environment, update_mask, retry=DEFAULT, timeout=None, metadata=())[source]¶
更新環境。
- 引數:
project_id (str) – 必需。服務所屬的 Google Cloud 專案 ID。
region (str) – 必需。服務所屬的 Google Cloud 區域 ID。
environment_id (str) – 必需。服務所屬的 Google Cloud 環境 ID。
environment (google.cloud.orchestration.airflow.service_v1.types.Environment | dict) –
一個補丁環境。由
updateMask指定的欄位將從補丁環境複製到正在更新的環境中。這對應於
request例項上的environment欄位;如果提供了request,則不應設定此欄位。update_mask (dict | google.protobuf.field_mask_pb2.FieldMask) – 必需。相對於
Environment要更新的欄位路徑的逗號分隔列表。如果提供的是字典,則其形式必須與 protobuf 訊息FieldMask相同retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- list_image_versions(project_id, region, page_size=None, page_token=None, include_past_releases=False, retry=DEFAULT, timeout=None, metadata=())[source]¶
列出指定位置的 ImageVersions。
- 引數:
project_id (str) – 必需。服務所屬的 Google Cloud 專案 ID。
region (str) – 必需。服務所屬的 Google Cloud 區域 ID。
page_size (int | None) – 要返回的最大環境數量。
page_token (str | None) – 前一次 List 請求返回的 next_page_token 值(若有)。
include_past_releases (bool) – 包含過去版本的標誌
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- execute_airflow_command(project_id, region, environment_id, command, subcommand, parameters, retry=DEFAULT, timeout=None, metadata=())[source]¶
針對指定的 Composer 環境執行 Airflow 命令。
- 引數:
project_id (str) – 服務所屬的 Google Cloud 專案 ID。
region (str) – 服務所屬的 Google Cloud 區域 ID。
environment_id (str) – 服務所屬的 Google Cloud 環境 ID。
command (str) – Airflow 命令。
subcommand (str) – Airflow 子命令。
parameters (collections.abc.MutableSequence[str]) – 作為引數陣列傳遞給 Airflow 命令/子命令的引數。它可能包含位置引數,例如
["my-dag-id"];鍵值引數,例如["--foo=bar"]或["--foo","bar"];或其它標誌,例如["-f"]。retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- poll_airflow_command(project_id, region, environment_id, execution_id, pod, pod_namespace, next_line_number, retry=DEFAULT, timeout=None, metadata=())[source]¶
輪詢指定 Composer 環境的 Airflow 命令執行結果。
- 引數:
project_id (str) – 服務所屬的 Google Cloud 專案 ID。
region (str) – 服務所屬的 Google Cloud 區域 ID。
environment_id (str) – 服務所屬的 Google Cloud 環境 ID。
execution_id (str) – 命令執行的唯一 ID。
pod (str) – 執行命令的 Pod 名稱。
pod_namespace (str) – 執行命令的 Pod 名稱空間。
next_line_number (int) – 應從中獲取新日誌的行號。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- class airflow.providers.google.cloud.hooks.cloud_composer.CloudComposerAsyncHook(gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
基類:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook用於 Google Cloud Composer 非同步 API 的聯結器。
- async create_environment(project_id, region, environment, retry=DEFAULT, timeout=None, metadata=())[source]¶
建立新環境。
- 引數:
project_id (str) – 必需。服務所屬的 Google Cloud 專案 ID。
region (str) – 必需。服務所屬的 Google Cloud 區域 ID。
environment (google.cloud.orchestration.airflow.service_v1.types.Environment | dict) – 要建立的環境。這對應於
request例項上的environment欄位;如果提供了request,則不應設定此欄位。retry (google.api_core.retry_async.AsyncRetry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- async delete_environment(project_id, region, environment_id, retry=DEFAULT, timeout=None, metadata=())[source]¶
刪除環境。
- 引數:
project_id (str) – 必需。服務所屬的 Google Cloud 專案 ID。
region (str) – 必需。服務所屬的 Google Cloud 區域 ID。
environment_id (str) – 必需。服務所屬的 Google Cloud 環境 ID。
retry (google.api_core.retry_async.AsyncRetry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- async update_environment(project_id, region, environment_id, environment, update_mask, retry=DEFAULT, timeout=None, metadata=())[source]¶
更新環境。
- 引數:
project_id (str) – 必需。服務所屬的 Google Cloud 專案 ID。
region (str) – 必需。服務所屬的 Google Cloud 區域 ID。
environment_id (str) – 必需。服務所屬的 Google Cloud 環境 ID。
environment (google.cloud.orchestration.airflow.service_v1.types.Environment | dict) –
一個補丁環境。由
updateMask指定的欄位將從補丁環境複製到正在更新的環境中。這對應於
request例項上的environment欄位;如果提供了request,則不應設定此欄位。update_mask (dict | google.protobuf.field_mask_pb2.FieldMask) – 必需。相對於
Environment要更新的欄位路徑的逗號分隔列表。如果提供的是字典,則其形式必須與 protobuf 訊息FieldMask相同retry (google.api_core.retry_async.AsyncRetry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- async execute_airflow_command(project_id, region, environment_id, command, subcommand, parameters, retry=DEFAULT, timeout=None, metadata=())[source]¶
針對指定的 Composer 環境執行 Airflow 命令。
- 引數:
project_id (str) – 服務所屬的 Google Cloud 專案 ID。
region (str) – 服務所屬的 Google Cloud 區域 ID。
environment_id (str) – 服務所屬的 Google Cloud 環境 ID。
command (str) – Airflow 命令。
subcommand (str) – Airflow 子命令。
parameters (collections.abc.MutableSequence[str]) – 作為引數陣列傳遞給 Airflow 命令/子命令的引數。它可能包含位置引數,例如
["my-dag-id"];鍵值引數,例如["--foo=bar"]或["--foo","bar"];或其它標誌,例如["-f"]。retry (google.api_core.retry_async.AsyncRetry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。
- async poll_airflow_command(project_id, region, environment_id, execution_id, pod, pod_namespace, next_line_number, retry=DEFAULT, timeout=None, metadata=())[source]¶
輪詢指定 Composer 環境的 Airflow 命令執行結果。
- 引數:
project_id (str) – 服務所屬的 Google Cloud 專案 ID。
region (str) – 服務所屬的 Google Cloud 區域 ID。
environment_id (str) – 服務所屬的 Google Cloud 環境 ID。
execution_id (str) – 命令執行的唯一 ID。
pod (str) – 執行命令的 Pod 名稱。
pod_namespace (str) – 執行命令的 Pod 名稱空間。
next_line_number (int) – 應從中獲取新日誌的行號。
retry (google.api_core.retry_async.AsyncRetry | google.api_core.gapic_v1.method._MethodDefault) – 指定哪些錯誤(若有)應重試。
timeout (float | None) – 此請求的超時時間。
metadata (collections.abc.Sequence[tuple[str, str]]) – 應作為元資料隨請求一起傳送的字串。