apache-airflow-providers-google 12.0.0rc1__py3-none-any.whl → 13.0.0__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/LICENSE +0 -52
- airflow/providers/google/__init__.py +1 -1
- airflow/providers/google/ads/hooks/ads.py +27 -13
- airflow/providers/google/ads/transfers/ads_to_gcs.py +18 -4
- airflow/providers/google/assets/bigquery.py +17 -0
- airflow/providers/google/cloud/_internal_client/secret_manager_client.py +2 -3
- airflow/providers/google/cloud/hooks/alloy_db.py +736 -8
- airflow/providers/google/cloud/hooks/automl.py +10 -4
- airflow/providers/google/cloud/hooks/bigquery.py +125 -22
- airflow/providers/google/cloud/hooks/bigquery_dts.py +8 -8
- airflow/providers/google/cloud/hooks/bigtable.py +2 -3
- airflow/providers/google/cloud/hooks/cloud_batch.py +3 -4
- airflow/providers/google/cloud/hooks/cloud_build.py +4 -5
- airflow/providers/google/cloud/hooks/cloud_composer.py +3 -4
- airflow/providers/google/cloud/hooks/cloud_memorystore.py +3 -4
- airflow/providers/google/cloud/hooks/cloud_run.py +3 -4
- airflow/providers/google/cloud/hooks/cloud_sql.py +7 -3
- airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +119 -7
- airflow/providers/google/cloud/hooks/compute.py +3 -3
- airflow/providers/google/cloud/hooks/datacatalog.py +3 -4
- airflow/providers/google/cloud/hooks/dataflow.py +12 -12
- airflow/providers/google/cloud/hooks/dataform.py +2 -3
- airflow/providers/google/cloud/hooks/datafusion.py +2 -2
- airflow/providers/google/cloud/hooks/dataplex.py +1032 -11
- airflow/providers/google/cloud/hooks/dataproc.py +4 -5
- airflow/providers/google/cloud/hooks/dataproc_metastore.py +3 -4
- airflow/providers/google/cloud/hooks/dlp.py +3 -4
- airflow/providers/google/cloud/hooks/gcs.py +7 -6
- airflow/providers/google/cloud/hooks/kms.py +2 -3
- airflow/providers/google/cloud/hooks/kubernetes_engine.py +8 -8
- airflow/providers/google/cloud/hooks/life_sciences.py +1 -1
- airflow/providers/google/cloud/hooks/managed_kafka.py +482 -0
- airflow/providers/google/cloud/hooks/natural_language.py +2 -3
- airflow/providers/google/cloud/hooks/os_login.py +2 -3
- airflow/providers/google/cloud/hooks/pubsub.py +6 -6
- airflow/providers/google/cloud/hooks/secret_manager.py +2 -3
- airflow/providers/google/cloud/hooks/spanner.py +2 -2
- airflow/providers/google/cloud/hooks/speech_to_text.py +2 -3
- airflow/providers/google/cloud/hooks/stackdriver.py +4 -4
- airflow/providers/google/cloud/hooks/tasks.py +3 -4
- airflow/providers/google/cloud/hooks/text_to_speech.py +2 -3
- airflow/providers/google/cloud/hooks/translate.py +236 -5
- airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +9 -4
- airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +3 -4
- airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +4 -5
- airflow/providers/google/cloud/hooks/vertex_ai/dataset.py +3 -4
- airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py +2 -3
- airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +3 -4
- airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +1 -181
- airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +3 -4
- airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +2 -3
- airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +3 -4
- airflow/providers/google/cloud/hooks/vertex_ai/prediction_service.py +2 -3
- airflow/providers/google/cloud/hooks/video_intelligence.py +2 -3
- airflow/providers/google/cloud/hooks/vision.py +3 -4
- airflow/providers/google/cloud/hooks/workflows.py +2 -3
- airflow/providers/google/cloud/links/alloy_db.py +46 -0
- airflow/providers/google/cloud/links/bigquery.py +25 -0
- airflow/providers/google/cloud/links/dataplex.py +172 -2
- airflow/providers/google/cloud/links/kubernetes_engine.py +1 -2
- airflow/providers/google/cloud/links/managed_kafka.py +104 -0
- airflow/providers/google/cloud/links/translate.py +28 -0
- airflow/providers/google/cloud/log/gcs_task_handler.py +3 -3
- airflow/providers/google/cloud/log/stackdriver_task_handler.py +11 -10
- airflow/providers/google/cloud/openlineage/facets.py +67 -0
- airflow/providers/google/cloud/openlineage/mixins.py +438 -173
- airflow/providers/google/cloud/openlineage/utils.py +394 -61
- airflow/providers/google/cloud/operators/alloy_db.py +980 -69
- airflow/providers/google/cloud/operators/automl.py +83 -245
- airflow/providers/google/cloud/operators/bigquery.py +377 -74
- airflow/providers/google/cloud/operators/bigquery_dts.py +126 -13
- airflow/providers/google/cloud/operators/bigtable.py +1 -3
- airflow/providers/google/cloud/operators/cloud_base.py +1 -2
- airflow/providers/google/cloud/operators/cloud_batch.py +2 -4
- airflow/providers/google/cloud/operators/cloud_build.py +3 -5
- airflow/providers/google/cloud/operators/cloud_composer.py +5 -7
- airflow/providers/google/cloud/operators/cloud_memorystore.py +4 -6
- airflow/providers/google/cloud/operators/cloud_run.py +6 -5
- airflow/providers/google/cloud/operators/cloud_sql.py +20 -8
- airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +62 -8
- airflow/providers/google/cloud/operators/compute.py +3 -4
- airflow/providers/google/cloud/operators/datacatalog.py +9 -11
- airflow/providers/google/cloud/operators/dataflow.py +1 -112
- airflow/providers/google/cloud/operators/dataform.py +3 -5
- airflow/providers/google/cloud/operators/datafusion.py +1 -1
- airflow/providers/google/cloud/operators/dataplex.py +2046 -7
- airflow/providers/google/cloud/operators/dataproc.py +102 -17
- airflow/providers/google/cloud/operators/dataproc_metastore.py +7 -9
- airflow/providers/google/cloud/operators/dlp.py +17 -19
- airflow/providers/google/cloud/operators/gcs.py +14 -17
- airflow/providers/google/cloud/operators/kubernetes_engine.py +2 -2
- airflow/providers/google/cloud/operators/managed_kafka.py +788 -0
- airflow/providers/google/cloud/operators/natural_language.py +3 -5
- airflow/providers/google/cloud/operators/pubsub.py +39 -7
- airflow/providers/google/cloud/operators/speech_to_text.py +3 -5
- airflow/providers/google/cloud/operators/stackdriver.py +3 -5
- airflow/providers/google/cloud/operators/tasks.py +4 -6
- airflow/providers/google/cloud/operators/text_to_speech.py +2 -4
- airflow/providers/google/cloud/operators/translate.py +414 -5
- airflow/providers/google/cloud/operators/translate_speech.py +2 -4
- airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +9 -8
- airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +4 -6
- airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +6 -8
- airflow/providers/google/cloud/operators/vertex_ai/dataset.py +4 -6
- airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +4 -6
- airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +0 -322
- airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +4 -6
- airflow/providers/google/cloud/operators/vertex_ai/model_service.py +4 -6
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +4 -6
- airflow/providers/google/cloud/operators/video_intelligence.py +3 -5
- airflow/providers/google/cloud/operators/vision.py +4 -6
- airflow/providers/google/cloud/operators/workflows.py +5 -7
- airflow/providers/google/cloud/secrets/secret_manager.py +1 -2
- airflow/providers/google/cloud/sensors/bigquery_dts.py +3 -5
- airflow/providers/google/cloud/sensors/bigtable.py +2 -3
- airflow/providers/google/cloud/sensors/cloud_composer.py +32 -8
- airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +39 -1
- airflow/providers/google/cloud/sensors/dataplex.py +4 -6
- airflow/providers/google/cloud/sensors/dataproc.py +2 -3
- airflow/providers/google/cloud/sensors/dataproc_metastore.py +1 -2
- airflow/providers/google/cloud/sensors/gcs.py +2 -4
- airflow/providers/google/cloud/sensors/pubsub.py +2 -3
- airflow/providers/google/cloud/sensors/workflows.py +3 -5
- airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +5 -5
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +10 -12
- airflow/providers/google/cloud/transfers/gcs_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/gcs_to_sftp.py +36 -4
- airflow/providers/google/cloud/transfers/mssql_to_gcs.py +27 -2
- airflow/providers/google/cloud/transfers/mysql_to_gcs.py +27 -2
- airflow/providers/google/cloud/transfers/postgres_to_gcs.py +27 -2
- airflow/providers/google/cloud/transfers/sftp_to_gcs.py +34 -5
- airflow/providers/google/cloud/transfers/sql_to_gcs.py +15 -0
- airflow/providers/google/cloud/transfers/trino_to_gcs.py +25 -2
- airflow/providers/google/cloud/triggers/bigquery_dts.py +1 -2
- airflow/providers/google/cloud/triggers/cloud_batch.py +1 -2
- airflow/providers/google/cloud/triggers/cloud_build.py +1 -2
- airflow/providers/google/cloud/triggers/cloud_composer.py +13 -3
- airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +102 -4
- airflow/providers/google/cloud/triggers/dataflow.py +2 -3
- airflow/providers/google/cloud/triggers/dataplex.py +1 -2
- airflow/providers/google/cloud/triggers/dataproc.py +2 -3
- airflow/providers/google/cloud/triggers/kubernetes_engine.py +1 -1
- airflow/providers/google/cloud/triggers/pubsub.py +1 -2
- airflow/providers/google/cloud/triggers/vertex_ai.py +7 -8
- airflow/providers/google/cloud/utils/credentials_provider.py +15 -8
- airflow/providers/google/cloud/utils/external_token_supplier.py +1 -0
- airflow/providers/google/common/auth_backend/google_openid.py +4 -4
- airflow/providers/google/common/consts.py +1 -2
- airflow/providers/google/common/hooks/base_google.py +8 -7
- airflow/providers/google/get_provider_info.py +186 -134
- airflow/providers/google/marketing_platform/hooks/analytics_admin.py +2 -3
- airflow/providers/google/marketing_platform/hooks/search_ads.py +1 -1
- airflow/providers/google/marketing_platform/operators/analytics_admin.py +5 -7
- {apache_airflow_providers_google-12.0.0rc1.dist-info → apache_airflow_providers_google-13.0.0.dist-info}/METADATA +41 -58
- {apache_airflow_providers_google-12.0.0rc1.dist-info → apache_airflow_providers_google-13.0.0.dist-info}/RECORD +157 -159
- airflow/providers/google/cloud/example_dags/example_facebook_ads_to_gcs.py +0 -141
- airflow/providers/google/cloud/example_dags/example_looker.py +0 -64
- airflow/providers/google/cloud/example_dags/example_presto_to_gcs.py +0 -194
- airflow/providers/google/cloud/example_dags/example_salesforce_to_gcs.py +0 -129
- airflow/providers/google/marketing_platform/example_dags/__init__.py +0 -16
- airflow/providers/google/marketing_platform/example_dags/example_display_video.py +0 -213
- {apache_airflow_providers_google-12.0.0rc1.dist-info → apache_airflow_providers_google-13.0.0.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_google-12.0.0rc1.dist-info → apache_airflow_providers_google-13.0.0.dist-info}/entry_points.txt +0 -0
@@ -20,21 +20,10 @@
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
22
|
import ast
|
23
|
-
import warnings
|
24
23
|
from collections.abc import Sequence
|
25
24
|
from functools import cached_property
|
26
25
|
from typing import TYPE_CHECKING, cast
|
27
26
|
|
28
|
-
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
29
|
-
from google.cloud.automl_v1beta1 import (
|
30
|
-
BatchPredictResult,
|
31
|
-
ColumnSpec,
|
32
|
-
Dataset,
|
33
|
-
Model,
|
34
|
-
PredictResponse,
|
35
|
-
TableSpec,
|
36
|
-
)
|
37
|
-
|
38
27
|
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
|
39
28
|
from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook
|
40
29
|
from airflow.providers.google.cloud.hooks.vertex_ai.prediction_service import PredictionServiceHook
|
@@ -48,35 +37,31 @@ from airflow.providers.google.cloud.links.translate import (
|
|
48
37
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
49
38
|
from airflow.providers.google.common.deprecated import deprecated
|
50
39
|
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
40
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
41
|
+
from google.cloud.automl_v1beta1 import (
|
42
|
+
ColumnSpec,
|
43
|
+
Dataset,
|
44
|
+
Model,
|
45
|
+
PredictResponse,
|
46
|
+
TableSpec,
|
47
|
+
)
|
51
48
|
|
52
49
|
if TYPE_CHECKING:
|
53
|
-
from google.api_core.retry import Retry
|
54
|
-
|
55
50
|
from airflow.utils.context import Context
|
51
|
+
from google.api_core.retry import Retry
|
56
52
|
|
57
53
|
MetaData = Sequence[tuple[str, str]]
|
58
54
|
|
59
55
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
alternative_class_name_str += f" or `{alternative_class_names[-1]}`"
|
70
|
-
|
71
|
-
raise AirflowException(
|
72
|
-
f"{deprecated_class_name} for text, image, and video prediction has been "
|
73
|
-
f"deprecated and no longer available. All the functionality of "
|
74
|
-
f"legacy AutoML Natural Language, Vision, Video Intelligence and Tables "
|
75
|
-
f"and new features are available on the Vertex AI platform. "
|
76
|
-
f"Please use {alternative_class_name_str} from Vertex AI."
|
77
|
-
)
|
78
|
-
|
79
|
-
|
56
|
+
@deprecated(
|
57
|
+
planned_removal_date="September 30, 2025",
|
58
|
+
use_instead="airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLTabularTrainingJobOperator, "
|
59
|
+
"airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLVideoTrainingJobOperator, "
|
60
|
+
"airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLImageTrainingJobOperator, "
|
61
|
+
"airflow.providers.google.cloud.operators.vertex_ai.generative_model.SupervisedFineTuningTrainOperator, "
|
62
|
+
"airflow.providers.google.cloud.operators.translate.TranslateCreateModelOperator",
|
63
|
+
category=AirflowProviderDeprecationWarning,
|
64
|
+
)
|
80
65
|
class AutoMLTrainModelOperator(GoogleCloudBaseOperator):
|
81
66
|
"""
|
82
67
|
Creates Google Cloud AutoML model.
|
@@ -88,6 +73,7 @@ class AutoMLTrainModelOperator(GoogleCloudBaseOperator):
|
|
88
73
|
:class:`airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLVideoTrainingJobOperator`,
|
89
74
|
:class:`airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLImageTrainingJobOperator`,
|
90
75
|
:class:`airflow.providers.google.cloud.operators.vertex_ai.generative_model.SupervisedFineTuningTrainOperator`,
|
76
|
+
:class:`airflow.providers.google.cloud.operators.translate.TranslateCreateModelOperator`.
|
91
77
|
instead.
|
92
78
|
|
93
79
|
.. seealso::
|
@@ -149,17 +135,6 @@ class AutoMLTrainModelOperator(GoogleCloudBaseOperator):
|
|
149
135
|
self.impersonation_chain = impersonation_chain
|
150
136
|
|
151
137
|
def execute(self, context: Context):
|
152
|
-
# Raise exception if running not AutoML Translation prediction job
|
153
|
-
if "translation_model_metadata" not in self.model:
|
154
|
-
_raise_exception_for_deprecated_operator(
|
155
|
-
self.__class__.__name__,
|
156
|
-
[
|
157
|
-
"CreateAutoMLTabularTrainingJobOperator",
|
158
|
-
"CreateAutoMLVideoTrainingJobOperator",
|
159
|
-
"CreateAutoMLImageTrainingJobOperator",
|
160
|
-
"SupervisedFineTuningTrainOperator",
|
161
|
-
],
|
162
|
-
)
|
163
138
|
hook = CloudAutoMLHook(
|
164
139
|
gcp_conn_id=self.gcp_conn_id,
|
165
140
|
impersonation_chain=self.impersonation_chain,
|
@@ -195,6 +170,11 @@ class AutoMLTrainModelOperator(GoogleCloudBaseOperator):
|
|
195
170
|
return result
|
196
171
|
|
197
172
|
|
173
|
+
@deprecated(
|
174
|
+
planned_removal_date="September 30, 2025",
|
175
|
+
use_instead="airflow.providers.google.cloud.operators.translate.TranslateTextOperator",
|
176
|
+
category=AirflowProviderDeprecationWarning,
|
177
|
+
)
|
198
178
|
class AutoMLPredictOperator(GoogleCloudBaseOperator):
|
199
179
|
"""
|
200
180
|
Runs prediction operation on Google Cloud AutoML.
|
@@ -297,20 +277,10 @@ class AutoMLPredictOperator(GoogleCloudBaseOperator):
|
|
297
277
|
)
|
298
278
|
return None
|
299
279
|
|
300
|
-
def _check_model_type(self):
|
301
|
-
if not hasattr(self.model, "translation_model_metadata"):
|
302
|
-
raise AirflowException(
|
303
|
-
"AutoMLPredictOperator for text, image, and video prediction has been deprecated. "
|
304
|
-
"Please use endpoint_id param instead of model_id param."
|
305
|
-
)
|
306
|
-
|
307
280
|
def execute(self, context: Context):
|
308
281
|
if self.model_id is None and self.endpoint_id is None:
|
309
282
|
raise AirflowException("You must specify model_id or endpoint_id!")
|
310
283
|
|
311
|
-
if self.model_id:
|
312
|
-
self._check_model_type()
|
313
|
-
|
314
284
|
hook = self.hook
|
315
285
|
if self.model_id:
|
316
286
|
result = hook.predict(
|
@@ -350,161 +320,19 @@ class AutoMLPredictOperator(GoogleCloudBaseOperator):
|
|
350
320
|
|
351
321
|
|
352
322
|
@deprecated(
|
353
|
-
planned_removal_date="
|
354
|
-
use_instead="airflow.providers.google.cloud.operators.vertex_ai.
|
323
|
+
planned_removal_date="September 30, 2025",
|
324
|
+
use_instead="airflow.providers.google.cloud.operators.vertex_ai.dataset.CreateDatasetOperator, "
|
325
|
+
"airflow.providers.google.cloud.operators.translate.TranslateCreateDatasetOperator",
|
355
326
|
category=AirflowProviderDeprecationWarning,
|
356
327
|
)
|
357
|
-
class AutoMLBatchPredictOperator(GoogleCloudBaseOperator):
|
358
|
-
"""
|
359
|
-
Perform a batch prediction on Google Cloud AutoML.
|
360
|
-
|
361
|
-
.. warning::
|
362
|
-
AutoMLBatchPredictOperator for tables, video intelligence, vision and natural language has been deprecated
|
363
|
-
and no longer available. Please use
|
364
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job.CreateBatchPredictionJobOperator`,
|
365
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job.GetBatchPredictionJobOperator`,
|
366
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job.ListBatchPredictionJobsOperator`,
|
367
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job.DeleteBatchPredictionJobOperator`,
|
368
|
-
instead.
|
369
|
-
|
370
|
-
.. seealso::
|
371
|
-
For more information on how to use this operator, take a look at the guide:
|
372
|
-
:ref:`howto/operator:AutoMLBatchPredictOperator`
|
373
|
-
|
374
|
-
:param project_id: ID of the Google Cloud project where model will be created if None then
|
375
|
-
default project_id is used.
|
376
|
-
:param location: The location of the project.
|
377
|
-
:param model_id: Name of the model_id requested to serve the batch prediction.
|
378
|
-
:param input_config: Required. The input configuration for batch prediction.
|
379
|
-
If a dict is provided, it must be of the same form as the protobuf message
|
380
|
-
`google.cloud.automl_v1beta1.types.BatchPredictInputConfig`
|
381
|
-
:param output_config: Required. The Configuration specifying where output predictions should be
|
382
|
-
written. If a dict is provided, it must be of the same form as the protobuf message
|
383
|
-
`google.cloud.automl_v1beta1.types.BatchPredictOutputConfig`
|
384
|
-
:param prediction_params: Additional domain-specific parameters for the predictions,
|
385
|
-
any string must be up to 25000 characters long.
|
386
|
-
:param project_id: ID of the Google Cloud project where model is located if None then
|
387
|
-
default project_id is used.
|
388
|
-
:param location: The location of the project.
|
389
|
-
:param retry: A retry object used to retry requests. If `None` is specified, requests will not be
|
390
|
-
retried.
|
391
|
-
:param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
|
392
|
-
`retry` is specified, the timeout applies to each individual attempt.
|
393
|
-
:param metadata: Additional metadata that is provided to the method.
|
394
|
-
:param gcp_conn_id: The connection ID to use to connect to Google Cloud.
|
395
|
-
:param impersonation_chain: Optional service account to impersonate using short-term
|
396
|
-
credentials, or chained list of accounts required to get the access_token
|
397
|
-
of the last account in the list, which will be impersonated in the request.
|
398
|
-
If set as a string, the account must grant the originating account
|
399
|
-
the Service Account Token Creator IAM role.
|
400
|
-
If set as a sequence, the identities from the list must grant
|
401
|
-
Service Account Token Creator IAM role to the directly preceding identity, with first
|
402
|
-
account from the list granting this role to the originating account (templated).
|
403
|
-
"""
|
404
|
-
|
405
|
-
template_fields: Sequence[str] = (
|
406
|
-
"model_id",
|
407
|
-
"input_config",
|
408
|
-
"output_config",
|
409
|
-
"location",
|
410
|
-
"project_id",
|
411
|
-
"impersonation_chain",
|
412
|
-
)
|
413
|
-
operator_extra_links = (TranslationLegacyModelPredictLink(),)
|
414
|
-
|
415
|
-
def __init__(
|
416
|
-
self,
|
417
|
-
*,
|
418
|
-
model_id: str,
|
419
|
-
input_config: dict,
|
420
|
-
output_config: dict,
|
421
|
-
location: str,
|
422
|
-
project_id: str = PROVIDE_PROJECT_ID,
|
423
|
-
prediction_params: dict[str, str] | None = None,
|
424
|
-
metadata: MetaData = (),
|
425
|
-
timeout: float | None = None,
|
426
|
-
retry: Retry | _MethodDefault = DEFAULT,
|
427
|
-
gcp_conn_id: str = "google_cloud_default",
|
428
|
-
impersonation_chain: str | Sequence[str] | None = None,
|
429
|
-
**kwargs,
|
430
|
-
) -> None:
|
431
|
-
super().__init__(**kwargs)
|
432
|
-
|
433
|
-
self.model_id = model_id
|
434
|
-
self.location = location
|
435
|
-
self.project_id = project_id
|
436
|
-
self.prediction_params = prediction_params
|
437
|
-
self.metadata = metadata
|
438
|
-
self.timeout = timeout
|
439
|
-
self.retry = retry
|
440
|
-
self.gcp_conn_id = gcp_conn_id
|
441
|
-
self.impersonation_chain = impersonation_chain
|
442
|
-
self.input_config = input_config
|
443
|
-
self.output_config = output_config
|
444
|
-
|
445
|
-
@cached_property
|
446
|
-
def hook(self) -> CloudAutoMLHook:
|
447
|
-
return CloudAutoMLHook(
|
448
|
-
gcp_conn_id=self.gcp_conn_id,
|
449
|
-
impersonation_chain=self.impersonation_chain,
|
450
|
-
)
|
451
|
-
|
452
|
-
@cached_property
|
453
|
-
def model(self) -> Model:
|
454
|
-
return self.hook.get_model(
|
455
|
-
model_id=self.model_id,
|
456
|
-
location=self.location,
|
457
|
-
project_id=self.project_id,
|
458
|
-
retry=self.retry,
|
459
|
-
timeout=self.timeout,
|
460
|
-
metadata=self.metadata,
|
461
|
-
)
|
462
|
-
|
463
|
-
def execute(self, context: Context):
|
464
|
-
if not hasattr(self.model, "translation_model_metadata"):
|
465
|
-
_raise_exception_for_deprecated_operator(
|
466
|
-
self.__class__.__name__,
|
467
|
-
[
|
468
|
-
"CreateBatchPredictionJobOperator",
|
469
|
-
"GetBatchPredictionJobOperator",
|
470
|
-
"ListBatchPredictionJobsOperator",
|
471
|
-
"DeleteBatchPredictionJobOperator",
|
472
|
-
],
|
473
|
-
)
|
474
|
-
self.log.info("Fetch batch prediction.")
|
475
|
-
operation = self.hook.batch_predict(
|
476
|
-
model_id=self.model_id,
|
477
|
-
input_config=self.input_config,
|
478
|
-
output_config=self.output_config,
|
479
|
-
project_id=self.project_id,
|
480
|
-
location=self.location,
|
481
|
-
params=self.prediction_params,
|
482
|
-
retry=self.retry,
|
483
|
-
timeout=self.timeout,
|
484
|
-
metadata=self.metadata,
|
485
|
-
)
|
486
|
-
operation_result = self.hook.wait_for_operation(timeout=self.timeout, operation=operation)
|
487
|
-
result = BatchPredictResult.to_dict(operation_result)
|
488
|
-
self.log.info("Batch prediction is ready.")
|
489
|
-
project_id = self.project_id or self.hook.project_id
|
490
|
-
if project_id:
|
491
|
-
TranslationLegacyModelPredictLink.persist(
|
492
|
-
context=context,
|
493
|
-
task_instance=self,
|
494
|
-
model_id=self.model_id,
|
495
|
-
project_id=project_id,
|
496
|
-
dataset_id=self.model.dataset_id,
|
497
|
-
)
|
498
|
-
return result
|
499
|
-
|
500
|
-
|
501
328
|
class AutoMLCreateDatasetOperator(GoogleCloudBaseOperator):
|
502
329
|
"""
|
503
330
|
Creates a Google Cloud AutoML dataset.
|
504
331
|
|
505
332
|
AutoMLCreateDatasetOperator for tables, video intelligence, vision and natural language has been
|
506
333
|
deprecated and no longer available. Please use
|
507
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.dataset.CreateDatasetOperator
|
334
|
+
:class:`airflow.providers.google.cloud.operators.vertex_ai.dataset.CreateDatasetOperator`,
|
335
|
+
:class:`airflow.providers.google.cloud.operators.translate.TranslateCreateDatasetOperator` instead.
|
508
336
|
|
509
337
|
.. seealso::
|
510
338
|
For more information on how to use this operator, take a look at the guide:
|
@@ -565,8 +393,6 @@ class AutoMLCreateDatasetOperator(GoogleCloudBaseOperator):
|
|
565
393
|
self.impersonation_chain = impersonation_chain
|
566
394
|
|
567
395
|
def execute(self, context: Context):
|
568
|
-
if "translation_dataset_metadata" not in self.dataset:
|
569
|
-
_raise_exception_for_deprecated_operator(self.__class__.__name__, "CreateDatasetOperator")
|
570
396
|
hook = CloudAutoMLHook(
|
571
397
|
gcp_conn_id=self.gcp_conn_id,
|
572
398
|
impersonation_chain=self.impersonation_chain,
|
@@ -596,6 +422,12 @@ class AutoMLCreateDatasetOperator(GoogleCloudBaseOperator):
|
|
596
422
|
return result
|
597
423
|
|
598
424
|
|
425
|
+
@deprecated(
|
426
|
+
planned_removal_date="September 30, 2025",
|
427
|
+
use_instead="airflow.providers.google.cloud.operators.vertex_ai.dataset.ImportDataOperator, "
|
428
|
+
"airflow.providers.google.cloud.operators.translate.TranslateImportDataOperator",
|
429
|
+
category=AirflowProviderDeprecationWarning,
|
430
|
+
)
|
599
431
|
class AutoMLImportDataOperator(GoogleCloudBaseOperator):
|
600
432
|
"""
|
601
433
|
Imports data to a Google Cloud AutoML dataset.
|
@@ -672,7 +504,7 @@ class AutoMLImportDataOperator(GoogleCloudBaseOperator):
|
|
672
504
|
gcp_conn_id=self.gcp_conn_id,
|
673
505
|
impersonation_chain=self.impersonation_chain,
|
674
506
|
)
|
675
|
-
|
507
|
+
hook.get_dataset(
|
676
508
|
dataset_id=self.dataset_id,
|
677
509
|
location=self.location,
|
678
510
|
project_id=self.project_id,
|
@@ -680,8 +512,6 @@ class AutoMLImportDataOperator(GoogleCloudBaseOperator):
|
|
680
512
|
timeout=self.timeout,
|
681
513
|
metadata=self.metadata,
|
682
514
|
)
|
683
|
-
if not hasattr(dataset, "translation_dataset_metadata"):
|
684
|
-
_raise_exception_for_deprecated_operator(self.__class__.__name__, "ImportDataOperator")
|
685
515
|
self.log.info("Importing data to dataset...")
|
686
516
|
operation = hook.import_data(
|
687
517
|
dataset_id=self.dataset_id,
|
@@ -704,6 +534,11 @@ class AutoMLImportDataOperator(GoogleCloudBaseOperator):
|
|
704
534
|
)
|
705
535
|
|
706
536
|
|
537
|
+
@deprecated(
|
538
|
+
planned_removal_date="September 30, 2025",
|
539
|
+
category=AirflowProviderDeprecationWarning,
|
540
|
+
reason="Shutdown of legacy version of AutoML Tables on March 31, 2024.",
|
541
|
+
)
|
707
542
|
class AutoMLTablesListColumnSpecsOperator(GoogleCloudBaseOperator):
|
708
543
|
"""
|
709
544
|
Lists column specs in a table.
|
@@ -787,11 +622,6 @@ class AutoMLTablesListColumnSpecsOperator(GoogleCloudBaseOperator):
|
|
787
622
|
self.retry = retry
|
788
623
|
self.gcp_conn_id = gcp_conn_id
|
789
624
|
self.impersonation_chain = impersonation_chain
|
790
|
-
raise AirflowException(
|
791
|
-
"Operator AutoMLTablesListColumnSpecsOperator has been deprecated due to shutdown of "
|
792
|
-
"a legacy version of AutoML Tables on March 31, 2024. "
|
793
|
-
"For additional information see: https://cloud.google.com/automl-tables/docs/deprecations."
|
794
|
-
)
|
795
625
|
|
796
626
|
def execute(self, context: Context):
|
797
627
|
hook = CloudAutoMLHook(
|
@@ -824,6 +654,12 @@ class AutoMLTablesListColumnSpecsOperator(GoogleCloudBaseOperator):
|
|
824
654
|
return result
|
825
655
|
|
826
656
|
|
657
|
+
@deprecated(
|
658
|
+
planned_removal_date="September 30, 2025",
|
659
|
+
use_instead="airflow.providers.google.cloud.operators.vertex_ai.dataset.UpdateDatasetOperator",
|
660
|
+
category=AirflowProviderDeprecationWarning,
|
661
|
+
reason="Shutdown of legacy version of AutoML Tables on March 31, 2024.",
|
662
|
+
)
|
827
663
|
class AutoMLTablesUpdateDatasetOperator(GoogleCloudBaseOperator):
|
828
664
|
"""
|
829
665
|
Updates a dataset.
|
@@ -892,12 +728,6 @@ class AutoMLTablesUpdateDatasetOperator(GoogleCloudBaseOperator):
|
|
892
728
|
self.retry = retry
|
893
729
|
self.gcp_conn_id = gcp_conn_id
|
894
730
|
self.impersonation_chain = impersonation_chain
|
895
|
-
raise AirflowException(
|
896
|
-
"Operator AutoMLTablesUpdateDatasetOperator has been deprecated due to shutdown of "
|
897
|
-
"a legacy version of AutoML Tables on March 31, 2024. "
|
898
|
-
"For additional information see: https://cloud.google.com/automl-tables/docs/deprecations. "
|
899
|
-
"Please use UpdateDatasetOperator from Vertex AI instead."
|
900
|
-
)
|
901
731
|
|
902
732
|
def execute(self, context: Context):
|
903
733
|
hook = CloudAutoMLHook(
|
@@ -924,6 +754,11 @@ class AutoMLTablesUpdateDatasetOperator(GoogleCloudBaseOperator):
|
|
924
754
|
return Dataset.to_dict(result)
|
925
755
|
|
926
756
|
|
757
|
+
@deprecated(
|
758
|
+
planned_removal_date="September 30, 2025",
|
759
|
+
use_instead="airflow.providers.google.cloud.operators.vertex_ai.model_service.GetModelOperator",
|
760
|
+
category=AirflowProviderDeprecationWarning,
|
761
|
+
)
|
927
762
|
class AutoMLGetModelOperator(GoogleCloudBaseOperator):
|
928
763
|
"""
|
929
764
|
Get Google Cloud AutoML model.
|
@@ -1003,8 +838,6 @@ class AutoMLGetModelOperator(GoogleCloudBaseOperator):
|
|
1003
838
|
timeout=self.timeout,
|
1004
839
|
metadata=self.metadata,
|
1005
840
|
)
|
1006
|
-
if not hasattr(result, "translation_model_metadata"):
|
1007
|
-
_raise_exception_for_deprecated_operator(self.__class__.__name__, "GetModelOperator")
|
1008
841
|
model = Model.to_dict(result)
|
1009
842
|
project_id = self.project_id or hook.project_id
|
1010
843
|
if project_id:
|
@@ -1018,6 +851,12 @@ class AutoMLGetModelOperator(GoogleCloudBaseOperator):
|
|
1018
851
|
return model
|
1019
852
|
|
1020
853
|
|
854
|
+
@deprecated(
|
855
|
+
planned_removal_date="September 30, 2025",
|
856
|
+
use_instead="airflow.providers.google.cloud.operators.vertex_ai.model_service.DeleteModelOperator, "
|
857
|
+
"airflow.providers.google.cloud.operators.translate.TranslateDeleteModelOperator",
|
858
|
+
category=AirflowProviderDeprecationWarning,
|
859
|
+
)
|
1021
860
|
class AutoMLDeleteModelOperator(GoogleCloudBaseOperator):
|
1022
861
|
"""
|
1023
862
|
Delete Google Cloud AutoML model.
|
@@ -1088,7 +927,7 @@ class AutoMLDeleteModelOperator(GoogleCloudBaseOperator):
|
|
1088
927
|
gcp_conn_id=self.gcp_conn_id,
|
1089
928
|
impersonation_chain=self.impersonation_chain,
|
1090
929
|
)
|
1091
|
-
|
930
|
+
hook.get_model(
|
1092
931
|
model_id=self.model_id,
|
1093
932
|
location=self.location,
|
1094
933
|
project_id=self.project_id,
|
@@ -1096,8 +935,6 @@ class AutoMLDeleteModelOperator(GoogleCloudBaseOperator):
|
|
1096
935
|
timeout=self.timeout,
|
1097
936
|
metadata=self.metadata,
|
1098
937
|
)
|
1099
|
-
if not hasattr(model, "translation_model_metadata"):
|
1100
|
-
_raise_exception_for_deprecated_operator(self.__class__.__name__, "DeleteModelOperator")
|
1101
938
|
operation = hook.delete_model(
|
1102
939
|
model_id=self.model_id,
|
1103
940
|
location=self.location,
|
@@ -1110,6 +947,11 @@ class AutoMLDeleteModelOperator(GoogleCloudBaseOperator):
|
|
1110
947
|
self.log.info("Deletion is completed")
|
1111
948
|
|
1112
949
|
|
950
|
+
@deprecated(
|
951
|
+
planned_removal_date="September 30, 2025",
|
952
|
+
use_instead="airflow.providers.google.cloud.operators.vertex_ai.endpoint_service.DeployModelOperator",
|
953
|
+
category=AirflowProviderDeprecationWarning,
|
954
|
+
)
|
1113
955
|
class AutoMLDeployModelOperator(GoogleCloudBaseOperator):
|
1114
956
|
"""
|
1115
957
|
Deploys a model; if a model is already deployed, deploying it with the same parameters has no effect.
|
@@ -1187,13 +1029,6 @@ class AutoMLDeployModelOperator(GoogleCloudBaseOperator):
|
|
1187
1029
|
self.retry = retry
|
1188
1030
|
self.gcp_conn_id = gcp_conn_id
|
1189
1031
|
self.impersonation_chain = impersonation_chain
|
1190
|
-
raise AirflowException(
|
1191
|
-
"Operator AutoMLDeployModelOperator has been deprecated due to shutdown of "
|
1192
|
-
"a legacy version of AutoML AutoML Natural Language, Vision, Video Intelligence "
|
1193
|
-
"on March 31, 2024. "
|
1194
|
-
"For additional information see: https://cloud.google.com/vision/automl/docs/deprecations. "
|
1195
|
-
"Please use DeployModelOperator from Vertex AI instead."
|
1196
|
-
)
|
1197
1032
|
|
1198
1033
|
def execute(self, context: Context):
|
1199
1034
|
hook = CloudAutoMLHook(
|
@@ -1214,6 +1049,11 @@ class AutoMLDeployModelOperator(GoogleCloudBaseOperator):
|
|
1214
1049
|
self.log.info("Model was deployed successfully.")
|
1215
1050
|
|
1216
1051
|
|
1052
|
+
@deprecated(
|
1053
|
+
planned_removal_date="September 30, 2025",
|
1054
|
+
category=AirflowProviderDeprecationWarning,
|
1055
|
+
reason="Shutdown of legacy version of AutoML Tables on March 31, 2024.",
|
1056
|
+
)
|
1217
1057
|
class AutoMLTablesListTableSpecsOperator(GoogleCloudBaseOperator):
|
1218
1058
|
"""
|
1219
1059
|
Lists table specs in a dataset.
|
@@ -1288,11 +1128,6 @@ class AutoMLTablesListTableSpecsOperator(GoogleCloudBaseOperator):
|
|
1288
1128
|
self.retry = retry
|
1289
1129
|
self.gcp_conn_id = gcp_conn_id
|
1290
1130
|
self.impersonation_chain = impersonation_chain
|
1291
|
-
raise AirflowException(
|
1292
|
-
"Operator AutoMLTablesListTableSpecsOperator has been deprecated due to shutdown of "
|
1293
|
-
"a legacy version of AutoML Tables on March 31, 2024. "
|
1294
|
-
"For additional information see: https://cloud.google.com/automl-tables/docs/deprecations. "
|
1295
|
-
)
|
1296
1131
|
|
1297
1132
|
def execute(self, context: Context):
|
1298
1133
|
hook = CloudAutoMLHook(
|
@@ -1324,6 +1159,12 @@ class AutoMLTablesListTableSpecsOperator(GoogleCloudBaseOperator):
|
|
1324
1159
|
return result
|
1325
1160
|
|
1326
1161
|
|
1162
|
+
@deprecated(
|
1163
|
+
planned_removal_date="September 30, 2025",
|
1164
|
+
use_instead="airflow.providers.google.cloud.operators.vertex_ai.dataset.ListDatasetsOperator, "
|
1165
|
+
"airflow.providers.google.cloud.operators.translate.TranslateDatasetsListOperator",
|
1166
|
+
category=AirflowProviderDeprecationWarning,
|
1167
|
+
)
|
1327
1168
|
class AutoMLListDatasetOperator(GoogleCloudBaseOperator):
|
1328
1169
|
"""
|
1329
1170
|
Lists AutoML Datasets in project.
|
@@ -1399,14 +1240,7 @@ class AutoMLListDatasetOperator(GoogleCloudBaseOperator):
|
|
1399
1240
|
)
|
1400
1241
|
result = []
|
1401
1242
|
for dataset in page_iterator:
|
1402
|
-
|
1403
|
-
warnings.warn(
|
1404
|
-
"Class `AutoMLListDatasetOperator` has been deprecated and no longer available. "
|
1405
|
-
"Please use `ListDatasetsOperator` instead.",
|
1406
|
-
stacklevel=2,
|
1407
|
-
)
|
1408
|
-
else:
|
1409
|
-
result.append(Dataset.to_dict(dataset))
|
1243
|
+
result.append(Dataset.to_dict(dataset))
|
1410
1244
|
self.log.info("Datasets obtained.")
|
1411
1245
|
|
1412
1246
|
self.xcom_push(
|
@@ -1420,6 +1254,12 @@ class AutoMLListDatasetOperator(GoogleCloudBaseOperator):
|
|
1420
1254
|
return result
|
1421
1255
|
|
1422
1256
|
|
1257
|
+
@deprecated(
|
1258
|
+
planned_removal_date="September 30, 2025",
|
1259
|
+
use_instead="airflow.providers.google.cloud.operators.vertex_ai.dataset.ListDatasetsOperator, "
|
1260
|
+
"airflow.providers.google.cloud.operators.translate.TranslateDatasetsListOperator",
|
1261
|
+
category=AirflowProviderDeprecationWarning,
|
1262
|
+
)
|
1423
1263
|
class AutoMLDeleteDatasetOperator(GoogleCloudBaseOperator):
|
1424
1264
|
"""
|
1425
1265
|
Deletes a dataset and all of its contents.
|
@@ -1498,7 +1338,7 @@ class AutoMLDeleteDatasetOperator(GoogleCloudBaseOperator):
|
|
1498
1338
|
gcp_conn_id=self.gcp_conn_id,
|
1499
1339
|
impersonation_chain=self.impersonation_chain,
|
1500
1340
|
)
|
1501
|
-
|
1341
|
+
hook.get_dataset(
|
1502
1342
|
dataset_id=self.dataset_id,
|
1503
1343
|
location=self.location,
|
1504
1344
|
project_id=self.project_id,
|
@@ -1506,8 +1346,6 @@ class AutoMLDeleteDatasetOperator(GoogleCloudBaseOperator):
|
|
1506
1346
|
timeout=self.timeout,
|
1507
1347
|
metadata=self.metadata,
|
1508
1348
|
)
|
1509
|
-
if not hasattr(dataset, "translation_dataset_metadata"):
|
1510
|
-
_raise_exception_for_deprecated_operator(self.__class__.__name__, "DeleteDatasetOperator")
|
1511
1349
|
dataset_id_list = self._parse_dataset_id(self.dataset_id)
|
1512
1350
|
for dataset_id in dataset_id_list:
|
1513
1351
|
self.log.info("Deleting dataset %s", dataset_id)
|