apache-airflow-providers-google 10.10.0__py3-none-any.whl → 10.10.1__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.
Files changed (29) hide show
  1. airflow/providers/google/__init__.py +1 -1
  2. airflow/providers/google/cloud/hooks/cloud_run.py +4 -2
  3. airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +131 -27
  4. airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +1 -9
  5. airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +121 -4
  6. airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py +1 -11
  7. airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +1 -10
  8. airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +220 -6
  9. airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +409 -0
  10. airflow/providers/google/cloud/links/vertex_ai.py +49 -0
  11. airflow/providers/google/cloud/operators/dataproc.py +32 -10
  12. airflow/providers/google/cloud/operators/gcs.py +1 -1
  13. airflow/providers/google/cloud/operators/mlengine.py +116 -0
  14. airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +45 -0
  15. airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +2 -8
  16. airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +287 -201
  17. airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +1 -9
  18. airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +2 -9
  19. airflow/providers/google/cloud/operators/vertex_ai/model_service.py +451 -12
  20. airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +464 -0
  21. airflow/providers/google/cloud/utils/mlengine_operator_utils.py +7 -1
  22. airflow/providers/google/get_provider_info.py +5 -0
  23. {apache_airflow_providers_google-10.10.0.dist-info → apache_airflow_providers_google-10.10.1.dist-info}/METADATA +6 -6
  24. {apache_airflow_providers_google-10.10.0.dist-info → apache_airflow_providers_google-10.10.1.dist-info}/RECORD +29 -27
  25. {apache_airflow_providers_google-10.10.0.dist-info → apache_airflow_providers_google-10.10.1.dist-info}/LICENSE +0 -0
  26. {apache_airflow_providers_google-10.10.0.dist-info → apache_airflow_providers_google-10.10.1.dist-info}/NOTICE +0 -0
  27. {apache_airflow_providers_google-10.10.0.dist-info → apache_airflow_providers_google-10.10.1.dist-info}/WHEEL +0 -0
  28. {apache_airflow_providers_google-10.10.0.dist-info → apache_airflow_providers_google-10.10.1.dist-info}/entry_points.txt +0 -0
  29. {apache_airflow_providers_google-10.10.0.dist-info → apache_airflow_providers_google-10.10.1.dist-info}/top_level.txt +0 -0
@@ -28,7 +28,7 @@ import packaging.version
28
28
 
29
29
  __all__ = ["__version__"]
30
30
 
31
- __version__ = "10.10.0"
31
+ __version__ = "10.10.1"
32
32
 
33
33
  try:
34
34
  from airflow import __version__ as airflow_version
@@ -165,7 +165,7 @@ class CloudRunAsyncHook(GoogleBaseHook):
165
165
  gcp_conn_id: str = "google_cloud_default",
166
166
  impersonation_chain: str | Sequence[str] | None = None,
167
167
  ):
168
- self._client: JobsAsyncClient = JobsAsyncClient()
168
+ self._client: JobsAsyncClient | None = None
169
169
  super().__init__(gcp_conn_id=gcp_conn_id, impersonation_chain=impersonation_chain)
170
170
 
171
171
  def get_conn(self):
@@ -175,4 +175,6 @@ class CloudRunAsyncHook(GoogleBaseHook):
175
175
  return self._client
176
176
 
177
177
  async def get_operation(self, operation_name: str) -> operations_pb2.Operation:
178
- return await self.get_conn().get_operation(operations_pb2.GetOperationRequest(name=operation_name))
178
+ return await self.get_conn().get_operation(
179
+ operations_pb2.GetOperationRequest(name=operation_name), timeout=120
180
+ )
@@ -15,33 +15,7 @@
15
15
  # KIND, either express or implied. See the License for the
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
- """
19
- This module contains a Google Cloud Vertex AI hook.
20
-
21
- .. spelling:word-list::
22
-
23
- aiplatform
24
- au
25
- codepoints
26
- milli
27
- mae
28
- quantile
29
- quantiles
30
- Quantiles
31
- rmse
32
- rmsle
33
- rmspe
34
- wape
35
- prc
36
- roc
37
- Jetson
38
- forecasted
39
- Struct
40
- sentimentMax
41
- TrainingPipeline
42
- targetColumn
43
- optimizationObjective
44
- """
18
+ """This module contains a Google Cloud Vertex AI hook."""
45
19
  from __future__ import annotations
46
20
 
47
21
  import warnings
@@ -314,6 +288,10 @@ class AutoMLHook(GoogleBaseHook):
314
288
  export_evaluated_data_items_bigquery_destination_uri: str | None = None,
315
289
  export_evaluated_data_items_override_destination: bool = False,
316
290
  sync: bool = True,
291
+ parent_model: str | None = None,
292
+ is_default_version: bool | None = None,
293
+ model_version_aliases: list[str] | None = None,
294
+ model_version_description: str | None = None,
317
295
  ) -> tuple[models.Model | None, str]:
318
296
  """
319
297
  Create an AutoML Tabular Training Job.
@@ -327,6 +305,24 @@ class AutoMLHook(GoogleBaseHook):
327
305
  [google.cloud.aiplatform.v1beta1.TrainingPipeline.training_task_definition]. For tabular
328
306
  Datasets, all their data is exported to training, to pick and choose from.
329
307
  :param target_column: Required. The name of the column values of which the Model is to predict.
308
+ :param parent_model: Optional. The resource name or model ID of an existing model.
309
+ The new model uploaded by this job will be a version of `parent_model`.
310
+ Only set this field when training a new version of an existing model.
311
+ :param is_default_version: Optional. When set to True, the newly uploaded model version will
312
+ automatically have alias "default" included. Subsequent uses of
313
+ the model produced by this job without a version specified will
314
+ use this "default" version.
315
+ When set to False, the "default" alias will not be moved.
316
+ Actions targeting the model version produced by this job will need
317
+ to specifically reference this version by ID or alias.
318
+ New model uploads, i.e. version 1, will always be "default" aliased.
319
+ :param model_version_aliases: Optional. User provided version aliases so that the model version
320
+ uploaded by this job can be referenced via alias instead of
321
+ auto-generated version ID. A default version alias will be created
322
+ for the first version of the model.
323
+ The format is [a-z][a-zA-Z0-9-]{0,126}[a-z0-9]
324
+ :param model_version_description: Optional. The description of the model version
325
+ being uploaded by this job.
330
326
  :param optimization_prediction_type: The type of prediction the Model is to produce.
331
327
  "classification" - Predict one out of multiple target values is picked for each row.
332
328
  "regression" - Predict a value based on its relation to other values. This type is available only
@@ -498,6 +494,10 @@ class AutoMLHook(GoogleBaseHook):
498
494
  ),
499
495
  export_evaluated_data_items_override_destination=export_evaluated_data_items_override_destination,
500
496
  sync=sync,
497
+ parent_model=parent_model,
498
+ is_default_version=is_default_version,
499
+ model_version_aliases=model_version_aliases,
500
+ model_version_description=model_version_description,
501
501
  )
502
502
  training_id = self.extract_training_id(self._job.resource_name)
503
503
  if model:
@@ -546,6 +546,10 @@ class AutoMLHook(GoogleBaseHook):
546
546
  model_display_name: str | None = None,
547
547
  model_labels: dict[str, str] | None = None,
548
548
  sync: bool = True,
549
+ parent_model: str | None = None,
550
+ is_default_version: bool | None = None,
551
+ model_version_aliases: list[str] | None = None,
552
+ model_version_description: str | None = None,
549
553
  ) -> tuple[models.Model | None, str]:
550
554
  """
551
555
  Create an AutoML Forecasting Training Job.
@@ -560,6 +564,24 @@ class AutoMLHook(GoogleBaseHook):
560
564
  Datasets, all their data is exported to training, to pick and choose from.
561
565
  :param target_column: Required. Name of the column that the Model is to predict values for.
562
566
  :param time_column: Required. Name of the column that identifies time order in the time series.
567
+ :param parent_model: Optional. The resource name or model ID of an existing model.
568
+ The new model uploaded by this job will be a version of `parent_model`.
569
+ Only set this field when training a new version of an existing model.
570
+ :param is_default_version: Optional. When set to True, the newly uploaded model version will
571
+ automatically have alias "default" included. Subsequent uses of
572
+ the model produced by this job without a version specified will
573
+ use this "default" version.
574
+ When set to False, the "default" alias will not be moved.
575
+ Actions targeting the model version produced by this job will need
576
+ to specifically reference this version by ID or alias.
577
+ New model uploads, i.e. version 1, will always be "default" aliased.
578
+ :param model_version_aliases: Optional. User provided version aliases so that the model version
579
+ uploaded by this job can be referenced via alias instead of
580
+ auto-generated version ID. A default version alias will be created
581
+ for the first version of the model.
582
+ The format is [a-z][a-zA-Z0-9-]{0,126}[a-z0-9]
583
+ :param model_version_description: Optional. The description of the model version
584
+ being uploaded by this job.
563
585
  :param time_series_identifier_column: Required. Name of the column that identifies the time series.
564
586
  :param unavailable_at_forecast_columns: Required. Column names of columns that are unavailable at
565
587
  forecast. Each column contains information for the given entity (identified by the
@@ -731,6 +753,10 @@ class AutoMLHook(GoogleBaseHook):
731
753
  model_display_name=model_display_name,
732
754
  model_labels=model_labels,
733
755
  sync=sync,
756
+ parent_model=parent_model,
757
+ is_default_version=is_default_version,
758
+ model_version_aliases=model_version_aliases,
759
+ model_version_description=model_version_description,
734
760
  )
735
761
  training_id = self.extract_training_id(self._job.resource_name)
736
762
  if model:
@@ -767,6 +793,10 @@ class AutoMLHook(GoogleBaseHook):
767
793
  model_labels: dict[str, str] | None = None,
768
794
  disable_early_stopping: bool = False,
769
795
  sync: bool = True,
796
+ parent_model: str | None = None,
797
+ is_default_version: bool | None = None,
798
+ model_version_aliases: list[str] | None = None,
799
+ model_version_description: str | None = None,
770
800
  ) -> tuple[models.Model | None, str]:
771
801
  """
772
802
  Create an AutoML Image Training Job.
@@ -784,6 +814,24 @@ class AutoMLHook(GoogleBaseHook):
784
814
  "object_detection" - Predict a value based on its relation to other values. This type is
785
815
  available only to columns that contain semantically numeric values, i.e. integers or floating
786
816
  point number, even if stored as e.g. strings.
817
+ :param parent_model: Optional. The resource name or model ID of an existing model.
818
+ The new model uploaded by this job will be a version of `parent_model`.
819
+ Only set this field when training a new version of an existing model.
820
+ :param is_default_version: Optional. When set to True, the newly uploaded model version will
821
+ automatically have alias "default" included. Subsequent uses of
822
+ the model produced by this job without a version specified will
823
+ use this "default" version.
824
+ When set to False, the "default" alias will not be moved.
825
+ Actions targeting the model version produced by this job will need
826
+ to specifically reference this version by ID or alias.
827
+ New model uploads, i.e. version 1, will always be "default" aliased.
828
+ :param model_version_aliases: Optional. User provided version aliases so that the model version
829
+ uploaded by this job can be referenced via alias instead of
830
+ auto-generated version ID. A default version alias will be created
831
+ for the first version of the model.
832
+ The format is [a-z][a-zA-Z0-9-]{0,126}[a-z0-9]
833
+ :param model_version_description: Optional. The description of the model version
834
+ being uploaded by this job.
787
835
  :param multi_label: Required. Default is False. If false, a single-label (multi-class) Model will be
788
836
  trained (i.e. assuming that for each image just up to one annotation may be applicable). If true,
789
837
  a multi-label Model will be trained (i.e. assuming that for each image multiple annotations may
@@ -907,6 +955,10 @@ class AutoMLHook(GoogleBaseHook):
907
955
  model_labels=model_labels,
908
956
  disable_early_stopping=disable_early_stopping,
909
957
  sync=sync,
958
+ parent_model=parent_model,
959
+ is_default_version=is_default_version,
960
+ model_version_aliases=model_version_aliases,
961
+ model_version_description=model_version_description,
910
962
  )
911
963
  training_id = self.extract_training_id(self._job.resource_name)
912
964
  if model:
@@ -940,6 +992,10 @@ class AutoMLHook(GoogleBaseHook):
940
992
  model_display_name: str | None = None,
941
993
  model_labels: dict[str, str] | None = None,
942
994
  sync: bool = True,
995
+ parent_model: str | None = None,
996
+ is_default_version: bool | None = None,
997
+ model_version_aliases: list[str] | None = None,
998
+ model_version_description: str | None = None,
943
999
  ) -> tuple[models.Model | None, str]:
944
1000
  """
945
1001
  Create an AutoML Text Training Job.
@@ -960,6 +1016,24 @@ class AutoMLHook(GoogleBaseHook):
960
1016
  "sentiment" - A sentiment analysis model inspects text data and identifies the prevailing
961
1017
  emotional opinion within it, especially to determine a writer's attitude as positive, negative,
962
1018
  or neutral.
1019
+ :param parent_model: Optional. The resource name or model ID of an existing model.
1020
+ The new model uploaded by this job will be a version of `parent_model`.
1021
+ Only set this field when training a new version of an existing model.
1022
+ :param is_default_version: Optional. When set to True, the newly uploaded model version will
1023
+ automatically have alias "default" included. Subsequent uses of
1024
+ the model produced by this job without a version specified will
1025
+ use this "default" version.
1026
+ When set to False, the "default" alias will not be moved.
1027
+ Actions targeting the model version produced by this job will need
1028
+ to specifically reference this version by ID or alias.
1029
+ New model uploads, i.e. version 1, will always be "default" aliased.
1030
+ :param model_version_aliases: Optional. User provided version aliases so that the model version
1031
+ uploaded by this job can be referenced via alias instead of
1032
+ auto-generated version ID. A default version alias will be created
1033
+ for the first version of the model.
1034
+ The format is [a-z][a-zA-Z0-9-]{0,126}[a-z0-9]
1035
+ :param model_version_description: Optional. The description of the model version
1036
+ being uploaded by this job.
963
1037
  :param multi_label: Required and only applicable for text classification task. If false, a
964
1038
  single-label (multi-class) Model will be trained (i.e. assuming that for each text snippet just
965
1039
  up to one annotation may be applicable). If true, a multi-label Model will be trained (i.e.
@@ -1044,6 +1118,10 @@ class AutoMLHook(GoogleBaseHook):
1044
1118
  model_display_name=model_display_name,
1045
1119
  model_labels=model_labels,
1046
1120
  sync=sync,
1121
+ parent_model=parent_model,
1122
+ is_default_version=is_default_version,
1123
+ model_version_aliases=model_version_aliases,
1124
+ model_version_description=model_version_description,
1047
1125
  )
1048
1126
  training_id = self.extract_training_id(self._job.resource_name)
1049
1127
  if model:
@@ -1074,6 +1152,10 @@ class AutoMLHook(GoogleBaseHook):
1074
1152
  model_display_name: str | None = None,
1075
1153
  model_labels: dict[str, str] | None = None,
1076
1154
  sync: bool = True,
1155
+ parent_model: str | None = None,
1156
+ is_default_version: bool | None = None,
1157
+ model_version_aliases: list[str] | None = None,
1158
+ model_version_description: str | None = None,
1077
1159
  ) -> tuple[models.Model | None, str]:
1078
1160
  """
1079
1161
  Create an AutoML Video Training Job.
@@ -1094,6 +1176,24 @@ class AutoMLHook(GoogleBaseHook):
1094
1176
  pre-defined, custom labels.
1095
1177
  "action_recognition" - A video action recognition model pinpoints the location of actions with
1096
1178
  short temporal durations (~1 second).
1179
+ :param parent_model: Optional. The resource name or model ID of an existing model.
1180
+ The new model uploaded by this job will be a version of `parent_model`.
1181
+ Only set this field when training a new version of an existing model.
1182
+ :param is_default_version: Optional. When set to True, the newly uploaded model version will
1183
+ automatically have alias "default" included. Subsequent uses of
1184
+ the model produced by this job without a version specified will
1185
+ use this "default" version.
1186
+ When set to False, the "default" alias will not be moved.
1187
+ Actions targeting the model version produced by this job will need
1188
+ to specifically reference this version by ID or alias.
1189
+ New model uploads, i.e. version 1, will always be "default" aliased.
1190
+ :param model_version_aliases: Optional. User provided version aliases so that the model version
1191
+ uploaded by this job can be referenced via alias instead of
1192
+ auto-generated version ID. A default version alias will be created
1193
+ for the first version of the model.
1194
+ The format is [a-z][a-zA-Z0-9-]{0,126}[a-z0-9]
1195
+ :param model_version_description: Optional. The description of the model version
1196
+ being uploaded by this job.
1097
1197
  :param model_type: Required. One of the following:
1098
1198
  "CLOUD" - available for "classification", "object_tracking" and "action_recognition" A Model best
1099
1199
  tailored to be used within Google Cloud, and which cannot be exported.
@@ -1175,6 +1275,10 @@ class AutoMLHook(GoogleBaseHook):
1175
1275
  model_display_name=model_display_name,
1176
1276
  model_labels=model_labels,
1177
1277
  sync=sync,
1278
+ parent_model=parent_model,
1279
+ is_default_version=is_default_version,
1280
+ model_version_aliases=model_version_aliases,
1281
+ model_version_description=model_version_description,
1178
1282
  )
1179
1283
  training_id = self.extract_training_id(self._job.resource_name)
1180
1284
  if model:
@@ -15,15 +15,7 @@
15
15
  # KIND, either express or implied. See the License for the
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
- """This module contains a Google Cloud Vertex AI hook.
19
-
20
- .. spelling:word-list::
21
-
22
- jsonl
23
- codepoints
24
- aiplatform
25
- gapic
26
- """
18
+ """This module contains a Google Cloud Vertex AI hook."""
27
19
  from __future__ import annotations
28
20
 
29
21
  from typing import TYPE_CHECKING, Sequence
@@ -18,6 +18,7 @@
18
18
  """This module contains a Google Cloud Vertex AI hook."""
19
19
  from __future__ import annotations
20
20
 
21
+ import warnings
21
22
  from typing import TYPE_CHECKING, Sequence
22
23
 
23
24
  from google.api_core.client_options import ClientOptions
@@ -31,7 +32,7 @@ from google.cloud.aiplatform import (
31
32
  )
32
33
  from google.cloud.aiplatform_v1 import JobServiceClient, PipelineServiceClient
33
34
 
34
- from airflow.exceptions import AirflowException
35
+ from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
35
36
  from airflow.providers.google.common.consts import CLIENT_INFO
36
37
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
37
38
 
@@ -303,6 +304,10 @@ class CustomJobHook(GoogleBaseHook):
303
304
  timestamp_split_column_name: str | None = None,
304
305
  tensorboard: str | None = None,
305
306
  sync=True,
307
+ parent_model: str | None = None,
308
+ is_default_version: bool | None = None,
309
+ model_version_aliases: list[str] | None = None,
310
+ model_version_description: str | None = None,
306
311
  ) -> tuple[models.Model | None, str, str]:
307
312
  """Run Job for training pipeline."""
308
313
  model = job.run(
@@ -332,6 +337,10 @@ class CustomJobHook(GoogleBaseHook):
332
337
  timestamp_split_column_name=timestamp_split_column_name,
333
338
  tensorboard=tensorboard,
334
339
  sync=sync,
340
+ parent_model=parent_model,
341
+ is_default_version=is_default_version,
342
+ model_version_aliases=model_version_aliases,
343
+ model_version_description=model_version_description,
335
344
  )
336
345
  training_id = self.extract_training_id(job.resource_name)
337
346
  custom_job_id = self.extract_custom_job_id(
@@ -361,7 +370,7 @@ class CustomJobHook(GoogleBaseHook):
361
370
  """
362
371
  Cancels a PipelineJob.
363
372
 
364
- Starts asynchronous cancellation on the PipelineJob. The server makes a best
373
+ Starts asynchronous cancellation on the PipelineJob. The server makes the best
365
374
  effort to cancel the pipeline, but success is not guaranteed. Clients can use
366
375
  [PipelineService.GetPipelineJob][google.cloud.aiplatform.v1.PipelineService.GetPipelineJob] or other
367
376
  methods to check whether the cancellation succeeded or whether the pipeline completed despite
@@ -370,6 +379,8 @@ class CustomJobHook(GoogleBaseHook):
370
379
  [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to ``Code.CANCELLED``, and
371
380
  [PipelineJob.state][google.cloud.aiplatform.v1.PipelineJob.state] is set to ``CANCELLED``.
372
381
 
382
+ This method is deprecated, please use `PipelineJobHook.cancel_pipeline_job` method.
383
+
373
384
  :param project_id: Required. The ID of the Google Cloud project that the service belongs to.
374
385
  :param region: Required. The ID of the Google Cloud region that the service belongs to.
375
386
  :param pipeline_job: The name of the PipelineJob to cancel.
@@ -377,6 +388,10 @@ class CustomJobHook(GoogleBaseHook):
377
388
  :param timeout: The timeout for this request.
378
389
  :param metadata: Strings which should be sent along with the request as metadata.
379
390
  """
391
+ warnings.warn(
392
+ "This method is deprecated, please use `PipelineJobHook.cancel_pipeline_job` method.",
393
+ AirflowProviderDeprecationWarning,
394
+ )
380
395
  client = self.get_pipeline_service_client(region)
381
396
  name = client.pipeline_job_path(project_id, region, pipeline_job)
382
397
 
@@ -403,7 +418,7 @@ class CustomJobHook(GoogleBaseHook):
403
418
  Cancels a TrainingPipeline.
404
419
 
405
420
  Starts asynchronous cancellation on the TrainingPipeline. The server makes
406
- a best effort to cancel the pipeline, but success is not guaranteed. Clients can use
421
+ the best effort to cancel the pipeline, but success is not guaranteed. Clients can use
407
422
  [PipelineService.GetTrainingPipeline][google.cloud.aiplatform.v1.PipelineService.GetTrainingPipeline]
408
423
  or other methods to check whether the cancellation succeeded or whether the pipeline completed despite
409
424
  cancellation. On successful cancellation, the TrainingPipeline is not deleted; instead it becomes a
@@ -443,7 +458,7 @@ class CustomJobHook(GoogleBaseHook):
443
458
  """
444
459
  Cancels a CustomJob.
445
460
 
446
- Starts asynchronous cancellation on the CustomJob. The server makes a best effort
461
+ Starts asynchronous cancellation on the CustomJob. The server makes the best effort
447
462
  to cancel the job, but success is not guaranteed. Clients can use
448
463
  [JobService.GetCustomJob][google.cloud.aiplatform.v1.JobService.GetCustomJob] or other methods to
449
464
  check whether the cancellation succeeded or whether the job completed despite cancellation. On
@@ -485,6 +500,8 @@ class CustomJobHook(GoogleBaseHook):
485
500
  """
486
501
  Creates a PipelineJob. A PipelineJob will run immediately when created.
487
502
 
503
+ This method is deprecated, please use `PipelineJobHook.create_pipeline_job` method.
504
+
488
505
  :param project_id: Required. The ID of the Google Cloud project that the service belongs to.
489
506
  :param region: Required. The ID of the Google Cloud region that the service belongs to.
490
507
  :param pipeline_job: Required. The PipelineJob to create.
@@ -496,6 +513,10 @@ class CustomJobHook(GoogleBaseHook):
496
513
  :param timeout: The timeout for this request.
497
514
  :param metadata: Strings which should be sent along with the request as metadata.
498
515
  """
516
+ warnings.warn(
517
+ "This method is deprecated, please use `PipelineJobHook.create_pipeline_job` method.",
518
+ AirflowProviderDeprecationWarning,
519
+ )
499
520
  client = self.get_pipeline_service_client(region)
500
521
  parent = client.common_location_path(project_id, region)
501
522
 
@@ -599,6 +620,10 @@ class CustomJobHook(GoogleBaseHook):
599
620
  model_instance_schema_uri: str | None = None,
600
621
  model_parameters_schema_uri: str | None = None,
601
622
  model_prediction_schema_uri: str | None = None,
623
+ parent_model: str | None = None,
624
+ is_default_version: bool | None = None,
625
+ model_version_aliases: list[str] | None = None,
626
+ model_version_description: str | None = None,
602
627
  labels: dict[str, str] | None = None,
603
628
  training_encryption_spec_key_name: str | None = None,
604
629
  model_encryption_spec_key_name: str | None = None,
@@ -716,6 +741,24 @@ class CustomJobHook(GoogleBaseHook):
716
741
  and probably different, including the URI scheme, than the
717
742
  one given on input. The output URI will point to a location
718
743
  where the user only has a read access.
744
+ :param parent_model: Optional. The resource name or model ID of an existing model.
745
+ The new model uploaded by this job will be a version of `parent_model`.
746
+ Only set this field when training a new version of an existing model.
747
+ :param is_default_version: Optional. When set to True, the newly uploaded model version will
748
+ automatically have alias "default" included. Subsequent uses of
749
+ the model produced by this job without a version specified will
750
+ use this "default" version.
751
+ When set to False, the "default" alias will not be moved.
752
+ Actions targeting the model version produced by this job will need
753
+ to specifically reference this version by ID or alias.
754
+ New model uploads, i.e. version 1, will always be "default" aliased.
755
+ :param model_version_aliases: Optional. User provided version aliases so that the model version
756
+ uploaded by this job can be referenced via alias instead of
757
+ auto-generated version ID. A default version alias will be created
758
+ for the first version of the model.
759
+ The format is [a-z][a-zA-Z0-9-]{0,126}[a-z0-9]
760
+ :param model_version_description: Optional. The description of the model version
761
+ being uploaded by this job.
719
762
  :param project_id: Project to run training in.
720
763
  :param region: Location to run training in.
721
764
  :param labels: Optional. The labels with user-defined metadata to
@@ -933,6 +976,10 @@ class CustomJobHook(GoogleBaseHook):
933
976
  timestamp_split_column_name=timestamp_split_column_name,
934
977
  tensorboard=tensorboard,
935
978
  sync=sync,
979
+ parent_model=parent_model,
980
+ is_default_version=is_default_version,
981
+ model_version_aliases=model_version_aliases,
982
+ model_version_description=model_version_description,
936
983
  )
937
984
 
938
985
  return model, training_id, custom_job_id
@@ -990,6 +1037,10 @@ class CustomJobHook(GoogleBaseHook):
990
1037
  predefined_split_column_name: str | None = None,
991
1038
  timestamp_split_column_name: str | None = None,
992
1039
  tensorboard: str | None = None,
1040
+ parent_model: str | None = None,
1041
+ is_default_version: bool | None = None,
1042
+ model_version_aliases: list[str] | None = None,
1043
+ model_version_description: str | None = None,
993
1044
  sync=True,
994
1045
  ) -> tuple[models.Model | None, str, str]:
995
1046
  """
@@ -1074,6 +1125,24 @@ class CustomJobHook(GoogleBaseHook):
1074
1125
  and probably different, including the URI scheme, than the
1075
1126
  one given on input. The output URI will point to a location
1076
1127
  where the user only has a read access.
1128
+ :param parent_model: Optional. The resource name or model ID of an existing model.
1129
+ The new model uploaded by this job will be a version of `parent_model`.
1130
+ Only set this field when training a new version of an existing model.
1131
+ :param is_default_version: Optional. When set to True, the newly uploaded model version will
1132
+ automatically have alias "default" included. Subsequent uses of
1133
+ the model produced by this job without a version specified will
1134
+ use this "default" version.
1135
+ When set to False, the "default" alias will not be moved.
1136
+ Actions targeting the model version produced by this job will need
1137
+ to specifically reference this version by ID or alias.
1138
+ New model uploads, i.e. version 1, will always be "default" aliased.
1139
+ :param model_version_aliases: Optional. User provided version aliases so that the model version
1140
+ uploaded by this job can be referenced via alias instead of
1141
+ auto-generated version ID. A default version alias will be created
1142
+ for the first version of the model.
1143
+ The format is [a-z][a-zA-Z0-9-]{0,126}[a-z0-9]
1144
+ :param model_version_description: Optional. The description of the model version
1145
+ being uploaded by this job.
1077
1146
  :param project_id: Project to run training in.
1078
1147
  :param region: Location to run training in.
1079
1148
  :param labels: Optional. The labels with user-defined metadata to
@@ -1291,6 +1360,10 @@ class CustomJobHook(GoogleBaseHook):
1291
1360
  timestamp_split_column_name=timestamp_split_column_name,
1292
1361
  tensorboard=tensorboard,
1293
1362
  sync=sync,
1363
+ parent_model=parent_model,
1364
+ is_default_version=is_default_version,
1365
+ model_version_aliases=model_version_aliases,
1366
+ model_version_description=model_version_description,
1294
1367
  )
1295
1368
 
1296
1369
  return model, training_id, custom_job_id
@@ -1315,6 +1388,10 @@ class CustomJobHook(GoogleBaseHook):
1315
1388
  model_instance_schema_uri: str | None = None,
1316
1389
  model_parameters_schema_uri: str | None = None,
1317
1390
  model_prediction_schema_uri: str | None = None,
1391
+ parent_model: str | None = None,
1392
+ is_default_version: bool | None = None,
1393
+ model_version_aliases: list[str] | None = None,
1394
+ model_version_description: str | None = None,
1318
1395
  labels: dict[str, str] | None = None,
1319
1396
  training_encryption_spec_key_name: str | None = None,
1320
1397
  model_encryption_spec_key_name: str | None = None,
@@ -1432,6 +1509,24 @@ class CustomJobHook(GoogleBaseHook):
1432
1509
  and probably different, including the URI scheme, than the
1433
1510
  one given on input. The output URI will point to a location
1434
1511
  where the user only has a read access.
1512
+ :param parent_model: Optional. The resource name or model ID of an existing model.
1513
+ The new model uploaded by this job will be a version of `parent_model`.
1514
+ Only set this field when training a new version of an existing model.
1515
+ :param is_default_version: Optional. When set to True, the newly uploaded model version will
1516
+ automatically have alias "default" included. Subsequent uses of
1517
+ the model produced by this job without a version specified will
1518
+ use this "default" version.
1519
+ When set to False, the "default" alias will not be moved.
1520
+ Actions targeting the model version produced by this job will need
1521
+ to specifically reference this version by ID or alias.
1522
+ New model uploads, i.e. version 1, will always be "default" aliased.
1523
+ :param model_version_aliases: Optional. User provided version aliases so that the model version
1524
+ uploaded by this job can be referenced via alias instead of
1525
+ auto-generated version ID. A default version alias will be created
1526
+ for the first version of the model.
1527
+ The format is [a-z][a-zA-Z0-9-]{0,126}[a-z0-9]
1528
+ :param model_version_description: Optional. The description of the model version
1529
+ being uploaded by this job.
1435
1530
  :param project_id: Project to run training in.
1436
1531
  :param region: Location to run training in.
1437
1532
  :param labels: Optional. The labels with user-defined metadata to
@@ -1649,6 +1744,10 @@ class CustomJobHook(GoogleBaseHook):
1649
1744
  timestamp_split_column_name=timestamp_split_column_name,
1650
1745
  tensorboard=tensorboard,
1651
1746
  sync=sync,
1747
+ parent_model=parent_model,
1748
+ is_default_version=is_default_version,
1749
+ model_version_aliases=model_version_aliases,
1750
+ model_version_description=model_version_description,
1652
1751
  )
1653
1752
 
1654
1753
  return model, training_id, custom_job_id
@@ -1666,6 +1765,8 @@ class CustomJobHook(GoogleBaseHook):
1666
1765
  """
1667
1766
  Deletes a PipelineJob.
1668
1767
 
1768
+ This method is deprecated, please use `PipelineJobHook.delete_pipeline_job` method.
1769
+
1669
1770
  :param project_id: Required. The ID of the Google Cloud project that the service belongs to.
1670
1771
  :param region: Required. The ID of the Google Cloud region that the service belongs to.
1671
1772
  :param pipeline_job: Required. The name of the PipelineJob resource to be deleted.
@@ -1673,6 +1774,10 @@ class CustomJobHook(GoogleBaseHook):
1673
1774
  :param timeout: The timeout for this request.
1674
1775
  :param metadata: Strings which should be sent along with the request as metadata.
1675
1776
  """
1777
+ warnings.warn(
1778
+ "This method is deprecated, please use `PipelineJobHook.delete_pipeline_job` method.",
1779
+ AirflowProviderDeprecationWarning,
1780
+ )
1676
1781
  client = self.get_pipeline_service_client(region)
1677
1782
  name = client.pipeline_job_path(project_id, region, pipeline_job)
1678
1783
 
@@ -1765,6 +1870,8 @@ class CustomJobHook(GoogleBaseHook):
1765
1870
  """
1766
1871
  Gets a PipelineJob.
1767
1872
 
1873
+ This method is deprecated, please use `PipelineJobHook.get_pipeline_job` method.
1874
+
1768
1875
  :param project_id: Required. The ID of the Google Cloud project that the service belongs to.
1769
1876
  :param region: Required. The ID of the Google Cloud region that the service belongs to.
1770
1877
  :param pipeline_job: Required. The name of the PipelineJob resource.
@@ -1772,6 +1879,10 @@ class CustomJobHook(GoogleBaseHook):
1772
1879
  :param timeout: The timeout for this request.
1773
1880
  :param metadata: Strings which should be sent along with the request as metadata.
1774
1881
  """
1882
+ warnings.warn(
1883
+ "This method is deprecated, please use `PipelineJobHook.get_pipeline_job` method.",
1884
+ AirflowProviderDeprecationWarning,
1885
+ )
1775
1886
  client = self.get_pipeline_service_client(region)
1776
1887
  name = client.pipeline_job_path(project_id, region, pipeline_job)
1777
1888
 
@@ -1867,6 +1978,8 @@ class CustomJobHook(GoogleBaseHook):
1867
1978
  """
1868
1979
  Lists PipelineJobs in a Location.
1869
1980
 
1981
+ This method is deprecated, please use `PipelineJobHook.list_pipeline_jobs` method.
1982
+
1870
1983
  :param project_id: Required. The ID of the Google Cloud project that the service belongs to.
1871
1984
  :param region: Required. The ID of the Google Cloud region that the service belongs to.
1872
1985
  :param filter: Optional. Lists the PipelineJobs that match the filter expression. The
@@ -1922,6 +2035,10 @@ class CustomJobHook(GoogleBaseHook):
1922
2035
  :param timeout: The timeout for this request.
1923
2036
  :param metadata: Strings which should be sent along with the request as metadata.
1924
2037
  """
2038
+ warnings.warn(
2039
+ "This method is deprecated, please use `PipelineJobHook.list_pipeline_jobs` method.",
2040
+ AirflowProviderDeprecationWarning,
2041
+ )
1925
2042
  client = self.get_pipeline_service_client(region)
1926
2043
  parent = client.common_location_path(project_id, region)
1927
2044
 
@@ -15,17 +15,7 @@
15
15
  # KIND, either express or implied. See the License for the
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
- """This module contains a Google Cloud Vertex AI hook.
19
-
20
- .. spelling:word-list::
21
-
22
- undeployed
23
- undeploy
24
- Undeploys
25
- aiplatform
26
- FieldMask
27
- unassigns
28
- """
18
+ """This module contains a Google Cloud Vertex AI hook."""
29
19
  from __future__ import annotations
30
20
 
31
21
  from typing import TYPE_CHECKING, Sequence
@@ -15,16 +15,7 @@
15
15
  # KIND, either express or implied. See the License for the
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
- """This module contains a Google Cloud Vertex AI hook.
19
-
20
- .. spelling:word-list::
21
-
22
- irreproducible
23
- codepoints
24
- Tensorboard
25
- aiplatform
26
- myVPC
27
- """
18
+ """This module contains a Google Cloud Vertex AI hook."""
28
19
  from __future__ import annotations
29
20
 
30
21
  from typing import TYPE_CHECKING, Sequence