shahar1 commented on code in PR #67621:
URL: https://github.com/apache/airflow/pull/67621#discussion_r3640245297
##########
providers/google/src/airflow/providers/google/cloud/hooks/pubsub.py:
##########
@@ -712,6 +721,15 @@ async def pull(
the base64-encoded message content. See
https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#google.pubsub.v1.ReceivedMessage
"""
+ if return_immediately is not None:
+ warnings.warn(
+ "The `return_immediately` parameter is deprecated and will be
removed in a future release.",
+ AirflowProviderDeprecationWarning,
+ stacklevel=2,
+ )
Review Comment:
When the parameter is forwarded down from an operator, it will be passed a
boolean (after it had been transformed there) - which will always trigger this
warning, regardles if being set or not in the operator's level.
##########
providers/google/src/airflow/providers/google/cloud/operators/pubsub.py:
##########
@@ -831,6 +841,17 @@ def __init__(
self.impersonation_chain = impersonation_chain
self.deferrable = deferrable
self.poll_interval = poll_interval
+ if return_immediately is not None:
+ warnings.warn(
+ "The `return_immediately` parameter is deprecated and will be
removed in a future release. "
+ "Its default value will be changed to `False` in the next
major release. "
+ "Planned removal date: August 01, 2026.",
Review Comment:
1. Please don't mix up two deprecations in one warning, this is very
confusing for the end-users. Let's focus the current deprecation only on
changing the behavior, and only when Google publishes an official date for
removing the parameter - then we could deprecate it towards removal.
2. Speaking of an official date - I didn't find any mention in Google API
for Aug. 01 as the removal date, so I wouldn't mention it here at all as well.
##########
providers/google/tests/unit/google/cloud/hooks/test_pubsub.py:
##########
@@ -28,10 +28,13 @@
from google.cloud.pubsub_v1.types import PublisherOptions, ReceivedMessage
from googleapiclient.errors import HttpError
+from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.providers.google.cloud.hooks.pubsub import PubSubAsyncHook,
PubSubException, PubSubHook
from airflow.providers.google.common.consts import CLIENT_INFO
from airflow.version import version
+pytestmark =
pytest.mark.filterwarnings("ignore::airflow.exceptions.AirflowProviderDeprecationWarning")
+
Review Comment:
This warning is directly related to the comment on the hook :)
You wouldn't need it if the hook won't raise the warning for every case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]