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
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
-
# or more contributor license agreements. See the NOTICE file
|
|
4
|
-
# distributed with this work for additional information
|
|
5
|
-
# regarding copyright ownership. The ASF licenses this file
|
|
6
|
-
# to you under the Apache License, Version 2.0 (the
|
|
7
|
-
# "License"); you may not use this file except in compliance
|
|
8
|
-
# with the License. You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing,
|
|
13
|
-
# software distributed under the License is distributed on an
|
|
14
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
-
# KIND, either express or implied. See the License for the
|
|
16
|
-
# specific language governing permissions and limitations
|
|
17
|
-
# under the License.
|
|
18
|
-
"""Hook for Google Cloud Life Sciences service."""
|
|
19
|
-
|
|
20
|
-
from __future__ import annotations
|
|
21
|
-
|
|
22
|
-
import time
|
|
23
|
-
from collections.abc import Sequence
|
|
24
|
-
|
|
25
|
-
from googleapiclient.discovery import build
|
|
26
|
-
|
|
27
|
-
import google.api_core.path_template
|
|
28
|
-
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
|
|
29
|
-
from airflow.providers.google.common.deprecated import deprecated
|
|
30
|
-
from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
|
|
31
|
-
|
|
32
|
-
# Time to sleep between active checks of the operation results
|
|
33
|
-
TIME_TO_SLEEP_IN_SECONDS = 5
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@deprecated(
|
|
37
|
-
planned_removal_date="March 01, 2025",
|
|
38
|
-
use_instead="Google Cloud Batch Operators' hook",
|
|
39
|
-
reason="The Life Sciences API (beta) will be discontinued on July 8, 2025 "
|
|
40
|
-
"in favor of Google Cloud Batch.",
|
|
41
|
-
category=AirflowProviderDeprecationWarning,
|
|
42
|
-
)
|
|
43
|
-
class LifeSciencesHook(GoogleBaseHook):
|
|
44
|
-
"""
|
|
45
|
-
Hook for the Google Cloud Life Sciences APIs.
|
|
46
|
-
|
|
47
|
-
.. warning::
|
|
48
|
-
This hook is deprecated. Consider using Google Cloud Batch Operators' hook instead.
|
|
49
|
-
The Life Sciences API (beta) will be discontinued on July 8, 2025 in favor
|
|
50
|
-
of Google Cloud Batch.
|
|
51
|
-
|
|
52
|
-
All the methods in the hook where project_id is used must be called with
|
|
53
|
-
keyword arguments rather than positional.
|
|
54
|
-
|
|
55
|
-
:param api_version: API version used (for example v1 or v1beta1).
|
|
56
|
-
:param gcp_conn_id: The connection ID to use when fetching connection info.
|
|
57
|
-
:param impersonation_chain: Optional service account to impersonate using short-term
|
|
58
|
-
credentials, or chained list of accounts required to get the access_token
|
|
59
|
-
of the last account in the list, which will be impersonated in the request.
|
|
60
|
-
If set as a string, the account must grant the originating account
|
|
61
|
-
the Service Account Token Creator IAM role.
|
|
62
|
-
If set as a sequence, the identities from the list must grant
|
|
63
|
-
Service Account Token Creator IAM role to the directly preceding identity, with first
|
|
64
|
-
account from the list granting this role to the originating account.
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
_conn: build | None = None
|
|
68
|
-
|
|
69
|
-
def __init__(
|
|
70
|
-
self,
|
|
71
|
-
api_version: str = "v2beta",
|
|
72
|
-
gcp_conn_id: str = "google_cloud_default",
|
|
73
|
-
impersonation_chain: str | Sequence[str] | None = None,
|
|
74
|
-
**kwargs,
|
|
75
|
-
) -> None:
|
|
76
|
-
super().__init__(
|
|
77
|
-
gcp_conn_id=gcp_conn_id,
|
|
78
|
-
impersonation_chain=impersonation_chain,
|
|
79
|
-
**kwargs,
|
|
80
|
-
)
|
|
81
|
-
self.api_version = api_version
|
|
82
|
-
|
|
83
|
-
def get_conn(self) -> build:
|
|
84
|
-
"""
|
|
85
|
-
Retrieve the connection to Cloud Life Sciences.
|
|
86
|
-
|
|
87
|
-
:return: Google Cloud Life Sciences service object.
|
|
88
|
-
"""
|
|
89
|
-
if not self._conn:
|
|
90
|
-
http_authorized = self._authorize()
|
|
91
|
-
self._conn = build("lifesciences", self.api_version, http=http_authorized, cache_discovery=False)
|
|
92
|
-
return self._conn
|
|
93
|
-
|
|
94
|
-
@GoogleBaseHook.fallback_to_default_project_id
|
|
95
|
-
def run_pipeline(self, body: dict, location: str, project_id: str) -> dict:
|
|
96
|
-
"""
|
|
97
|
-
Run a pipeline.
|
|
98
|
-
|
|
99
|
-
:param body: The request body.
|
|
100
|
-
:param location: The location of the project. For example: "us-east1".
|
|
101
|
-
:param project_id: Optional, Google Cloud Project project_id where the function belongs.
|
|
102
|
-
If set to None or missing, the default project_id from the Google Cloud connection is used.
|
|
103
|
-
"""
|
|
104
|
-
parent = self._location_path(project_id=project_id, location=location)
|
|
105
|
-
service = self.get_conn()
|
|
106
|
-
|
|
107
|
-
request = service.projects().locations().pipelines().run(parent=parent, body=body)
|
|
108
|
-
|
|
109
|
-
response = request.execute(num_retries=self.num_retries)
|
|
110
|
-
|
|
111
|
-
# wait
|
|
112
|
-
operation_name = response["name"]
|
|
113
|
-
self._wait_for_operation_to_complete(operation_name)
|
|
114
|
-
|
|
115
|
-
return response
|
|
116
|
-
|
|
117
|
-
@GoogleBaseHook.fallback_to_default_project_id
|
|
118
|
-
def _location_path(self, project_id: str, location: str) -> str:
|
|
119
|
-
"""
|
|
120
|
-
Return a location string.
|
|
121
|
-
|
|
122
|
-
:param project_id: Optional, Google Cloud Project project_id where the
|
|
123
|
-
function belongs. If set to None or missing, the default project_id
|
|
124
|
-
from the Google Cloud connection is used.
|
|
125
|
-
:param location: The location of the project. For example: "us-east1".
|
|
126
|
-
"""
|
|
127
|
-
return google.api_core.path_template.expand(
|
|
128
|
-
"projects/{project}/locations/{location}",
|
|
129
|
-
project=project_id,
|
|
130
|
-
location=location,
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
def _wait_for_operation_to_complete(self, operation_name: str) -> None:
|
|
134
|
-
"""
|
|
135
|
-
Wait for the named operation to complete - checks status of the asynchronous call.
|
|
136
|
-
|
|
137
|
-
:param operation_name: The name of the operation.
|
|
138
|
-
:return: The response returned by the operation.
|
|
139
|
-
:exception: AirflowException in case error is returned.
|
|
140
|
-
"""
|
|
141
|
-
service = self.get_conn()
|
|
142
|
-
while True:
|
|
143
|
-
operation_response = (
|
|
144
|
-
service.projects()
|
|
145
|
-
.locations()
|
|
146
|
-
.operations()
|
|
147
|
-
.get(name=operation_name)
|
|
148
|
-
.execute(num_retries=self.num_retries)
|
|
149
|
-
)
|
|
150
|
-
self.log.info("Waiting for pipeline operation to complete")
|
|
151
|
-
if operation_response.get("done"):
|
|
152
|
-
response = operation_response.get("response")
|
|
153
|
-
error = operation_response.get("error")
|
|
154
|
-
# Note, according to documentation always either response or error is
|
|
155
|
-
# set when "done" == True
|
|
156
|
-
if error:
|
|
157
|
-
raise AirflowException(str(error))
|
|
158
|
-
return response
|
|
159
|
-
time.sleep(TIME_TO_SLEEP_IN_SECONDS)
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
-
# or more contributor license agreements. See the NOTICE file
|
|
4
|
-
# distributed with this work for additional information
|
|
5
|
-
# regarding copyright ownership. The ASF licenses this file
|
|
6
|
-
# to you under the Apache License, Version 2.0 (the
|
|
7
|
-
# "License"); you may not use this file except in compliance
|
|
8
|
-
# with the License. You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing,
|
|
13
|
-
# software distributed under the License is distributed on an
|
|
14
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
-
# KIND, either express or implied. See the License for the
|
|
16
|
-
# specific language governing permissions and limitations
|
|
17
|
-
# under the License.
|
|
18
|
-
"""This module contains Google AutoML links."""
|
|
19
|
-
|
|
20
|
-
from __future__ import annotations
|
|
21
|
-
|
|
22
|
-
from typing import TYPE_CHECKING
|
|
23
|
-
|
|
24
|
-
from airflow.exceptions import AirflowProviderDeprecationWarning
|
|
25
|
-
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
|
26
|
-
from airflow.providers.google.common.deprecated import deprecated
|
|
27
|
-
|
|
28
|
-
if TYPE_CHECKING:
|
|
29
|
-
from airflow.utils.context import Context
|
|
30
|
-
|
|
31
|
-
AUTOML_BASE_LINK = "https://console.cloud.google.com/automl-tables"
|
|
32
|
-
AUTOML_DATASET_LINK = (
|
|
33
|
-
AUTOML_BASE_LINK + "/locations/{location}/datasets/{dataset_id}/schemav2?project={project_id}"
|
|
34
|
-
)
|
|
35
|
-
AUTOML_DATASET_LIST_LINK = AUTOML_BASE_LINK + "/datasets?project={project_id}"
|
|
36
|
-
AUTOML_MODEL_LINK = (
|
|
37
|
-
AUTOML_BASE_LINK
|
|
38
|
-
+ "/locations/{location}/datasets/{dataset_id};modelId={model_id}/evaluate?project={project_id}"
|
|
39
|
-
)
|
|
40
|
-
AUTOML_MODEL_TRAIN_LINK = (
|
|
41
|
-
AUTOML_BASE_LINK + "/locations/{location}/datasets/{dataset_id}/train?project={project_id}"
|
|
42
|
-
)
|
|
43
|
-
AUTOML_MODEL_PREDICT_LINK = (
|
|
44
|
-
AUTOML_BASE_LINK
|
|
45
|
-
+ "/locations/{location}/datasets/{dataset_id};modelId={model_id}/predict?project={project_id}"
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
@deprecated(
|
|
50
|
-
planned_removal_date="December 31, 2024",
|
|
51
|
-
use_instead="TranslationLegacyDatasetLink class from airflow/providers/google/cloud/links/translate.py",
|
|
52
|
-
category=AirflowProviderDeprecationWarning,
|
|
53
|
-
)
|
|
54
|
-
class AutoMLDatasetLink(BaseGoogleLink):
|
|
55
|
-
"""Helper class for constructing AutoML Dataset link."""
|
|
56
|
-
|
|
57
|
-
name = "AutoML Dataset"
|
|
58
|
-
key = "automl_dataset"
|
|
59
|
-
format_str = AUTOML_DATASET_LINK
|
|
60
|
-
|
|
61
|
-
@staticmethod
|
|
62
|
-
def persist(
|
|
63
|
-
context: Context,
|
|
64
|
-
task_instance,
|
|
65
|
-
dataset_id: str,
|
|
66
|
-
project_id: str,
|
|
67
|
-
):
|
|
68
|
-
task_instance.xcom_push(
|
|
69
|
-
context,
|
|
70
|
-
key=AutoMLDatasetLink.key,
|
|
71
|
-
value={"location": task_instance.location, "dataset_id": dataset_id, "project_id": project_id},
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
@deprecated(
|
|
76
|
-
planned_removal_date="December 31, 2024",
|
|
77
|
-
use_instead="TranslationDatasetListLink class from airflow/providers/google/cloud/links/translate.py",
|
|
78
|
-
category=AirflowProviderDeprecationWarning,
|
|
79
|
-
)
|
|
80
|
-
class AutoMLDatasetListLink(BaseGoogleLink):
|
|
81
|
-
"""Helper class for constructing AutoML Dataset List link."""
|
|
82
|
-
|
|
83
|
-
name = "AutoML Dataset List"
|
|
84
|
-
key = "automl_dataset_list"
|
|
85
|
-
format_str = AUTOML_DATASET_LIST_LINK
|
|
86
|
-
|
|
87
|
-
@staticmethod
|
|
88
|
-
def persist(
|
|
89
|
-
context: Context,
|
|
90
|
-
task_instance,
|
|
91
|
-
project_id: str,
|
|
92
|
-
):
|
|
93
|
-
task_instance.xcom_push(
|
|
94
|
-
context,
|
|
95
|
-
key=AutoMLDatasetListLink.key,
|
|
96
|
-
value={
|
|
97
|
-
"project_id": project_id,
|
|
98
|
-
},
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
@deprecated(
|
|
103
|
-
planned_removal_date="December 31, 2024",
|
|
104
|
-
use_instead="TranslationLegacyModelLink class from airflow/providers/google/cloud/links/translate.py",
|
|
105
|
-
category=AirflowProviderDeprecationWarning,
|
|
106
|
-
)
|
|
107
|
-
class AutoMLModelLink(BaseGoogleLink):
|
|
108
|
-
"""Helper class for constructing AutoML Model link."""
|
|
109
|
-
|
|
110
|
-
name = "AutoML Model"
|
|
111
|
-
key = "automl_model"
|
|
112
|
-
format_str = AUTOML_MODEL_LINK
|
|
113
|
-
|
|
114
|
-
@staticmethod
|
|
115
|
-
def persist(
|
|
116
|
-
context: Context,
|
|
117
|
-
task_instance,
|
|
118
|
-
dataset_id: str,
|
|
119
|
-
model_id: str,
|
|
120
|
-
project_id: str,
|
|
121
|
-
):
|
|
122
|
-
task_instance.xcom_push(
|
|
123
|
-
context,
|
|
124
|
-
key=AutoMLModelLink.key,
|
|
125
|
-
value={
|
|
126
|
-
"location": task_instance.location,
|
|
127
|
-
"dataset_id": dataset_id,
|
|
128
|
-
"model_id": model_id,
|
|
129
|
-
"project_id": project_id,
|
|
130
|
-
},
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
@deprecated(
|
|
135
|
-
planned_removal_date="December 31, 2024",
|
|
136
|
-
use_instead="TranslationLegacyModelTrainLink class from "
|
|
137
|
-
"airflow/providers/google/cloud/links/translate.py",
|
|
138
|
-
category=AirflowProviderDeprecationWarning,
|
|
139
|
-
)
|
|
140
|
-
class AutoMLModelTrainLink(BaseGoogleLink):
|
|
141
|
-
"""Helper class for constructing AutoML Model Train link."""
|
|
142
|
-
|
|
143
|
-
name = "AutoML Model Train"
|
|
144
|
-
key = "automl_model_train"
|
|
145
|
-
format_str = AUTOML_MODEL_TRAIN_LINK
|
|
146
|
-
|
|
147
|
-
@staticmethod
|
|
148
|
-
def persist(
|
|
149
|
-
context: Context,
|
|
150
|
-
task_instance,
|
|
151
|
-
project_id: str,
|
|
152
|
-
):
|
|
153
|
-
task_instance.xcom_push(
|
|
154
|
-
context,
|
|
155
|
-
key=AutoMLModelTrainLink.key,
|
|
156
|
-
value={
|
|
157
|
-
"location": task_instance.location,
|
|
158
|
-
"dataset_id": task_instance.model["dataset_id"],
|
|
159
|
-
"project_id": project_id,
|
|
160
|
-
},
|
|
161
|
-
)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
@deprecated(
|
|
165
|
-
planned_removal_date="December 31, 2024",
|
|
166
|
-
use_instead="TranslationLegacyModelPredictLink class from "
|
|
167
|
-
"airflow/providers/google/cloud/links/translate.py",
|
|
168
|
-
category=AirflowProviderDeprecationWarning,
|
|
169
|
-
)
|
|
170
|
-
class AutoMLModelPredictLink(BaseGoogleLink):
|
|
171
|
-
"""Helper class for constructing AutoML Model Predict link."""
|
|
172
|
-
|
|
173
|
-
name = "AutoML Model Predict"
|
|
174
|
-
key = "automl_model_predict"
|
|
175
|
-
format_str = AUTOML_MODEL_PREDICT_LINK
|
|
176
|
-
|
|
177
|
-
@staticmethod
|
|
178
|
-
def persist(
|
|
179
|
-
context: Context,
|
|
180
|
-
task_instance,
|
|
181
|
-
model_id: str,
|
|
182
|
-
project_id: str,
|
|
183
|
-
):
|
|
184
|
-
task_instance.xcom_push(
|
|
185
|
-
context,
|
|
186
|
-
key=AutoMLModelPredictLink.key,
|
|
187
|
-
value={
|
|
188
|
-
"location": task_instance.location,
|
|
189
|
-
"dataset_id": "-",
|
|
190
|
-
"model_id": model_id,
|
|
191
|
-
"project_id": project_id,
|
|
192
|
-
},
|
|
193
|
-
)
|