apache-airflow-providers-google 14.0.0__py3-none-any.whl → 19.1.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airflow/providers/google/3rd-party-licenses/LICENSES.txt +14 -0
- airflow/providers/google/3rd-party-licenses/NOTICE +5 -0
- airflow/providers/google/__init__.py +3 -3
- airflow/providers/google/_vendor/__init__.py +0 -0
- airflow/providers/google/_vendor/json_merge_patch.py +91 -0
- airflow/providers/google/ads/hooks/ads.py +52 -43
- airflow/providers/google/ads/operators/ads.py +2 -2
- airflow/providers/google/ads/transfers/ads_to_gcs.py +3 -19
- airflow/providers/google/assets/gcs.py +1 -11
- airflow/providers/google/cloud/_internal_client/secret_manager_client.py +3 -2
- airflow/providers/google/cloud/bundles/gcs.py +161 -0
- airflow/providers/google/cloud/hooks/alloy_db.py +2 -3
- airflow/providers/google/cloud/hooks/bigquery.py +195 -318
- airflow/providers/google/cloud/hooks/bigquery_dts.py +8 -8
- airflow/providers/google/cloud/hooks/bigtable.py +3 -2
- airflow/providers/google/cloud/hooks/cloud_batch.py +8 -9
- airflow/providers/google/cloud/hooks/cloud_build.py +6 -65
- airflow/providers/google/cloud/hooks/cloud_composer.py +292 -24
- airflow/providers/google/cloud/hooks/cloud_logging.py +109 -0
- airflow/providers/google/cloud/hooks/cloud_memorystore.py +4 -3
- airflow/providers/google/cloud/hooks/cloud_run.py +20 -11
- airflow/providers/google/cloud/hooks/cloud_sql.py +136 -64
- airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +35 -15
- airflow/providers/google/cloud/hooks/compute.py +7 -6
- airflow/providers/google/cloud/hooks/compute_ssh.py +7 -4
- airflow/providers/google/cloud/hooks/datacatalog.py +12 -3
- airflow/providers/google/cloud/hooks/dataflow.py +87 -242
- airflow/providers/google/cloud/hooks/dataform.py +9 -14
- airflow/providers/google/cloud/hooks/datafusion.py +7 -9
- airflow/providers/google/cloud/hooks/dataplex.py +13 -12
- airflow/providers/google/cloud/hooks/dataprep.py +2 -2
- airflow/providers/google/cloud/hooks/dataproc.py +76 -74
- airflow/providers/google/cloud/hooks/dataproc_metastore.py +4 -3
- airflow/providers/google/cloud/hooks/dlp.py +5 -4
- airflow/providers/google/cloud/hooks/gcs.py +144 -33
- airflow/providers/google/cloud/hooks/gen_ai.py +196 -0
- airflow/providers/google/cloud/hooks/kms.py +3 -2
- airflow/providers/google/cloud/hooks/kubernetes_engine.py +22 -17
- airflow/providers/google/cloud/hooks/looker.py +6 -1
- airflow/providers/google/cloud/hooks/managed_kafka.py +227 -3
- airflow/providers/google/cloud/hooks/mlengine.py +7 -8
- airflow/providers/google/cloud/hooks/natural_language.py +3 -2
- airflow/providers/google/cloud/hooks/os_login.py +3 -2
- airflow/providers/google/cloud/hooks/pubsub.py +6 -6
- airflow/providers/google/cloud/hooks/secret_manager.py +105 -12
- airflow/providers/google/cloud/hooks/spanner.py +75 -10
- airflow/providers/google/cloud/hooks/speech_to_text.py +3 -2
- airflow/providers/google/cloud/hooks/stackdriver.py +18 -18
- airflow/providers/google/cloud/hooks/tasks.py +4 -3
- airflow/providers/google/cloud/hooks/text_to_speech.py +3 -2
- airflow/providers/google/cloud/hooks/translate.py +8 -17
- airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +8 -222
- airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +9 -15
- airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +33 -283
- airflow/providers/google/cloud/hooks/vertex_ai/dataset.py +5 -12
- airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py +6 -12
- airflow/providers/google/cloud/hooks/vertex_ai/experiment_service.py +202 -0
- airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +311 -10
- airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +79 -75
- airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +7 -13
- airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +8 -12
- airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +6 -12
- airflow/providers/google/cloud/hooks/vertex_ai/prediction_service.py +3 -2
- airflow/providers/google/cloud/hooks/vertex_ai/ray.py +223 -0
- airflow/providers/google/cloud/hooks/video_intelligence.py +3 -2
- airflow/providers/google/cloud/hooks/vision.py +7 -7
- airflow/providers/google/cloud/hooks/workflows.py +4 -3
- airflow/providers/google/cloud/links/alloy_db.py +0 -46
- airflow/providers/google/cloud/links/base.py +77 -7
- airflow/providers/google/cloud/links/bigquery.py +0 -47
- airflow/providers/google/cloud/links/bigquery_dts.py +0 -20
- airflow/providers/google/cloud/links/bigtable.py +0 -48
- airflow/providers/google/cloud/links/cloud_build.py +0 -73
- airflow/providers/google/cloud/links/cloud_functions.py +0 -33
- airflow/providers/google/cloud/links/cloud_memorystore.py +0 -58
- airflow/providers/google/cloud/links/{life_sciences.py → cloud_run.py} +5 -27
- airflow/providers/google/cloud/links/cloud_sql.py +0 -33
- airflow/providers/google/cloud/links/cloud_storage_transfer.py +17 -46
- airflow/providers/google/cloud/links/cloud_tasks.py +7 -26
- airflow/providers/google/cloud/links/compute.py +0 -58
- airflow/providers/google/cloud/links/data_loss_prevention.py +0 -169
- airflow/providers/google/cloud/links/datacatalog.py +23 -54
- airflow/providers/google/cloud/links/dataflow.py +0 -34
- airflow/providers/google/cloud/links/dataform.py +0 -64
- airflow/providers/google/cloud/links/datafusion.py +1 -90
- airflow/providers/google/cloud/links/dataplex.py +0 -154
- airflow/providers/google/cloud/links/dataprep.py +0 -24
- airflow/providers/google/cloud/links/dataproc.py +11 -89
- airflow/providers/google/cloud/links/datastore.py +0 -31
- airflow/providers/google/cloud/links/kubernetes_engine.py +11 -61
- airflow/providers/google/cloud/links/managed_kafka.py +11 -51
- airflow/providers/google/cloud/links/mlengine.py +0 -70
- airflow/providers/google/cloud/links/pubsub.py +0 -32
- airflow/providers/google/cloud/links/spanner.py +0 -33
- airflow/providers/google/cloud/links/stackdriver.py +0 -30
- airflow/providers/google/cloud/links/translate.py +17 -187
- airflow/providers/google/cloud/links/vertex_ai.py +28 -195
- airflow/providers/google/cloud/links/workflows.py +0 -52
- airflow/providers/google/cloud/log/gcs_task_handler.py +166 -118
- airflow/providers/google/cloud/log/stackdriver_task_handler.py +14 -9
- airflow/providers/google/cloud/openlineage/CloudStorageTransferJobFacet.json +68 -0
- airflow/providers/google/cloud/openlineage/CloudStorageTransferRunFacet.json +60 -0
- airflow/providers/google/cloud/openlineage/DataFusionRunFacet.json +32 -0
- airflow/providers/google/cloud/openlineage/facets.py +141 -40
- airflow/providers/google/cloud/openlineage/mixins.py +14 -13
- airflow/providers/google/cloud/openlineage/utils.py +19 -3
- airflow/providers/google/cloud/operators/alloy_db.py +76 -61
- airflow/providers/google/cloud/operators/bigquery.py +104 -667
- airflow/providers/google/cloud/operators/bigquery_dts.py +12 -12
- airflow/providers/google/cloud/operators/bigtable.py +38 -7
- airflow/providers/google/cloud/operators/cloud_base.py +22 -1
- airflow/providers/google/cloud/operators/cloud_batch.py +18 -18
- airflow/providers/google/cloud/operators/cloud_build.py +80 -36
- airflow/providers/google/cloud/operators/cloud_composer.py +157 -71
- airflow/providers/google/cloud/operators/cloud_logging_sink.py +341 -0
- airflow/providers/google/cloud/operators/cloud_memorystore.py +74 -46
- airflow/providers/google/cloud/operators/cloud_run.py +39 -20
- airflow/providers/google/cloud/operators/cloud_sql.py +46 -61
- airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +92 -14
- airflow/providers/google/cloud/operators/compute.py +18 -50
- airflow/providers/google/cloud/operators/datacatalog.py +167 -29
- airflow/providers/google/cloud/operators/dataflow.py +38 -15
- airflow/providers/google/cloud/operators/dataform.py +19 -7
- airflow/providers/google/cloud/operators/datafusion.py +43 -43
- airflow/providers/google/cloud/operators/dataplex.py +212 -126
- airflow/providers/google/cloud/operators/dataprep.py +1 -5
- airflow/providers/google/cloud/operators/dataproc.py +134 -207
- airflow/providers/google/cloud/operators/dataproc_metastore.py +102 -84
- airflow/providers/google/cloud/operators/datastore.py +22 -6
- airflow/providers/google/cloud/operators/dlp.py +24 -45
- airflow/providers/google/cloud/operators/functions.py +21 -14
- airflow/providers/google/cloud/operators/gcs.py +15 -12
- airflow/providers/google/cloud/operators/gen_ai.py +389 -0
- airflow/providers/google/cloud/operators/kubernetes_engine.py +115 -106
- airflow/providers/google/cloud/operators/looker.py +1 -1
- airflow/providers/google/cloud/operators/managed_kafka.py +362 -40
- airflow/providers/google/cloud/operators/natural_language.py +5 -3
- airflow/providers/google/cloud/operators/pubsub.py +69 -21
- airflow/providers/google/cloud/operators/spanner.py +53 -45
- airflow/providers/google/cloud/operators/speech_to_text.py +5 -4
- airflow/providers/google/cloud/operators/stackdriver.py +5 -11
- airflow/providers/google/cloud/operators/tasks.py +6 -15
- airflow/providers/google/cloud/operators/text_to_speech.py +4 -3
- airflow/providers/google/cloud/operators/translate.py +46 -20
- airflow/providers/google/cloud/operators/translate_speech.py +4 -3
- airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +44 -34
- airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +34 -12
- airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +62 -53
- airflow/providers/google/cloud/operators/vertex_ai/dataset.py +75 -11
- airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +48 -12
- airflow/providers/google/cloud/operators/vertex_ai/experiment_service.py +435 -0
- airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +532 -1
- airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +135 -116
- airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +16 -12
- airflow/providers/google/cloud/operators/vertex_ai/model_service.py +62 -14
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +35 -10
- airflow/providers/google/cloud/operators/vertex_ai/ray.py +393 -0
- airflow/providers/google/cloud/operators/video_intelligence.py +5 -3
- airflow/providers/google/cloud/operators/vision.py +7 -5
- airflow/providers/google/cloud/operators/workflows.py +24 -19
- airflow/providers/google/cloud/secrets/secret_manager.py +2 -1
- airflow/providers/google/cloud/sensors/bigquery.py +2 -2
- airflow/providers/google/cloud/sensors/bigquery_dts.py +6 -4
- airflow/providers/google/cloud/sensors/bigtable.py +14 -6
- airflow/providers/google/cloud/sensors/cloud_composer.py +535 -33
- airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +6 -5
- airflow/providers/google/cloud/sensors/dataflow.py +27 -10
- airflow/providers/google/cloud/sensors/dataform.py +2 -2
- airflow/providers/google/cloud/sensors/datafusion.py +4 -4
- airflow/providers/google/cloud/sensors/dataplex.py +7 -5
- airflow/providers/google/cloud/sensors/dataprep.py +2 -2
- airflow/providers/google/cloud/sensors/dataproc.py +10 -9
- airflow/providers/google/cloud/sensors/dataproc_metastore.py +4 -3
- airflow/providers/google/cloud/sensors/gcs.py +22 -21
- airflow/providers/google/cloud/sensors/looker.py +5 -5
- airflow/providers/google/cloud/sensors/pubsub.py +20 -20
- airflow/providers/google/cloud/sensors/tasks.py +2 -2
- airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +2 -2
- airflow/providers/google/cloud/sensors/workflows.py +6 -4
- airflow/providers/google/cloud/transfers/adls_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +11 -8
- airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +14 -13
- airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +7 -3
- airflow/providers/google/cloud/transfers/bigquery_to_mysql.py +12 -1
- airflow/providers/google/cloud/transfers/bigquery_to_postgres.py +24 -10
- airflow/providers/google/cloud/transfers/bigquery_to_sql.py +104 -5
- airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +18 -22
- airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +4 -5
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +45 -38
- airflow/providers/google/cloud/transfers/gcs_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/gcs_to_local.py +5 -3
- airflow/providers/google/cloud/transfers/gcs_to_sftp.py +10 -4
- airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +6 -2
- airflow/providers/google/cloud/transfers/gdrive_to_local.py +2 -2
- airflow/providers/google/cloud/transfers/http_to_gcs.py +193 -0
- airflow/providers/google/cloud/transfers/local_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/mssql_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/oracle_to_gcs.py +36 -11
- airflow/providers/google/cloud/transfers/postgres_to_gcs.py +44 -12
- airflow/providers/google/cloud/transfers/s3_to_gcs.py +12 -6
- airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/sftp_to_gcs.py +36 -14
- airflow/providers/google/cloud/transfers/sheets_to_gcs.py +3 -3
- airflow/providers/google/cloud/transfers/sql_to_gcs.py +10 -10
- airflow/providers/google/cloud/triggers/bigquery.py +75 -34
- airflow/providers/google/cloud/triggers/bigquery_dts.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_batch.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_build.py +3 -2
- airflow/providers/google/cloud/triggers/cloud_composer.py +303 -47
- airflow/providers/google/cloud/triggers/cloud_run.py +2 -2
- airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +96 -5
- airflow/providers/google/cloud/triggers/dataflow.py +125 -2
- airflow/providers/google/cloud/triggers/datafusion.py +1 -1
- airflow/providers/google/cloud/triggers/dataplex.py +16 -3
- airflow/providers/google/cloud/triggers/dataproc.py +124 -53
- airflow/providers/google/cloud/triggers/kubernetes_engine.py +46 -28
- airflow/providers/google/cloud/triggers/mlengine.py +1 -1
- airflow/providers/google/cloud/triggers/pubsub.py +17 -20
- airflow/providers/google/cloud/triggers/vertex_ai.py +8 -7
- airflow/providers/google/cloud/utils/bigquery.py +5 -7
- airflow/providers/google/cloud/utils/bigquery_get_data.py +1 -1
- airflow/providers/google/cloud/utils/credentials_provider.py +4 -3
- airflow/providers/google/cloud/utils/dataform.py +1 -1
- airflow/providers/google/cloud/utils/external_token_supplier.py +0 -1
- airflow/providers/google/cloud/utils/field_validator.py +1 -2
- airflow/providers/google/cloud/utils/validators.py +43 -0
- airflow/providers/google/common/auth_backend/google_openid.py +26 -9
- airflow/providers/google/common/consts.py +2 -1
- airflow/providers/google/common/deprecated.py +2 -1
- airflow/providers/google/common/hooks/base_google.py +40 -43
- airflow/providers/google/common/hooks/operation_helpers.py +78 -0
- airflow/providers/google/common/links/storage.py +0 -22
- airflow/providers/google/common/utils/get_secret.py +31 -0
- airflow/providers/google/common/utils/id_token_credentials.py +4 -5
- airflow/providers/google/firebase/operators/firestore.py +2 -2
- airflow/providers/google/get_provider_info.py +61 -216
- airflow/providers/google/go_module_utils.py +35 -3
- airflow/providers/google/leveldb/hooks/leveldb.py +30 -6
- airflow/providers/google/leveldb/operators/leveldb.py +2 -2
- airflow/providers/google/marketing_platform/hooks/analytics_admin.py +3 -2
- airflow/providers/google/marketing_platform/hooks/display_video.py +3 -109
- airflow/providers/google/marketing_platform/hooks/search_ads.py +1 -1
- airflow/providers/google/marketing_platform/links/analytics_admin.py +4 -5
- airflow/providers/google/marketing_platform/operators/analytics_admin.py +7 -6
- airflow/providers/google/marketing_platform/operators/campaign_manager.py +5 -5
- airflow/providers/google/marketing_platform/operators/display_video.py +28 -489
- airflow/providers/google/marketing_platform/operators/search_ads.py +2 -2
- airflow/providers/google/marketing_platform/sensors/campaign_manager.py +2 -2
- airflow/providers/google/marketing_platform/sensors/display_video.py +4 -64
- airflow/providers/google/suite/hooks/calendar.py +1 -1
- airflow/providers/google/suite/hooks/drive.py +2 -2
- airflow/providers/google/suite/hooks/sheets.py +15 -1
- airflow/providers/google/suite/operators/sheets.py +8 -3
- airflow/providers/google/suite/sensors/drive.py +2 -2
- airflow/providers/google/suite/transfers/gcs_to_gdrive.py +2 -2
- airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
- airflow/providers/google/suite/transfers/local_to_drive.py +3 -3
- airflow/providers/google/suite/transfers/sql_to_sheets.py +5 -4
- airflow/providers/google/version_compat.py +15 -1
- {apache_airflow_providers_google-14.0.0.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/METADATA +117 -72
- apache_airflow_providers_google-19.1.0rc1.dist-info/RECORD +331 -0
- {apache_airflow_providers_google-14.0.0.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/WHEEL +1 -1
- apache_airflow_providers_google-19.1.0rc1.dist-info/licenses/NOTICE +5 -0
- airflow/providers/google/cloud/example_dags/example_cloud_task.py +0 -54
- airflow/providers/google/cloud/hooks/automl.py +0 -679
- airflow/providers/google/cloud/hooks/life_sciences.py +0 -159
- airflow/providers/google/cloud/links/automl.py +0 -193
- airflow/providers/google/cloud/operators/automl.py +0 -1360
- airflow/providers/google/cloud/operators/life_sciences.py +0 -119
- airflow/providers/google/cloud/operators/mlengine.py +0 -1515
- airflow/providers/google/cloud/utils/mlengine_operator_utils.py +0 -273
- apache_airflow_providers_google-14.0.0.dist-info/RECORD +0 -318
- /airflow/providers/google/cloud/{example_dags → bundles}/__init__.py +0 -0
- {apache_airflow_providers_google-14.0.0.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/entry_points.txt +0 -0
- {airflow/providers/google → apache_airflow_providers_google-19.1.0rc1.dist-info/licenses}/LICENSE +0 -0
|
@@ -23,13 +23,6 @@ from collections.abc import MutableSequence, Sequence
|
|
|
23
23
|
from copy import deepcopy
|
|
24
24
|
from typing import TYPE_CHECKING, Any
|
|
25
25
|
|
|
26
|
-
from airflow.exceptions import AirflowException
|
|
27
|
-
from airflow.providers.google.common.consts import CLIENT_INFO
|
|
28
|
-
from airflow.providers.google.common.hooks.base_google import (
|
|
29
|
-
PROVIDE_PROJECT_ID,
|
|
30
|
-
GoogleBaseAsyncHook,
|
|
31
|
-
GoogleBaseHook,
|
|
32
|
-
)
|
|
33
26
|
from google.api_core.client_options import ClientOptions
|
|
34
27
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
|
35
28
|
from google.cloud.dataplex_v1 import (
|
|
@@ -53,9 +46,16 @@ from google.cloud.dataplex_v1.types import (
|
|
|
53
46
|
)
|
|
54
47
|
from google.protobuf.field_mask_pb2 import FieldMask
|
|
55
48
|
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
from airflow.exceptions import AirflowException
|
|
50
|
+
from airflow.providers.google.common.consts import CLIENT_INFO
|
|
51
|
+
from airflow.providers.google.common.hooks.base_google import (
|
|
52
|
+
PROVIDE_PROJECT_ID,
|
|
53
|
+
GoogleBaseAsyncHook,
|
|
54
|
+
GoogleBaseHook,
|
|
55
|
+
)
|
|
56
|
+
from airflow.providers.google.common.hooks.operation_helpers import OperationHelper
|
|
58
57
|
|
|
58
|
+
if TYPE_CHECKING:
|
|
59
59
|
from google.api_core.operation import Operation
|
|
60
60
|
from google.api_core.retry import Retry
|
|
61
61
|
from google.api_core.retry_async import AsyncRetry
|
|
@@ -66,6 +66,7 @@ if TYPE_CHECKING:
|
|
|
66
66
|
ListEntryTypesPager,
|
|
67
67
|
SearchEntriesPager,
|
|
68
68
|
)
|
|
69
|
+
from googleapiclient.discovery import Resource
|
|
69
70
|
|
|
70
71
|
PATH_DATA_SCAN = "projects/{project_id}/locations/{region}/dataScans/{data_scan_id}"
|
|
71
72
|
|
|
@@ -78,7 +79,7 @@ class AirflowDataQualityScanResultTimeoutException(AirflowException):
|
|
|
78
79
|
"""Raised when no result found after specified amount of seconds."""
|
|
79
80
|
|
|
80
81
|
|
|
81
|
-
class DataplexHook(GoogleBaseHook):
|
|
82
|
+
class DataplexHook(GoogleBaseHook, OperationHelper):
|
|
82
83
|
"""
|
|
83
84
|
Hook for Google Dataplex.
|
|
84
85
|
|
|
@@ -136,7 +137,7 @@ class DataplexHook(GoogleBaseHook):
|
|
|
136
137
|
credentials=self.get_credentials(), client_info=CLIENT_INFO, client_options=client_options
|
|
137
138
|
)
|
|
138
139
|
|
|
139
|
-
def wait_for_operation(self, timeout: float | None
|
|
140
|
+
def wait_for_operation(self, operation: Operation, timeout: float | None = None):
|
|
140
141
|
"""Wait for long-lasting operation to complete."""
|
|
141
142
|
try:
|
|
142
143
|
return operation.result(timeout=timeout)
|
|
@@ -514,7 +515,7 @@ class DataplexHook(GoogleBaseHook):
|
|
|
514
515
|
fields are non-required and omitted in the request body, their values are emptied.
|
|
515
516
|
:param allow_missing: Optional. If set to true and entry doesn't exist, the service will create it.
|
|
516
517
|
:param delete_missing_aspects: Optional. If set to true and the aspect_keys specify aspect
|
|
517
|
-
ranges, the service deletes any existing aspects from that range that
|
|
518
|
+
ranges, the service deletes any existing aspects from that range that were not provided
|
|
518
519
|
in the request.
|
|
519
520
|
:param aspect_keys: Optional. The map keys of the Aspects which the service should modify.
|
|
520
521
|
It supports the following syntax:
|
|
@@ -28,10 +28,10 @@ import requests
|
|
|
28
28
|
from requests import HTTPError
|
|
29
29
|
from tenacity import retry, stop_after_attempt, wait_exponential
|
|
30
30
|
|
|
31
|
-
from airflow.
|
|
31
|
+
from airflow.providers.common.compat.sdk import BaseHook
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
def _get_field(extras: dict, field_name: str):
|
|
34
|
+
def _get_field(extras: dict, field_name: str) -> str | None:
|
|
35
35
|
"""Get field from extra, first checking short name, then for backcompat we check for prefixed name."""
|
|
36
36
|
backcompat_prefix = "extra__dataprep__"
|
|
37
37
|
if field_name.startswith("extra__"):
|
|
@@ -26,10 +26,6 @@ import uuid
|
|
|
26
26
|
from collections.abc import MutableSequence, Sequence
|
|
27
27
|
from typing import TYPE_CHECKING, Any
|
|
28
28
|
|
|
29
|
-
from airflow.exceptions import AirflowException
|
|
30
|
-
from airflow.providers.google.common.consts import CLIENT_INFO
|
|
31
|
-
from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
|
|
32
|
-
from airflow.version import version as airflow_version
|
|
33
29
|
from google.api_core.client_options import ClientOptions
|
|
34
30
|
from google.api_core.exceptions import ServerError
|
|
35
31
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
|
@@ -49,6 +45,11 @@ from google.cloud.dataproc_v1 import (
|
|
|
49
45
|
WorkflowTemplateServiceClient,
|
|
50
46
|
)
|
|
51
47
|
|
|
48
|
+
from airflow.exceptions import AirflowException
|
|
49
|
+
from airflow.providers.google.common.consts import CLIENT_INFO
|
|
50
|
+
from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
|
|
51
|
+
from airflow.version import version as airflow_version
|
|
52
|
+
|
|
52
53
|
if TYPE_CHECKING:
|
|
53
54
|
from google.api_core.operation import Operation
|
|
54
55
|
from google.api_core.operation_async import AsyncOperation
|
|
@@ -297,7 +298,7 @@ class DataprocHook(GoogleBaseHook):
|
|
|
297
298
|
success_code = 0
|
|
298
299
|
|
|
299
300
|
with self.provide_authorized_gcloud():
|
|
300
|
-
proc = subprocess.run(cmd, capture_output=True)
|
|
301
|
+
proc = subprocess.run(cmd, check=False, capture_output=True)
|
|
301
302
|
|
|
302
303
|
if proc.returncode != success_code:
|
|
303
304
|
stderr_last_20_lines = "\n".join(proc.stderr.decode().strip().splitlines()[-20:])
|
|
@@ -911,12 +912,15 @@ class DataprocHook(GoogleBaseHook):
|
|
|
911
912
|
state = None
|
|
912
913
|
start = time.monotonic()
|
|
913
914
|
while state not in (JobStatus.State.ERROR, JobStatus.State.DONE, JobStatus.State.CANCELLED):
|
|
915
|
+
self.log.debug("Waiting for job %s to complete", job_id)
|
|
914
916
|
if timeout and start + timeout < time.monotonic():
|
|
915
917
|
raise AirflowException(f"Timeout: dataproc job {job_id} is not ready after {timeout}s")
|
|
918
|
+
self.log.debug("Sleeping for %s seconds", wait_time)
|
|
916
919
|
time.sleep(wait_time)
|
|
917
920
|
try:
|
|
918
921
|
job = self.get_job(project_id=project_id, region=region, job_id=job_id)
|
|
919
922
|
state = job.status.state
|
|
923
|
+
self.log.debug("Job %s is in state %s", job_id, state)
|
|
920
924
|
except ServerError as err:
|
|
921
925
|
self.log.info("Retrying. Dataproc API returned server error when waiting for job: %s", err)
|
|
922
926
|
|
|
@@ -1268,7 +1272,7 @@ class DataprocHook(GoogleBaseHook):
|
|
|
1268
1272
|
return all([word in error_msg for word in key_words])
|
|
1269
1273
|
|
|
1270
1274
|
|
|
1271
|
-
class DataprocAsyncHook(
|
|
1275
|
+
class DataprocAsyncHook(GoogleBaseAsyncHook):
|
|
1272
1276
|
"""
|
|
1273
1277
|
Asynchronous interaction with Google Cloud Dataproc APIs.
|
|
1274
1278
|
|
|
@@ -1276,6 +1280,8 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1276
1280
|
keyword arguments rather than positional.
|
|
1277
1281
|
"""
|
|
1278
1282
|
|
|
1283
|
+
sync_hook_class = DataprocHook
|
|
1284
|
+
|
|
1279
1285
|
def __init__(
|
|
1280
1286
|
self,
|
|
1281
1287
|
gcp_conn_id: str = "google_cloud_default",
|
|
@@ -1285,53 +1291,90 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1285
1291
|
super().__init__(gcp_conn_id=gcp_conn_id, impersonation_chain=impersonation_chain, **kwargs)
|
|
1286
1292
|
self._cached_client: JobControllerAsyncClient | None = None
|
|
1287
1293
|
|
|
1288
|
-
def get_cluster_client(self, region: str | None = None) -> ClusterControllerAsyncClient:
|
|
1294
|
+
async def get_cluster_client(self, region: str | None = None) -> ClusterControllerAsyncClient:
|
|
1289
1295
|
"""Create a ClusterControllerAsyncClient."""
|
|
1290
1296
|
client_options = None
|
|
1291
1297
|
if region and region != "global":
|
|
1292
1298
|
client_options = ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
|
|
1293
1299
|
|
|
1300
|
+
sync_hook = await self.get_sync_hook()
|
|
1294
1301
|
return ClusterControllerAsyncClient(
|
|
1295
|
-
credentials=
|
|
1302
|
+
credentials=sync_hook.get_credentials(), client_info=CLIENT_INFO, client_options=client_options
|
|
1296
1303
|
)
|
|
1297
1304
|
|
|
1298
|
-
def get_template_client(self, region: str | None = None) -> WorkflowTemplateServiceAsyncClient:
|
|
1305
|
+
async def get_template_client(self, region: str | None = None) -> WorkflowTemplateServiceAsyncClient:
|
|
1299
1306
|
"""Create a WorkflowTemplateServiceAsyncClient."""
|
|
1300
1307
|
client_options = None
|
|
1301
1308
|
if region and region != "global":
|
|
1302
1309
|
client_options = ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
|
|
1303
1310
|
|
|
1311
|
+
sync_hook = await self.get_sync_hook()
|
|
1304
1312
|
return WorkflowTemplateServiceAsyncClient(
|
|
1305
|
-
credentials=
|
|
1313
|
+
credentials=sync_hook.get_credentials(), client_info=CLIENT_INFO, client_options=client_options
|
|
1306
1314
|
)
|
|
1307
1315
|
|
|
1308
|
-
def get_job_client(self, region: str | None = None) -> JobControllerAsyncClient:
|
|
1316
|
+
async def get_job_client(self, region: str | None = None) -> JobControllerAsyncClient:
|
|
1309
1317
|
"""Create a JobControllerAsyncClient."""
|
|
1310
1318
|
if self._cached_client is None:
|
|
1311
1319
|
client_options = None
|
|
1312
1320
|
if region and region != "global":
|
|
1313
1321
|
client_options = ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
|
|
1314
1322
|
|
|
1323
|
+
sync_hook = await self.get_sync_hook()
|
|
1315
1324
|
self._cached_client = JobControllerAsyncClient(
|
|
1316
|
-
credentials=
|
|
1325
|
+
credentials=sync_hook.get_credentials(),
|
|
1317
1326
|
client_info=CLIENT_INFO,
|
|
1318
1327
|
client_options=client_options,
|
|
1319
1328
|
)
|
|
1320
1329
|
return self._cached_client
|
|
1321
1330
|
|
|
1322
|
-
def get_batch_client(self, region: str | None = None) -> BatchControllerAsyncClient:
|
|
1331
|
+
async def get_batch_client(self, region: str | None = None) -> BatchControllerAsyncClient:
|
|
1323
1332
|
"""Create a BatchControllerAsyncClient."""
|
|
1324
1333
|
client_options = None
|
|
1325
1334
|
if region and region != "global":
|
|
1326
1335
|
client_options = ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
|
|
1327
1336
|
|
|
1337
|
+
sync_hook = await self.get_sync_hook()
|
|
1328
1338
|
return BatchControllerAsyncClient(
|
|
1329
|
-
credentials=
|
|
1339
|
+
credentials=sync_hook.get_credentials(), client_info=CLIENT_INFO, client_options=client_options
|
|
1330
1340
|
)
|
|
1331
1341
|
|
|
1332
|
-
def get_operations_client(self, region: str) -> OperationsClient:
|
|
1342
|
+
async def get_operations_client(self, region: str) -> OperationsClient:
|
|
1333
1343
|
"""Create a OperationsClient."""
|
|
1334
|
-
|
|
1344
|
+
template_client = await self.get_template_client(region=region)
|
|
1345
|
+
return template_client.transport.operations_client
|
|
1346
|
+
|
|
1347
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
1348
|
+
async def get_cluster(
|
|
1349
|
+
self,
|
|
1350
|
+
region: str,
|
|
1351
|
+
cluster_name: str,
|
|
1352
|
+
project_id: str,
|
|
1353
|
+
retry: AsyncRetry | _MethodDefault = DEFAULT,
|
|
1354
|
+
timeout: float | None = None,
|
|
1355
|
+
metadata: Sequence[tuple[str, str]] = (),
|
|
1356
|
+
) -> Cluster:
|
|
1357
|
+
"""
|
|
1358
|
+
Get a cluster.
|
|
1359
|
+
|
|
1360
|
+
:param region: Cloud Dataproc region in which to handle the request.
|
|
1361
|
+
:param cluster_name: Name of the cluster to get.
|
|
1362
|
+
:param project_id: Google Cloud project ID that the cluster belongs to.
|
|
1363
|
+
:param retry: A retry object used to retry requests. If *None*, requests
|
|
1364
|
+
will not be retried.
|
|
1365
|
+
:param timeout: The amount of time, in seconds, to wait for the request
|
|
1366
|
+
to complete. If *retry* is specified, the timeout applies to each
|
|
1367
|
+
individual attempt.
|
|
1368
|
+
:param metadata: Additional metadata that is provided to the method.
|
|
1369
|
+
"""
|
|
1370
|
+
client = await self.get_cluster_client(region=region)
|
|
1371
|
+
result = await client.get_cluster(
|
|
1372
|
+
request={"project_id": project_id, "region": region, "cluster_name": cluster_name},
|
|
1373
|
+
retry=retry,
|
|
1374
|
+
timeout=timeout,
|
|
1375
|
+
metadata=metadata,
|
|
1376
|
+
)
|
|
1377
|
+
return result
|
|
1335
1378
|
|
|
1336
1379
|
@GoogleBaseHook.fallback_to_default_project_id
|
|
1337
1380
|
async def create_cluster(
|
|
@@ -1389,7 +1432,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1389
1432
|
cluster["config"] = cluster_config # type: ignore
|
|
1390
1433
|
cluster["labels"] = labels # type: ignore
|
|
1391
1434
|
|
|
1392
|
-
client = self.get_cluster_client(region=region)
|
|
1435
|
+
client = await self.get_cluster_client(region=region)
|
|
1393
1436
|
result = await client.create_cluster(
|
|
1394
1437
|
request={
|
|
1395
1438
|
"project_id": project_id,
|
|
@@ -1434,7 +1477,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1434
1477
|
individual attempt.
|
|
1435
1478
|
:param metadata: Additional metadata that is provided to the method.
|
|
1436
1479
|
"""
|
|
1437
|
-
client = self.get_cluster_client(region=region)
|
|
1480
|
+
client = await self.get_cluster_client(region=region)
|
|
1438
1481
|
result = await client.delete_cluster(
|
|
1439
1482
|
request={
|
|
1440
1483
|
"project_id": project_id,
|
|
@@ -1482,7 +1525,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1482
1525
|
individual attempt.
|
|
1483
1526
|
:param metadata: Additional metadata that is provided to the method.
|
|
1484
1527
|
"""
|
|
1485
|
-
client = self.get_cluster_client(region=region)
|
|
1528
|
+
client = await self.get_cluster_client(region=region)
|
|
1486
1529
|
result = await client.diagnose_cluster(
|
|
1487
1530
|
request={
|
|
1488
1531
|
"project_id": project_id,
|
|
@@ -1499,38 +1542,6 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1499
1542
|
)
|
|
1500
1543
|
return result
|
|
1501
1544
|
|
|
1502
|
-
@GoogleBaseHook.fallback_to_default_project_id
|
|
1503
|
-
async def get_cluster(
|
|
1504
|
-
self,
|
|
1505
|
-
region: str,
|
|
1506
|
-
cluster_name: str,
|
|
1507
|
-
project_id: str,
|
|
1508
|
-
retry: AsyncRetry | _MethodDefault = DEFAULT,
|
|
1509
|
-
timeout: float | None = None,
|
|
1510
|
-
metadata: Sequence[tuple[str, str]] = (),
|
|
1511
|
-
) -> Cluster:
|
|
1512
|
-
"""
|
|
1513
|
-
Get the resource representation for a cluster in a project.
|
|
1514
|
-
|
|
1515
|
-
:param project_id: Google Cloud project ID that the cluster belongs to.
|
|
1516
|
-
:param region: Cloud Dataproc region to handle the request.
|
|
1517
|
-
:param cluster_name: The cluster name.
|
|
1518
|
-
:param retry: A retry object used to retry requests. If *None*, requests
|
|
1519
|
-
will not be retried.
|
|
1520
|
-
:param timeout: The amount of time, in seconds, to wait for the request
|
|
1521
|
-
to complete. If *retry* is specified, the timeout applies to each
|
|
1522
|
-
individual attempt.
|
|
1523
|
-
:param metadata: Additional metadata that is provided to the method.
|
|
1524
|
-
"""
|
|
1525
|
-
client = self.get_cluster_client(region=region)
|
|
1526
|
-
result = await client.get_cluster(
|
|
1527
|
-
request={"project_id": project_id, "region": region, "cluster_name": cluster_name},
|
|
1528
|
-
retry=retry,
|
|
1529
|
-
timeout=timeout,
|
|
1530
|
-
metadata=metadata,
|
|
1531
|
-
)
|
|
1532
|
-
return result
|
|
1533
|
-
|
|
1534
1545
|
@GoogleBaseHook.fallback_to_default_project_id
|
|
1535
1546
|
async def list_clusters(
|
|
1536
1547
|
self,
|
|
@@ -1560,7 +1571,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1560
1571
|
individual attempt.
|
|
1561
1572
|
:param metadata: Additional metadata that is provided to the method.
|
|
1562
1573
|
"""
|
|
1563
|
-
client = self.get_cluster_client(region=region)
|
|
1574
|
+
client = await self.get_cluster_client(region=region)
|
|
1564
1575
|
result = await client.list_clusters(
|
|
1565
1576
|
request={"project_id": project_id, "region": region, "filter": filter_, "page_size": page_size},
|
|
1566
1577
|
retry=retry,
|
|
@@ -1637,7 +1648,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1637
1648
|
"""
|
|
1638
1649
|
if region is None:
|
|
1639
1650
|
raise TypeError("missing 1 required keyword argument: 'region'")
|
|
1640
|
-
client = self.get_cluster_client(region=region)
|
|
1651
|
+
client = await self.get_cluster_client(region=region)
|
|
1641
1652
|
operation = await client.update_cluster(
|
|
1642
1653
|
request={
|
|
1643
1654
|
"project_id": project_id,
|
|
@@ -1679,10 +1690,8 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1679
1690
|
individual attempt.
|
|
1680
1691
|
:param metadata: Additional metadata that is provided to the method.
|
|
1681
1692
|
"""
|
|
1682
|
-
if region is None:
|
|
1683
|
-
raise TypeError("missing 1 required keyword argument: 'region'")
|
|
1684
1693
|
metadata = metadata or ()
|
|
1685
|
-
client = self.get_template_client(region)
|
|
1694
|
+
client = await self.get_template_client(region)
|
|
1686
1695
|
parent = f"projects/{project_id}/regions/{region}"
|
|
1687
1696
|
return await client.create_workflow_template(
|
|
1688
1697
|
request={"parent": parent, "template": template}, retry=retry, timeout=timeout, metadata=metadata
|
|
@@ -1724,10 +1733,8 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1724
1733
|
individual attempt.
|
|
1725
1734
|
:param metadata: Additional metadata that is provided to the method.
|
|
1726
1735
|
"""
|
|
1727
|
-
if region is None:
|
|
1728
|
-
raise TypeError("missing 1 required keyword argument: 'region'")
|
|
1729
1736
|
metadata = metadata or ()
|
|
1730
|
-
client = self.get_template_client(region)
|
|
1737
|
+
client = await self.get_template_client(region)
|
|
1731
1738
|
name = f"projects/{project_id}/regions/{region}/workflowTemplates/{template_name}"
|
|
1732
1739
|
operation = await client.instantiate_workflow_template(
|
|
1733
1740
|
request={"name": name, "version": version, "request_id": request_id, "parameters": parameters},
|
|
@@ -1766,10 +1773,8 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1766
1773
|
individual attempt.
|
|
1767
1774
|
:param metadata: Additional metadata that is provided to the method.
|
|
1768
1775
|
"""
|
|
1769
|
-
if region is None:
|
|
1770
|
-
raise TypeError("missing 1 required keyword argument: 'region'")
|
|
1771
1776
|
metadata = metadata or ()
|
|
1772
|
-
client = self.get_template_client(region)
|
|
1777
|
+
client = await self.get_template_client(region)
|
|
1773
1778
|
parent = f"projects/{project_id}/regions/{region}"
|
|
1774
1779
|
operation = await client.instantiate_inline_workflow_template(
|
|
1775
1780
|
request={"parent": parent, "template": template, "request_id": request_id},
|
|
@@ -1780,7 +1785,8 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1780
1785
|
return operation
|
|
1781
1786
|
|
|
1782
1787
|
async def get_operation(self, region, operation_name):
|
|
1783
|
-
|
|
1788
|
+
operations_client = await self.get_operations_client(region)
|
|
1789
|
+
return await operations_client.get_operation(name=operation_name)
|
|
1784
1790
|
|
|
1785
1791
|
@GoogleBaseHook.fallback_to_default_project_id
|
|
1786
1792
|
async def get_job(
|
|
@@ -1805,9 +1811,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1805
1811
|
individual attempt.
|
|
1806
1812
|
:param metadata: Additional metadata that is provided to the method.
|
|
1807
1813
|
"""
|
|
1808
|
-
|
|
1809
|
-
raise TypeError("missing 1 required keyword argument: 'region'")
|
|
1810
|
-
client = self.get_job_client(region=region)
|
|
1814
|
+
client = await self.get_job_client(region=region)
|
|
1811
1815
|
job = await client.get_job(
|
|
1812
1816
|
request={"project_id": project_id, "region": region, "job_id": job_id},
|
|
1813
1817
|
retry=retry,
|
|
@@ -1844,9 +1848,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1844
1848
|
individual attempt.
|
|
1845
1849
|
:param metadata: Additional metadata that is provided to the method.
|
|
1846
1850
|
"""
|
|
1847
|
-
|
|
1848
|
-
raise TypeError("missing 1 required keyword argument: 'region'")
|
|
1849
|
-
client = self.get_job_client(region=region)
|
|
1851
|
+
client = await self.get_job_client(region=region)
|
|
1850
1852
|
return await client.submit_job(
|
|
1851
1853
|
request={"project_id": project_id, "region": region, "job": job, "request_id": request_id},
|
|
1852
1854
|
retry=retry,
|
|
@@ -1877,7 +1879,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1877
1879
|
individual attempt.
|
|
1878
1880
|
:param metadata: Additional metadata that is provided to the method.
|
|
1879
1881
|
"""
|
|
1880
|
-
client = self.get_job_client(region=region)
|
|
1882
|
+
client = await self.get_job_client(region=region)
|
|
1881
1883
|
|
|
1882
1884
|
job = await client.cancel_job(
|
|
1883
1885
|
request={"project_id": project_id, "region": region, "job_id": job_id},
|
|
@@ -1919,7 +1921,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1919
1921
|
individual attempt.
|
|
1920
1922
|
:param metadata: Additional metadata that is provided to the method.
|
|
1921
1923
|
"""
|
|
1922
|
-
client = self.get_batch_client(region)
|
|
1924
|
+
client = await self.get_batch_client(region)
|
|
1923
1925
|
parent = f"projects/{project_id}/regions/{region}"
|
|
1924
1926
|
|
|
1925
1927
|
result = await client.create_batch(
|
|
@@ -1958,7 +1960,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1958
1960
|
individual attempt.
|
|
1959
1961
|
:param metadata: Additional metadata that is provided to the method.
|
|
1960
1962
|
"""
|
|
1961
|
-
client = self.get_batch_client(region)
|
|
1963
|
+
client = await self.get_batch_client(region)
|
|
1962
1964
|
name = f"projects/{project_id}/locations/{region}/batches/{batch_id}"
|
|
1963
1965
|
|
|
1964
1966
|
await client.delete_batch(
|
|
@@ -1993,7 +1995,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
1993
1995
|
individual attempt.
|
|
1994
1996
|
:param metadata: Additional metadata that is provided to the method.
|
|
1995
1997
|
"""
|
|
1996
|
-
client = self.get_batch_client(region)
|
|
1998
|
+
client = await self.get_batch_client(region)
|
|
1997
1999
|
name = f"projects/{project_id}/locations/{region}/batches/{batch_id}"
|
|
1998
2000
|
|
|
1999
2001
|
result = await client.get_batch(
|
|
@@ -2038,7 +2040,7 @@ class DataprocAsyncHook(GoogleBaseHook):
|
|
|
2038
2040
|
:param filter: Result filters as specified in ListBatchesRequest
|
|
2039
2041
|
:param order_by: How to order results as specified in ListBatchesRequest
|
|
2040
2042
|
"""
|
|
2041
|
-
client = self.get_batch_client(region)
|
|
2043
|
+
client = await self.get_batch_client(region)
|
|
2042
2044
|
parent = f"projects/{project_id}/regions/{region}"
|
|
2043
2045
|
|
|
2044
2046
|
result = await client.list_batches(
|
|
@@ -22,13 +22,14 @@ from __future__ import annotations
|
|
|
22
22
|
from collections.abc import Sequence
|
|
23
23
|
from typing import TYPE_CHECKING, Any
|
|
24
24
|
|
|
25
|
-
from airflow.exceptions import AirflowException
|
|
26
|
-
from airflow.providers.google.common.consts import CLIENT_INFO
|
|
27
|
-
from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
|
|
28
25
|
from google.api_core.client_options import ClientOptions
|
|
29
26
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
|
30
27
|
from google.cloud.metastore_v1 import DataprocMetastoreClient
|
|
31
28
|
|
|
29
|
+
from airflow.exceptions import AirflowException
|
|
30
|
+
from airflow.providers.google.common.consts import CLIENT_INFO
|
|
31
|
+
from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
|
|
32
|
+
|
|
32
33
|
if TYPE_CHECKING:
|
|
33
34
|
from google.api_core.operation import Operation
|
|
34
35
|
from google.api_core.retry import Retry
|
|
@@ -31,9 +31,6 @@ import time
|
|
|
31
31
|
from collections.abc import Sequence
|
|
32
32
|
from typing import TYPE_CHECKING
|
|
33
33
|
|
|
34
|
-
from airflow.exceptions import AirflowException
|
|
35
|
-
from airflow.providers.google.common.consts import CLIENT_INFO
|
|
36
|
-
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
|
|
37
34
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
|
38
35
|
from google.cloud.dlp import DlpServiceClient
|
|
39
36
|
from google.cloud.dlp_v2.types import (
|
|
@@ -58,6 +55,10 @@ from google.cloud.dlp_v2.types import (
|
|
|
58
55
|
)
|
|
59
56
|
from google.protobuf.field_mask_pb2 import FieldMask
|
|
60
57
|
|
|
58
|
+
from airflow.exceptions import AirflowException
|
|
59
|
+
from airflow.providers.google.common.consts import CLIENT_INFO
|
|
60
|
+
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
|
|
61
|
+
|
|
61
62
|
if TYPE_CHECKING:
|
|
62
63
|
from google.api_core.retry import Retry
|
|
63
64
|
|
|
@@ -267,7 +268,7 @@ class CloudDLPHook(GoogleBaseHook):
|
|
|
267
268
|
|
|
268
269
|
if job.state == DlpJob.JobState.DONE:
|
|
269
270
|
return job
|
|
270
|
-
|
|
271
|
+
if job.state in [
|
|
271
272
|
DlpJob.JobState.PENDING,
|
|
272
273
|
DlpJob.JobState.RUNNING,
|
|
273
274
|
DlpJob.JobState.JOB_STATE_UNSPECIFIED,
|