Skip to content

Commit f56acda

Browse files
fdemianeTaragolis
andauthored
Deprecate Life Sciences Operator and Hook (#34549)
* Deprecate Life Sciences Operator and Hook * Update airflow/providers/google/cloud/hooks/life_sciences.py Co-authored-by: Andrey Anshin <Andrey.Anshin@taragol.is> * Update airflow/providers/google/cloud/operators/life_sciences.py Co-authored-by: Andrey Anshin <Andrey.Anshin@taragol.is> --------- Co-authored-by: Andrey Anshin <Andrey.Anshin@taragol.is>
1 parent 5b0ce3d commit f56acda

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

β€Žairflow/providers/google/cloud/hooks/life_sciences.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
from __future__ import annotations
2020

2121
import time
22+
import warnings
2223
from typing import Sequence
2324

2425
import google.api_core.path_template
2526
from googleapiclient.discovery import build
2627

27-
from airflow.exceptions import AirflowException
28+
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
2829
from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
2930

3031
# Time to sleep between active checks of the operation results
@@ -35,6 +36,11 @@ class LifeSciencesHook(GoogleBaseHook):
3536
"""
3637
Hook for the Google Cloud Life Sciences APIs.
3738
39+
.. warning::
40+
This hook is deprecated. Consider using Google Cloud Batch Operators' hook instead.
41+
The Life Sciences API (beta) will be discontinued on July 8, 2025 in favor
42+
of Google Cloud Batch.
43+
3844
All the methods in the hook where project_id is used must be called with
3945
keyword arguments rather than positional.
4046
@@ -70,6 +76,14 @@ def __init__(
7076
)
7177
self.api_version = api_version
7278

79+
warnings.warn(
80+
"""This hook is deprecated. Consider using Google Cloud Batch Operators' hook instead.
81+
The Life Sciences API (beta) will be discontinued on July 8, 2025 in favor
82+
of Google Cloud Batch.""",
83+
AirflowProviderDeprecationWarning,
84+
stacklevel=3,
85+
)
86+
7387
def get_conn(self) -> build:
7488
"""
7589
Retrieves the connection to Cloud Life Sciences.

β€Žairflow/providers/google/cloud/operators/life_sciences.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
"""Operators that interact with Google Cloud Life Sciences service."""
1919
from __future__ import annotations
2020

21+
import warnings
2122
from typing import TYPE_CHECKING, Sequence
2223

23-
from airflow.exceptions import AirflowException
24+
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
2425
from airflow.providers.google.cloud.hooks.life_sciences import LifeSciencesHook
2526
from airflow.providers.google.cloud.links.life_sciences import LifeSciencesLink
2627
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
@@ -33,6 +34,11 @@ class LifeSciencesRunPipelineOperator(GoogleCloudBaseOperator):
3334
"""
3435
Runs a Life Sciences Pipeline.
3536
37+
.. warning::
38+
This operator is deprecated. Consider using Google Cloud Batch Operators instead.
39+
The Life Sciences API (beta) will be discontinued on July 8, 2025 in favor
40+
of Google Cloud Batch.
41+
3642
.. seealso::
3743
For more information on how to use this operator, take a look at the guide:
3844
:ref:`howto/operator:LifeSciencesRunPipelineOperator`
@@ -81,6 +87,14 @@ def __init__(
8187
self._validate_inputs()
8288
self.impersonation_chain = impersonation_chain
8389

90+
warnings.warn(
91+
"""This operator is deprecated. Consider using Google Cloud Batch Operators instead.
92+
The Life Sciences API (beta) will be discontinued on July 8, 2025 in favor
93+
of Google Cloud Batch.""",
94+
AirflowProviderDeprecationWarning,
95+
stacklevel=3,
96+
)
97+
8498
def _validate_inputs(self) -> None:
8599
if not self.body:
86100
raise AirflowException("The required parameter 'body' is missing")

0 commit comments

Comments
 (0)