apache-airflow-providers-google 10.18.0__py3-none-any.whl → 10.18.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/__init__.py +5 -2
- airflow/providers/google/cloud/hooks/automl.py +0 -34
- airflow/providers/google/cloud/hooks/bigquery.py +8 -62
- airflow/providers/google/cloud/operators/automl.py +25 -230
- airflow/providers/google/cloud/operators/bigquery.py +40 -128
- airflow/providers/google/cloud/operators/dataproc.py +1 -1
- airflow/providers/google/cloud/operators/kubernetes_engine.py +37 -24
- airflow/providers/google/cloud/operators/workflows.py +5 -2
- airflow/providers/google/cloud/triggers/bigquery.py +6 -64
- airflow/providers/google/cloud/triggers/dataproc.py +3 -82
- airflow/providers/google/cloud/triggers/kubernetes_engine.py +3 -2
- airflow/providers/google/get_provider_info.py +2 -3
- {apache_airflow_providers_google-10.18.0.dist-info → apache_airflow_providers_google-10.18.0rc1.dist-info}/METADATA +13 -13
- {apache_airflow_providers_google-10.18.0.dist-info → apache_airflow_providers_google-10.18.0rc1.dist-info}/RECORD +16 -17
- airflow/providers/google/cloud/hooks/vertex_ai/prediction_service.py +0 -91
- {apache_airflow_providers_google-10.18.0.dist-info → apache_airflow_providers_google-10.18.0rc1.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_google-10.18.0.dist-info → apache_airflow_providers_google-10.18.0rc1.dist-info}/entry_points.txt +0 -0
@@ -25,12 +25,15 @@ from __future__ import annotations
|
|
25
25
|
|
26
26
|
import packaging.version
|
27
27
|
|
28
|
-
from airflow import __version__ as airflow_version
|
29
|
-
|
30
28
|
__all__ = ["__version__"]
|
31
29
|
|
32
30
|
__version__ = "10.18.0"
|
33
31
|
|
32
|
+
try:
|
33
|
+
from airflow import __version__ as airflow_version
|
34
|
+
except ImportError:
|
35
|
+
from airflow.version import version as airflow_version
|
36
|
+
|
34
37
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
35
38
|
"2.7.0"
|
36
39
|
):
|
@@ -640,37 +640,3 @@ class CloudAutoMLHook(GoogleBaseHook):
|
|
640
640
|
metadata=metadata,
|
641
641
|
)
|
642
642
|
return result
|
643
|
-
|
644
|
-
@GoogleBaseHook.fallback_to_default_project_id
|
645
|
-
def get_dataset(
|
646
|
-
self,
|
647
|
-
dataset_id: str,
|
648
|
-
location: str,
|
649
|
-
project_id: str,
|
650
|
-
retry: Retry | _MethodDefault = DEFAULT,
|
651
|
-
timeout: float | None = None,
|
652
|
-
metadata: Sequence[tuple[str, str]] = (),
|
653
|
-
) -> Dataset:
|
654
|
-
"""
|
655
|
-
Retrieve the dataset for the given dataset_id.
|
656
|
-
|
657
|
-
:param dataset_id: ID of dataset to be retrieved.
|
658
|
-
:param location: The location of the project.
|
659
|
-
:param project_id: ID of the Google Cloud project where dataset is located if None then
|
660
|
-
default project_id is used.
|
661
|
-
:param retry: A retry object used to retry requests. If `None` is specified, requests will not be
|
662
|
-
retried.
|
663
|
-
:param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
|
664
|
-
`retry` is specified, the timeout applies to each individual attempt.
|
665
|
-
:param metadata: Additional metadata that is provided to the method.
|
666
|
-
|
667
|
-
:return: `google.cloud.automl_v1beta1.types.dataset.Dataset` instance.
|
668
|
-
"""
|
669
|
-
client = self.get_conn()
|
670
|
-
name = f"projects/{project_id}/locations/{location}/datasets/{dataset_id}"
|
671
|
-
return client.get_dataset(
|
672
|
-
request={"name": name},
|
673
|
-
retry=retry,
|
674
|
-
timeout=timeout,
|
675
|
-
metadata=metadata,
|
676
|
-
)
|
@@ -46,14 +46,7 @@ from google.cloud.bigquery import (
|
|
46
46
|
UnknownJob,
|
47
47
|
)
|
48
48
|
from google.cloud.bigquery.dataset import AccessEntry, Dataset, DatasetListItem, DatasetReference
|
49
|
-
from google.cloud.bigquery.
|
50
|
-
from google.cloud.bigquery.table import (
|
51
|
-
EncryptionConfiguration,
|
52
|
-
Row,
|
53
|
-
RowIterator,
|
54
|
-
Table,
|
55
|
-
TableReference,
|
56
|
-
)
|
49
|
+
from google.cloud.bigquery.table import EncryptionConfiguration, Row, RowIterator, Table, TableReference
|
57
50
|
from google.cloud.exceptions import NotFound
|
58
51
|
from googleapiclient.discovery import Resource, build
|
59
52
|
from pandas_gbq import read_gbq
|
@@ -72,7 +65,12 @@ from airflow.providers.google.common.hooks.base_google import (
|
|
72
65
|
GoogleBaseHook,
|
73
66
|
get_field,
|
74
67
|
)
|
75
|
-
|
68
|
+
|
69
|
+
try:
|
70
|
+
from airflow.utils.hashlib_wrapper import md5
|
71
|
+
except ModuleNotFoundError:
|
72
|
+
# Remove when Airflow providers min Airflow version is "2.7.0"
|
73
|
+
from hashlib import md5
|
76
74
|
from airflow.utils.helpers import convert_camel_to_snake
|
77
75
|
from airflow.utils.log.logging_mixin import LoggingMixin
|
78
76
|
|
@@ -2392,48 +2390,6 @@ class BigQueryHook(GoogleBaseHook, DbApiHook):
|
|
2392
2390
|
|
2393
2391
|
return project_id, dataset_id, table_id
|
2394
2392
|
|
2395
|
-
@GoogleBaseHook.fallback_to_default_project_id
|
2396
|
-
def get_query_results(
|
2397
|
-
self,
|
2398
|
-
job_id: str,
|
2399
|
-
location: str,
|
2400
|
-
max_results: int | None = None,
|
2401
|
-
selected_fields: list[str] | str | None = None,
|
2402
|
-
project_id: str = PROVIDE_PROJECT_ID,
|
2403
|
-
retry: Retry = DEFAULT_RETRY,
|
2404
|
-
job_retry: Retry = DEFAULT_JOB_RETRY,
|
2405
|
-
) -> list[dict[str, Any]]:
|
2406
|
-
"""
|
2407
|
-
Get query results given a job_id.
|
2408
|
-
|
2409
|
-
:param job_id: The ID of the job.
|
2410
|
-
The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or
|
2411
|
-
dashes (-). The maximum length is 1,024 characters.
|
2412
|
-
:param location: The location used for the operation.
|
2413
|
-
:param selected_fields: List of fields to return (comma-separated). If
|
2414
|
-
unspecified, all fields are returned.
|
2415
|
-
:param max_results: The maximum number of records (rows) to be fetched
|
2416
|
-
from the table.
|
2417
|
-
:param project_id: Google Cloud Project where the job ran.
|
2418
|
-
:param retry: How to retry the RPC.
|
2419
|
-
:param job_retry: How to retry failed jobs.
|
2420
|
-
|
2421
|
-
:return: List of rows where columns are filtered by selected fields, when given
|
2422
|
-
|
2423
|
-
:raises: AirflowException
|
2424
|
-
"""
|
2425
|
-
if isinstance(selected_fields, str):
|
2426
|
-
selected_fields = selected_fields.split(",")
|
2427
|
-
job = self.get_job(job_id=job_id, project_id=project_id, location=location)
|
2428
|
-
if not isinstance(job, QueryJob):
|
2429
|
-
raise AirflowException(f"Job '{job_id}' is not a query job")
|
2430
|
-
|
2431
|
-
if job.state != "DONE":
|
2432
|
-
raise AirflowException(f"Job '{job_id}' is not in DONE state")
|
2433
|
-
|
2434
|
-
rows = [dict(row) for row in job.result(max_results=max_results, retry=retry, job_retry=job_retry)]
|
2435
|
-
return [{k: row[k] for k in row if k in selected_fields} for row in rows] if selected_fields else rows
|
2436
|
-
|
2437
2393
|
@property
|
2438
2394
|
def scopes(self) -> Sequence[str]:
|
2439
2395
|
"""
|
@@ -3465,25 +3421,15 @@ class BigQueryAsyncHook(GoogleBaseAsyncHook):
|
|
3465
3421
|
self.log.error("Failed to cancel BigQuery job %s: %s", job_id, str(e))
|
3466
3422
|
raise
|
3467
3423
|
|
3468
|
-
|
3469
|
-
def get_records(
|
3470
|
-
self,
|
3471
|
-
query_results: dict[str, Any],
|
3472
|
-
as_dict: bool = False,
|
3473
|
-
selected_fields: str | list[str] | None = None,
|
3474
|
-
) -> list[Any]:
|
3424
|
+
def get_records(self, query_results: dict[str, Any], as_dict: bool = False) -> list[Any]:
|
3475
3425
|
"""Convert a response from BigQuery to records.
|
3476
3426
|
|
3477
3427
|
:param query_results: the results from a SQL query
|
3478
3428
|
:param as_dict: if True returns the result as a list of dictionaries, otherwise as list of lists.
|
3479
|
-
:param selected_fields:
|
3480
3429
|
"""
|
3481
|
-
if isinstance(selected_fields, str):
|
3482
|
-
selected_fields = selected_fields.split(",")
|
3483
3430
|
buffer: list[Any] = []
|
3484
3431
|
if rows := query_results.get("rows"):
|
3485
3432
|
fields = query_results["schema"]["fields"]
|
3486
|
-
fields = [field for field in fields if not selected_fields or field["name"] in selected_fields]
|
3487
3433
|
fields_names = [field["name"] for field in fields]
|
3488
3434
|
col_types = [field["type"] for field in fields]
|
3489
3435
|
for dict_row in rows:
|
@@ -21,10 +21,8 @@ from __future__ import annotations
|
|
21
21
|
|
22
22
|
import ast
|
23
23
|
import warnings
|
24
|
-
from functools import cached_property
|
25
24
|
from typing import TYPE_CHECKING, Sequence, Tuple
|
26
25
|
|
27
|
-
from deprecated import deprecated
|
28
26
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
29
27
|
from google.cloud.automl_v1beta1 import (
|
30
28
|
BatchPredictResult,
|
@@ -35,9 +33,8 @@ from google.cloud.automl_v1beta1 import (
|
|
35
33
|
TableSpec,
|
36
34
|
)
|
37
35
|
|
38
|
-
from airflow.exceptions import
|
36
|
+
from airflow.exceptions import AirflowProviderDeprecationWarning
|
39
37
|
from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook
|
40
|
-
from airflow.providers.google.cloud.hooks.vertex_ai.prediction_service import PredictionServiceHook
|
41
38
|
from airflow.providers.google.cloud.links.automl import (
|
42
39
|
AutoMLDatasetLink,
|
43
40
|
AutoMLDatasetListLink,
|
@@ -56,36 +53,12 @@ if TYPE_CHECKING:
|
|
56
53
|
MetaData = Sequence[Tuple[str, str]]
|
57
54
|
|
58
55
|
|
59
|
-
def _raise_exception_for_deprecated_operator(
|
60
|
-
deprecated_class_name: str, alternative_class_names: str | list[str]
|
61
|
-
):
|
62
|
-
if isinstance(alternative_class_names, str):
|
63
|
-
alternative_class_name_str = alternative_class_names
|
64
|
-
elif len(alternative_class_names) == 1:
|
65
|
-
alternative_class_name_str = alternative_class_names[0]
|
66
|
-
else:
|
67
|
-
alternative_class_name_str = ", ".join(f"`{cls_name}`" for cls_name in alternative_class_names[:-1])
|
68
|
-
alternative_class_name_str += f" or `{alternative_class_names[-1]}`"
|
69
|
-
|
70
|
-
raise AirflowException(
|
71
|
-
f"{deprecated_class_name} for text, image, and video prediction has been "
|
72
|
-
f"deprecated and no longer available. All the functionality of "
|
73
|
-
f"legacy AutoML Natural Language, Vision, Video Intelligence and Tables "
|
74
|
-
f"and new features are available on the Vertex AI platform. "
|
75
|
-
f"Please use {alternative_class_name_str} from Vertex AI."
|
76
|
-
)
|
77
|
-
|
78
|
-
|
79
56
|
class AutoMLTrainModelOperator(GoogleCloudBaseOperator):
|
80
57
|
"""
|
81
58
|
Creates Google Cloud AutoML model.
|
82
59
|
|
83
|
-
AutoMLTrainModelOperator for
|
84
|
-
|
85
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLTabularTrainingJobOperator`,
|
86
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLVideoTrainingJobOperator`,
|
87
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLImageTrainingJobOperator`,
|
88
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLTextTrainingJobOperator`,
|
60
|
+
AutoMLTrainModelOperator for text prediction is deprecated. Please use
|
61
|
+
:class:`airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLTextTrainingJobOperator`
|
89
62
|
instead.
|
90
63
|
|
91
64
|
.. seealso::
|
@@ -147,16 +120,17 @@ class AutoMLTrainModelOperator(GoogleCloudBaseOperator):
|
|
147
120
|
self.impersonation_chain = impersonation_chain
|
148
121
|
|
149
122
|
def execute(self, context: Context):
|
150
|
-
#
|
123
|
+
# Output warning if running not AutoML Translation prediction job
|
151
124
|
if "translation_model_metadata" not in self.model:
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
125
|
+
warnings.warn(
|
126
|
+
"AutoMLTrainModelOperator for text, image and video prediction is deprecated. "
|
127
|
+
"All the functionality of legacy "
|
128
|
+
"AutoML Natural Language, Vision and Video Intelligence and new features are available "
|
129
|
+
"on the Vertex AI platform. "
|
130
|
+
"Please use `CreateAutoMLTextTrainingJobOperator`, `CreateAutoMLImageTrainingJobOperator` or"
|
131
|
+
" `CreateAutoMLVideoTrainingJobOperator` from VertexAI.",
|
132
|
+
AirflowProviderDeprecationWarning,
|
133
|
+
stacklevel=3,
|
160
134
|
)
|
161
135
|
hook = CloudAutoMLHook(
|
162
136
|
gcp_conn_id=self.gcp_conn_id,
|
@@ -200,8 +174,7 @@ class AutoMLPredictOperator(GoogleCloudBaseOperator):
|
|
200
174
|
:ref:`howto/operator:AutoMLPredictOperator`
|
201
175
|
|
202
176
|
:param model_id: Name of the model requested to serve the batch prediction.
|
203
|
-
:param
|
204
|
-
:param payload: Name of the model used for the prediction.
|
177
|
+
:param payload: Name od the model used for the prediction.
|
205
178
|
:param project_id: ID of the Google Cloud project where model is located if None then
|
206
179
|
default project_id is used.
|
207
180
|
:param location: The location of the project.
|
@@ -233,12 +206,10 @@ class AutoMLPredictOperator(GoogleCloudBaseOperator):
|
|
233
206
|
def __init__(
|
234
207
|
self,
|
235
208
|
*,
|
236
|
-
model_id: str
|
237
|
-
endpoint_id: str | None = None,
|
209
|
+
model_id: str,
|
238
210
|
location: str,
|
239
211
|
payload: dict,
|
240
212
|
operation_params: dict[str, str] | None = None,
|
241
|
-
instances: list[str] | None = None,
|
242
213
|
project_id: str = PROVIDE_PROJECT_ID,
|
243
214
|
metadata: MetaData = (),
|
244
215
|
timeout: float | None = None,
|
@@ -250,9 +221,7 @@ class AutoMLPredictOperator(GoogleCloudBaseOperator):
|
|
250
221
|
super().__init__(**kwargs)
|
251
222
|
|
252
223
|
self.model_id = model_id
|
253
|
-
self.endpoint_id = endpoint_id
|
254
224
|
self.operation_params = operation_params # type: ignore
|
255
|
-
self.instances = instances
|
256
225
|
self.location = location
|
257
226
|
self.project_id = project_id
|
258
227
|
self.metadata = metadata
|
@@ -262,69 +231,23 @@ class AutoMLPredictOperator(GoogleCloudBaseOperator):
|
|
262
231
|
self.gcp_conn_id = gcp_conn_id
|
263
232
|
self.impersonation_chain = impersonation_chain
|
264
233
|
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
)
|
272
|
-
else: # endpoint_id defined
|
273
|
-
return PredictionServiceHook(
|
274
|
-
gcp_conn_id=self.gcp_conn_id,
|
275
|
-
impersonation_chain=self.impersonation_chain,
|
276
|
-
)
|
277
|
-
|
278
|
-
def _check_model_type(self):
|
279
|
-
hook = self.hook
|
280
|
-
model = hook.get_model(
|
234
|
+
def execute(self, context: Context):
|
235
|
+
hook = CloudAutoMLHook(
|
236
|
+
gcp_conn_id=self.gcp_conn_id,
|
237
|
+
impersonation_chain=self.impersonation_chain,
|
238
|
+
)
|
239
|
+
result = hook.predict(
|
281
240
|
model_id=self.model_id,
|
241
|
+
payload=self.payload,
|
282
242
|
location=self.location,
|
283
243
|
project_id=self.project_id,
|
244
|
+
params=self.operation_params,
|
284
245
|
retry=self.retry,
|
285
246
|
timeout=self.timeout,
|
286
247
|
metadata=self.metadata,
|
287
248
|
)
|
288
|
-
if not hasattr(model, "translation_model_metadata"):
|
289
|
-
raise AirflowException(
|
290
|
-
"AutoMLPredictOperator for text, image, and video prediction has been deprecated. "
|
291
|
-
"Please use endpoint_id param instead of model_id param."
|
292
|
-
)
|
293
|
-
|
294
|
-
def execute(self, context: Context):
|
295
|
-
if self.model_id is None and self.endpoint_id is None:
|
296
|
-
raise AirflowException("You must specify model_id or endpoint_id!")
|
297
|
-
|
298
|
-
if self.model_id:
|
299
|
-
self._check_model_type()
|
300
|
-
|
301
|
-
hook = self.hook
|
302
|
-
if self.model_id:
|
303
|
-
result = hook.predict(
|
304
|
-
model_id=self.model_id,
|
305
|
-
payload=self.payload,
|
306
|
-
location=self.location,
|
307
|
-
project_id=self.project_id,
|
308
|
-
params=self.operation_params,
|
309
|
-
retry=self.retry,
|
310
|
-
timeout=self.timeout,
|
311
|
-
metadata=self.metadata,
|
312
|
-
)
|
313
|
-
else: # self.endpoint_id is defined
|
314
|
-
result = hook.predict(
|
315
|
-
endpoint_id=self.endpoint_id,
|
316
|
-
instances=self.instances,
|
317
|
-
payload=self.payload,
|
318
|
-
location=self.location,
|
319
|
-
project_id=self.project_id,
|
320
|
-
parameters=self.operation_params,
|
321
|
-
retry=self.retry,
|
322
|
-
timeout=self.timeout,
|
323
|
-
metadata=self.metadata,
|
324
|
-
)
|
325
|
-
|
326
249
|
project_id = self.project_id or hook.project_id
|
327
|
-
if project_id
|
250
|
+
if project_id:
|
328
251
|
AutoMLModelPredictLink.persist(
|
329
252
|
context=context,
|
330
253
|
task_instance=self,
|
@@ -338,14 +261,6 @@ class AutoMLBatchPredictOperator(GoogleCloudBaseOperator):
|
|
338
261
|
"""
|
339
262
|
Perform a batch prediction on Google Cloud AutoML.
|
340
263
|
|
341
|
-
AutoMLBatchPredictOperator for tables, video intelligence, vision and natural language has been deprecated
|
342
|
-
and no longer available. Please use
|
343
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job.CreateBatchPredictionJobOperator`,
|
344
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job.GetBatchPredictionJobOperator`,
|
345
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job.ListBatchPredictionJobsOperator`,
|
346
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job.DeleteBatchPredictionJobOperator`,
|
347
|
-
instead.
|
348
|
-
|
349
264
|
.. seealso::
|
350
265
|
For more information on how to use this operator, take a look at the guide:
|
351
266
|
:ref:`howto/operator:AutoMLBatchPredictOperator`
|
@@ -426,25 +341,6 @@ class AutoMLBatchPredictOperator(GoogleCloudBaseOperator):
|
|
426
341
|
gcp_conn_id=self.gcp_conn_id,
|
427
342
|
impersonation_chain=self.impersonation_chain,
|
428
343
|
)
|
429
|
-
model: Model = hook.get_model(
|
430
|
-
model_id=self.model_id,
|
431
|
-
location=self.location,
|
432
|
-
project_id=self.project_id,
|
433
|
-
retry=self.retry,
|
434
|
-
timeout=self.timeout,
|
435
|
-
metadata=self.metadata,
|
436
|
-
)
|
437
|
-
|
438
|
-
if not hasattr(model, "translation_model_metadata"):
|
439
|
-
_raise_exception_for_deprecated_operator(
|
440
|
-
self.__class__.__name__,
|
441
|
-
[
|
442
|
-
"CreateBatchPredictionJobOperator",
|
443
|
-
"GetBatchPredictionJobOperator",
|
444
|
-
"ListBatchPredictionJobsOperator",
|
445
|
-
"DeleteBatchPredictionJobOperator",
|
446
|
-
],
|
447
|
-
)
|
448
344
|
self.log.info("Fetch batch prediction.")
|
449
345
|
operation = hook.batch_predict(
|
450
346
|
model_id=self.model_id,
|
@@ -475,10 +371,6 @@ class AutoMLCreateDatasetOperator(GoogleCloudBaseOperator):
|
|
475
371
|
"""
|
476
372
|
Creates a Google Cloud AutoML dataset.
|
477
373
|
|
478
|
-
AutoMLCreateDatasetOperator for tables, video intelligence, vision and natural language has been
|
479
|
-
deprecated and no longer available. Please use
|
480
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.dataset.CreateDatasetOperator` instead.
|
481
|
-
|
482
374
|
.. seealso::
|
483
375
|
For more information on how to use this operator, take a look at the guide:
|
484
376
|
:ref:`howto/operator:AutoMLCreateDatasetOperator`
|
@@ -538,8 +430,6 @@ class AutoMLCreateDatasetOperator(GoogleCloudBaseOperator):
|
|
538
430
|
self.impersonation_chain = impersonation_chain
|
539
431
|
|
540
432
|
def execute(self, context: Context):
|
541
|
-
if "translation_dataset_metadata" not in self.dataset:
|
542
|
-
_raise_exception_for_deprecated_operator(self.__class__.__name__, "CreateDatasetOperator")
|
543
433
|
hook = CloudAutoMLHook(
|
544
434
|
gcp_conn_id=self.gcp_conn_id,
|
545
435
|
impersonation_chain=self.impersonation_chain,
|
@@ -573,10 +463,6 @@ class AutoMLImportDataOperator(GoogleCloudBaseOperator):
|
|
573
463
|
"""
|
574
464
|
Imports data to a Google Cloud AutoML dataset.
|
575
465
|
|
576
|
-
AutoMLImportDataOperator for tables, video intelligence, vision and natural language has been deprecated
|
577
|
-
and no longer available. Please use
|
578
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.dataset.ImportDataOperator` instead.
|
579
|
-
|
580
466
|
.. seealso::
|
581
467
|
For more information on how to use this operator, take a look at the guide:
|
582
468
|
:ref:`howto/operator:AutoMLImportDataOperator`
|
@@ -644,16 +530,6 @@ class AutoMLImportDataOperator(GoogleCloudBaseOperator):
|
|
644
530
|
gcp_conn_id=self.gcp_conn_id,
|
645
531
|
impersonation_chain=self.impersonation_chain,
|
646
532
|
)
|
647
|
-
dataset: Dataset = hook.get_dataset(
|
648
|
-
dataset_id=self.dataset_id,
|
649
|
-
location=self.location,
|
650
|
-
project_id=self.project_id,
|
651
|
-
retry=self.retry,
|
652
|
-
timeout=self.timeout,
|
653
|
-
metadata=self.metadata,
|
654
|
-
)
|
655
|
-
if not hasattr(dataset, "translation_dataset_metadata"):
|
656
|
-
_raise_exception_for_deprecated_operator(self.__class__.__name__, "ImportDataOperator")
|
657
533
|
self.log.info("Importing data to dataset...")
|
658
534
|
operation = hook.import_data(
|
659
535
|
dataset_id=self.dataset_id,
|
@@ -786,22 +662,10 @@ class AutoMLTablesListColumnSpecsOperator(GoogleCloudBaseOperator):
|
|
786
662
|
return result
|
787
663
|
|
788
664
|
|
789
|
-
@deprecated(
|
790
|
-
reason=(
|
791
|
-
"Class `AutoMLTablesUpdateDatasetOperator` has been deprecated and no longer available. "
|
792
|
-
"Please use `UpdateDatasetOperator` instead"
|
793
|
-
),
|
794
|
-
category=AirflowProviderDeprecationWarning,
|
795
|
-
action="error",
|
796
|
-
)
|
797
665
|
class AutoMLTablesUpdateDatasetOperator(GoogleCloudBaseOperator):
|
798
666
|
"""
|
799
667
|
Updates a dataset.
|
800
668
|
|
801
|
-
AutoMLTablesUpdateDatasetOperator has been deprecated and no longer available. Please use
|
802
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.dataset.UpdateDatasetOperator`
|
803
|
-
instead.
|
804
|
-
|
805
669
|
.. seealso::
|
806
670
|
For more information on how to use this operator, take a look at the guide:
|
807
671
|
:ref:`howto/operator:AutoMLTablesUpdateDatasetOperator`
|
@@ -889,10 +753,6 @@ class AutoMLGetModelOperator(GoogleCloudBaseOperator):
|
|
889
753
|
"""
|
890
754
|
Get Google Cloud AutoML model.
|
891
755
|
|
892
|
-
AutoMLGetModelOperator for tables, video intelligence, vision and natural language has been deprecated
|
893
|
-
and no longer available. Please use
|
894
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.model_service.GetModelOperator` instead.
|
895
|
-
|
896
756
|
.. seealso::
|
897
757
|
For more information on how to use this operator, take a look at the guide:
|
898
758
|
:ref:`howto/operator:AutoMLGetModelOperator`
|
@@ -963,8 +823,6 @@ class AutoMLGetModelOperator(GoogleCloudBaseOperator):
|
|
963
823
|
timeout=self.timeout,
|
964
824
|
metadata=self.metadata,
|
965
825
|
)
|
966
|
-
if not hasattr(result, "translation_model_metadata"):
|
967
|
-
_raise_exception_for_deprecated_operator(self.__class__.__name__, "GetModelOperator")
|
968
826
|
model = Model.to_dict(result)
|
969
827
|
project_id = self.project_id or hook.project_id
|
970
828
|
if project_id:
|
@@ -982,10 +840,6 @@ class AutoMLDeleteModelOperator(GoogleCloudBaseOperator):
|
|
982
840
|
"""
|
983
841
|
Delete Google Cloud AutoML model.
|
984
842
|
|
985
|
-
AutoMLDeleteModelOperator for tables, video intelligence, vision and natural language has been deprecated
|
986
|
-
and no longer available. Please use
|
987
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.model_service.DeleteModelOperator` instead.
|
988
|
-
|
989
843
|
.. seealso::
|
990
844
|
For more information on how to use this operator, take a look at the guide:
|
991
845
|
:ref:`howto/operator:AutoMLDeleteModelOperator`
|
@@ -1047,16 +901,6 @@ class AutoMLDeleteModelOperator(GoogleCloudBaseOperator):
|
|
1047
901
|
gcp_conn_id=self.gcp_conn_id,
|
1048
902
|
impersonation_chain=self.impersonation_chain,
|
1049
903
|
)
|
1050
|
-
model: Model = hook.get_model(
|
1051
|
-
model_id=self.model_id,
|
1052
|
-
location=self.location,
|
1053
|
-
project_id=self.project_id,
|
1054
|
-
retry=self.retry,
|
1055
|
-
timeout=self.timeout,
|
1056
|
-
metadata=self.metadata,
|
1057
|
-
)
|
1058
|
-
if not hasattr(model, "translation_model_metadata"):
|
1059
|
-
_raise_exception_for_deprecated_operator(self.__class__.__name__, "DeleteModelOperator")
|
1060
904
|
operation = hook.delete_model(
|
1061
905
|
model_id=self.model_id,
|
1062
906
|
location=self.location,
|
@@ -1069,14 +913,6 @@ class AutoMLDeleteModelOperator(GoogleCloudBaseOperator):
|
|
1069
913
|
self.log.info("Deletion is completed")
|
1070
914
|
|
1071
915
|
|
1072
|
-
@deprecated(
|
1073
|
-
reason=(
|
1074
|
-
"Class `AutoMLDeployModelOperator` has been deprecated and no longer available. Please use "
|
1075
|
-
"`DeployModelOperator` instead"
|
1076
|
-
),
|
1077
|
-
category=AirflowProviderDeprecationWarning,
|
1078
|
-
action="error",
|
1079
|
-
)
|
1080
916
|
class AutoMLDeployModelOperator(GoogleCloudBaseOperator):
|
1081
917
|
"""
|
1082
918
|
Deploys a model; if a model is already deployed, deploying it with the same parameters has no effect.
|
@@ -1087,10 +923,6 @@ class AutoMLDeployModelOperator(GoogleCloudBaseOperator):
|
|
1087
923
|
Only applicable for Text Classification, Image Object Detection and Tables; all other
|
1088
924
|
domains manage deployment automatically.
|
1089
925
|
|
1090
|
-
AutoMLDeployModelOperator has been deprecated and no longer available. Please use
|
1091
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.endpoint_service.DeployModelOperator`
|
1092
|
-
instead.
|
1093
|
-
|
1094
926
|
.. seealso::
|
1095
927
|
For more information on how to use this operator, take a look at the guide:
|
1096
928
|
:ref:`howto/operator:AutoMLDeployModelOperator`
|
@@ -1157,16 +989,6 @@ class AutoMLDeployModelOperator(GoogleCloudBaseOperator):
|
|
1157
989
|
gcp_conn_id=self.gcp_conn_id,
|
1158
990
|
impersonation_chain=self.impersonation_chain,
|
1159
991
|
)
|
1160
|
-
model = hook.get_model(
|
1161
|
-
model_id=self.model_id,
|
1162
|
-
location=self.location,
|
1163
|
-
project_id=self.project_id,
|
1164
|
-
retry=self.retry,
|
1165
|
-
timeout=self.timeout,
|
1166
|
-
metadata=self.metadata,
|
1167
|
-
)
|
1168
|
-
if not hasattr(model, "translation_model_metadata"):
|
1169
|
-
_raise_exception_for_deprecated_operator(self.__class__.__name__, "DeployModelOperator")
|
1170
992
|
self.log.info("Deploying model_id %s", self.model_id)
|
1171
993
|
|
1172
994
|
operation = hook.deploy_model(
|
@@ -1286,10 +1108,6 @@ class AutoMLListDatasetOperator(GoogleCloudBaseOperator):
|
|
1286
1108
|
"""
|
1287
1109
|
Lists AutoML Datasets in project.
|
1288
1110
|
|
1289
|
-
AutoMLListDatasetOperator for tables, video intelligence, vision and natural language has been deprecated
|
1290
|
-
and no longer available. Please use
|
1291
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.dataset.ListDatasetsOperator` instead.
|
1292
|
-
|
1293
1111
|
.. seealso::
|
1294
1112
|
For more information on how to use this operator, take a look at the guide:
|
1295
1113
|
:ref:`howto/operator:AutoMLListDatasetOperator`
|
@@ -1354,16 +1172,7 @@ class AutoMLListDatasetOperator(GoogleCloudBaseOperator):
|
|
1354
1172
|
timeout=self.timeout,
|
1355
1173
|
metadata=self.metadata,
|
1356
1174
|
)
|
1357
|
-
result = []
|
1358
|
-
for dataset in page_iterator:
|
1359
|
-
if not hasattr(dataset, "translation_dataset_metadata"):
|
1360
|
-
warnings.warn(
|
1361
|
-
"Class `AutoMLListDatasetOperator` has been deprecated and no longer available. "
|
1362
|
-
"Please use `ListDatasetsOperator` instead.",
|
1363
|
-
stacklevel=2,
|
1364
|
-
)
|
1365
|
-
else:
|
1366
|
-
result.append(Dataset.to_dict(dataset))
|
1175
|
+
result = [Dataset.to_dict(dataset) for dataset in page_iterator]
|
1367
1176
|
self.log.info("Datasets obtained.")
|
1368
1177
|
|
1369
1178
|
self.xcom_push(
|
@@ -1381,10 +1190,6 @@ class AutoMLDeleteDatasetOperator(GoogleCloudBaseOperator):
|
|
1381
1190
|
"""
|
1382
1191
|
Deletes a dataset and all of its contents.
|
1383
1192
|
|
1384
|
-
AutoMLDeleteDatasetOperator for tables, video intelligence, vision and natural language has been
|
1385
|
-
deprecated and no longer available. Please use
|
1386
|
-
:class:`airflow.providers.google.cloud.operators.vertex_ai.dataset.DeleteDatasetOperator` instead.
|
1387
|
-
|
1388
1193
|
.. seealso::
|
1389
1194
|
For more information on how to use this operator, take a look at the guide:
|
1390
1195
|
:ref:`howto/operator:AutoMLDeleteDatasetOperator`
|
@@ -1455,16 +1260,6 @@ class AutoMLDeleteDatasetOperator(GoogleCloudBaseOperator):
|
|
1455
1260
|
gcp_conn_id=self.gcp_conn_id,
|
1456
1261
|
impersonation_chain=self.impersonation_chain,
|
1457
1262
|
)
|
1458
|
-
dataset: Dataset = hook.get_dataset(
|
1459
|
-
dataset_id=self.dataset_id,
|
1460
|
-
location=self.location,
|
1461
|
-
project_id=self.project_id,
|
1462
|
-
retry=self.retry,
|
1463
|
-
timeout=self.timeout,
|
1464
|
-
metadata=self.metadata,
|
1465
|
-
)
|
1466
|
-
if not hasattr(dataset, "translation_dataset_metadata"):
|
1467
|
-
_raise_exception_for_deprecated_operator(self.__class__.__name__, "DeleteDatasetOperator")
|
1468
1263
|
dataset_id_list = self._parse_dataset_id(self.dataset_id)
|
1469
1264
|
for dataset_id in dataset_id_list:
|
1470
1265
|
self.log.info("Deleting dataset %s", dataset_id)
|