Skip to content

Commit

Permalink
docs(google): add deprecation warning to docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-W committed Jan 22, 2024
1 parent add7c91 commit 8c25d9c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
8 changes: 6 additions & 2 deletions astronomer/providers/google/cloud/hooks/gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@


class GCSHookAsync(GoogleBaseHookAsync):
"""GCSHookAsync run on the trigger worker, inherits from GoogleBaseHookAsync"""
"""GCSHookAsync run on the trigger worker, inherits from GoogleBaseHookAsync
This class is deprecated and will be removed in 2.0.0.
Use :class: `~airflow.providers.google.cloud.hooks.gcs.GCSAsyncHook` instead
"""

def __init__(self, **kwargs: Any):
warnings.warn(
(
"This class is deprecated and will be removed in 2.0.0."
"Use :class: `~airflow.providers.google.cloud.hooks.gcs.GCSAsyncHook` instead"
"Use `airflow.providers.google.cloud.hooks.gcs.GCSAsyncHook` instead"
),
DeprecationWarning,
stacklevel=2,
Expand Down
1 change: 1 addition & 0 deletions astronomer/providers/google/cloud/sensors/gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def __init__(
)
super().__init__(*args, deferrable=True, **kwargs)


class GCSUploadSessionCompleteSensorAsync(GCSUploadSessionCompleteSensor):
"""
This class is deprecated.
Expand Down
20 changes: 16 additions & 4 deletions astronomer/providers/google/cloud/triggers/gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class GCSBlobTrigger(BaseTrigger):
"""
A trigger that fires and it finds the requested file or folder present in the given bucket.
This class is deprecated and will be removed in 2.0.0.
Use :class: `~airflow.providers.google.cloud.triggers.gcs.GCSBlobTrigger` instead
:param bucket: the bucket in the google cloud storage where the objects are residing.
:param object_name: the file or folder present in the bucket
:param google_cloud_conn_id: reference to the Google Connection
Expand All @@ -34,7 +37,7 @@ def __init__(
warnings.warn(
(
"This class is deprecated and will be removed in 2.0.0."
"Use :class: `~airflow.providers.google.cloud.triggers.gcs.GCSBlobTrigger` instead"
"Use `airflow.providers.google.cloud.triggers.gcs.GCSBlobTrigger` instead"
),
DeprecationWarning,
stacklevel=2,
Expand Down Expand Up @@ -102,6 +105,9 @@ class GCSPrefixBlobTrigger(GCSBlobTrigger):
A trigger that fires and it looks for all the objects in the given bucket
which matches the given prefix if not found sleep for certain interval and checks again.
This class is deprecated and will be removed in 2.0.0.
Use :class: `~airflow.providers.google.cloud.triggers.gcs.GCSPrefixBlobTrigger` instead
:param bucket: the bucket in the google cloud storage where the objects are residing.
:param prefix: The prefix of the blob_names to match in the Google cloud storage bucket
:param google_cloud_conn_id: reference to the Google Connection
Expand All @@ -119,7 +125,7 @@ def __init__(
warnings.warn(
(
"This class is deprecated and will be removed in 2.0.0."
"Use :class: `~airflow.providers.google.cloud.triggers.gcs.GCSPrefixBlobTrigger` instead"
"Use `airflow.providers.google.cloud.triggers.gcs.GCSPrefixBlobTrigger` instead"
),
DeprecationWarning,
stacklevel=2,
Expand Down Expand Up @@ -185,6 +191,9 @@ class GCSUploadSessionTrigger(GCSPrefixBlobTrigger):
bucket and returns Trigger Event if the inactivity period has passed with no
increase in the number of objects.
This class is deprecated and will be removed in 2.0.0.
Use :class: `~airflow.providers.google.cloud.triggers.gcs.GCSUploadSessionTrigger` instead
:param bucket: The Google Cloud Storage bucket where the objects are.
expected.
:param prefix: The name of the prefix to check in the Google cloud
Expand Down Expand Up @@ -219,7 +228,7 @@ def __init__(
warnings.warn(
(
"This class is deprecated and will be removed in 2.0.0."
"Use :class: `~airflow.providers.google.cloud.triggers.gcs.GCSUploadSessionTrigger` instead"
"Use `airflow.providers.google.cloud.triggers.gcs.GCSUploadSessionTrigger` instead"
),
DeprecationWarning,
stacklevel=2,
Expand Down Expand Up @@ -351,6 +360,9 @@ class GCSCheckBlobUpdateTimeTrigger(BaseTrigger):
"""
A trigger that makes an async call to GCS to check whether the object is updated in a bucket.
This class is deprecated and will be removed in 2.0.0.
Use :class: `~airflow.providers.google.cloud.triggers.gcs.GCSCheckBlobUpdateTimeTrigger` instead
:param bucket: google cloud storage bucket name cloud storage where the objects are residing.
:param object_name: the file or folder present in the bucket
:param ts: datetime object
Expand All @@ -371,7 +383,7 @@ def __init__(
warnings.warn(
(
"This class is deprecated and will be removed in 2.0.0."
"Use :class: `~airflow.providers.google.cloud.triggers.gcs.GCSUploadSessionTrigger` instead"
"Use :class: `~airflow.providers.google.cloud.triggers.gcs.GCSCheckBlobUpdateTimeTrigger` instead"
),
DeprecationWarning,
stacklevel=2,
Expand Down
2 changes: 1 addition & 1 deletion tests/google/cloud/sensors/test_gcs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from airflow.providers.google.cloud.sensors.gcs import (
GCSObjectExistenceSensor,
GCSObjectsWithPrefixExistenceSensor,
Expand Down Expand Up @@ -47,6 +46,7 @@ def test_init(self):
assert isinstance(task, GCSObjectsWithPrefixExistenceSensor)
assert task.deferrable is True


class TestGCSUploadSessionCompleteSensorAsync:
def test_init(self):
task = GCSUploadSessionCompleteSensorAsync(
Expand Down

0 comments on commit 8c25d9c

Please sign in to comment.