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
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
@@ -378,13 +379,19 @@ def cancel_pipeline_job(
378
379
[google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to ``Code.CANCELLED``, and
379
380
[PipelineJob.state][google.cloud.aiplatform.v1.PipelineJob.state] is set to ``CANCELLED``.
380
381
382
+ This method is deprecated, please use `PipelineJobHook.cancel_pipeline_job` method.
383
+
381
384
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
382
385
:param region: Required. The ID of the Google Cloud region that the service belongs to.
383
386
:param pipeline_job: The name of the PipelineJob to cancel.
384
387
:param retry: Designation of what errors, if any, should be retried.
385
388
:param timeout: The timeout for this request.
386
389
:param metadata: Strings which should be sent along with the request as metadata.
387
390
"""
391
+ warnings .warn (
392
+ "This method is deprecated, please use `PipelineJobHook.cancel_pipeline_job` method." ,
393
+ AirflowProviderDeprecationWarning ,
394
+ )
388
395
client = self .get_pipeline_service_client (region )
389
396
name = client .pipeline_job_path (project_id , region , pipeline_job )
390
397
@@ -493,6 +500,8 @@ def create_pipeline_job(
493
500
"""
494
501
Creates a PipelineJob. A PipelineJob will run immediately when created.
495
502
503
+ This method is deprecated, please use `PipelineJobHook.create_pipeline_job` method.
504
+
496
505
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
497
506
:param region: Required. The ID of the Google Cloud region that the service belongs to.
498
507
:param pipeline_job: Required. The PipelineJob to create.
@@ -504,6 +513,10 @@ def create_pipeline_job(
504
513
:param timeout: The timeout for this request.
505
514
:param metadata: Strings which should be sent along with the request as metadata.
506
515
"""
516
+ warnings .warn (
517
+ "This method is deprecated, please use `PipelineJobHook.create_pipeline_job` method." ,
518
+ AirflowProviderDeprecationWarning ,
519
+ )
507
520
client = self .get_pipeline_service_client (region )
508
521
parent = client .common_location_path (project_id , region )
509
522
@@ -1752,13 +1765,19 @@ def delete_pipeline_job(
1752
1765
"""
1753
1766
Deletes a PipelineJob.
1754
1767
1768
+ This method is deprecated, please use `PipelineJobHook.delete_pipeline_job` method.
1769
+
1755
1770
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
1756
1771
:param region: Required. The ID of the Google Cloud region that the service belongs to.
1757
1772
:param pipeline_job: Required. The name of the PipelineJob resource to be deleted.
1758
1773
:param retry: Designation of what errors, if any, should be retried.
1759
1774
:param timeout: The timeout for this request.
1760
1775
:param metadata: Strings which should be sent along with the request as metadata.
1761
1776
"""
1777
+ warnings .warn (
1778
+ "This method is deprecated, please use `PipelineJobHook.delete_pipeline_job` method." ,
1779
+ AirflowProviderDeprecationWarning ,
1780
+ )
1762
1781
client = self .get_pipeline_service_client (region )
1763
1782
name = client .pipeline_job_path (project_id , region , pipeline_job )
1764
1783
@@ -1851,13 +1870,19 @@ def get_pipeline_job(
1851
1870
"""
1852
1871
Gets a PipelineJob.
1853
1872
1873
+ This method is deprecated, please use `PipelineJobHook.get_pipeline_job` method.
1874
+
1854
1875
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
1855
1876
:param region: Required. The ID of the Google Cloud region that the service belongs to.
1856
1877
:param pipeline_job: Required. The name of the PipelineJob resource.
1857
1878
:param retry: Designation of what errors, if any, should be retried.
1858
1879
:param timeout: The timeout for this request.
1859
1880
:param metadata: Strings which should be sent along with the request as metadata.
1860
1881
"""
1882
+ warnings .warn (
1883
+ "This method is deprecated, please use `PipelineJobHook.get_pipeline_job` method." ,
1884
+ AirflowProviderDeprecationWarning ,
1885
+ )
1861
1886
client = self .get_pipeline_service_client (region )
1862
1887
name = client .pipeline_job_path (project_id , region , pipeline_job )
1863
1888
@@ -1953,6 +1978,8 @@ def list_pipeline_jobs(
1953
1978
"""
1954
1979
Lists PipelineJobs in a Location.
1955
1980
1981
+ This method is deprecated, please use `PipelineJobHook.list_pipeline_jobs` method.
1982
+
1956
1983
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
1957
1984
:param region: Required. The ID of the Google Cloud region that the service belongs to.
1958
1985
:param filter: Optional. Lists the PipelineJobs that match the filter expression. The
@@ -2008,6 +2035,10 @@ def list_pipeline_jobs(
2008
2035
:param timeout: The timeout for this request.
2009
2036
:param metadata: Strings which should be sent along with the request as metadata.
2010
2037
"""
2038
+ warnings .warn (
2039
+ "This method is deprecated, please use `PipelineJobHook.list_pipeline_jobs` method." ,
2040
+ AirflowProviderDeprecationWarning ,
2041
+ )
2011
2042
client = self .get_pipeline_service_client (region )
2012
2043
parent = client .common_location_path (project_id , region )
2013
2044
0 commit comments