Make return_immediately configurable for all Pub/Sub modules and mark the setting as deprecated - #67621
Make return_immediately configurable for all Pub/Sub modules and mark the setting as deprecated#67621michaelpri10 wants to merge 10 commits into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
…se for Pub/Sub modules
|
@michaelpri10 A few things need addressing before review — see our Pull Request quality criteria.
No rush. Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you. |
|
Hello @shahar1! Gentle ping on the review for this PR, thank you! |
This change does contain updated provider unit tests to test the relevant changes, which I believe should satisfy the testing criteria. |
shahar1
left a comment
There was a problem hiding this comment.
Thanks for your contribution and apologies for the delay in response!
CC: @VladaZakharova @MaksYermak - I'll appreciate your opinion here, thanks!
@shahar1 thank you for letting us know! I agree with you that for this code the default value should change back to About deprecation. |
|
@michaelpri10 — this PR has 1 unresolved review thread(s) that still look like they need your attention. Once you've addressed them (push changes and/or reply in-thread), please resolve the threads or reply to confirm, and give the reviewer a nudge for another look. Thanks! See the PR quality criteria. Automated first-pass triage note drafted by an AI-assisted tool — may get things wrong; once addressed, a real Apache Airflow maintainer takes the next look. (why automated) Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting |
…ion warnings for the setting to Pub/Sub modules
|
I've updated the PR to change back to setting With regards to the initial attempt to remove the
Thus, I think it would be beneficial to eventually switch the default to |
|
@michaelpri10 please review current CI failures |
…mmediately parameter and add better test coverage for the return_immediately parameter
@shahar1 I've updated the tests to fix the current CI failures. |
|
LGTM |
… explicitly specified for Pub/Sub modules
|
@shahar1 Had to make a few more changes to fix some tests, but all checks are passing now! |
…ue of return_immediately to False and undo all changes to PubSubHook as it already defaults return_immediately to False
Thank you @shahar1! I've addressed the comments. |
| warnings.warn( | ||
| "The default value of `return_immediately` will be changed to `False` in a future major release.", | ||
| AirflowProviderDeprecationWarning, | ||
| stacklevel=2, | ||
| ) |
There was a problem hiding this comment.
@michaelpri10 in google provider we have deprecation policy and by this policy you need to specify planned_removal_date and by default all deprecations should allow a 6 months time period until they will be removed and not available. Could you please add the removal date to this warning message?
There was a problem hiding this comment.
@michaelpri10 did you run the system tests for these changes with return_immediately=False?
I am not sure that we should make this parameter configurable for PubSubPullOperator as I understand the idea of this operator was return any value immediately include 0 if user does not have any messages. I think it was a reason why we have hardcoded return_immediately=True here. Otherwise with return_immediately=False it blocks whole task until message will not appear in my opinion this behavior contradicts with operator logic. If users need blocking waiting for this reason we have PubSubPullSensor.
It is the message from docstring to this operator:
Pulls messages from a PubSub subscription and passes them through XCom.
If the queue is empty, returns empty list - never waits for messages.
If you do need to wait, please use :class:`airflow.providers.google.cloud.sensors.PubSubPullSensor`
instead.
|
@michaelpri10 I've been AFK for quite a while, now I'm back. |
|
This pull request has been automatically marked as stale because the author has not responded to a request for more information. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
|
Replaced by #73504 |

Make
return_immediatelydefault to False and be configurable for all Pub/Sub modules. This field is deprecated and Cloud Pub/Sub documentation warns that this can lead to pull requests returning with 0 messages even when there is a backlog. By default, thereturn_immediatelyoption should be set to false.Was generative AI tooling used to co-author this PR?
Generated-by: Google Antigravity following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.Important
🛠️ Maintainer triage note for @michaelpri10 · by
@potiuk· 2026-07-02 17:46 UTCSome review feedback from
@shahar1is waiting on you:@shahar1need a reply or a fix.The ball is in your court — you've been assigned to this PR. Reply or push a fix in each thread, then mark them resolved.
Automated triage — may be imperfect; a maintainer takes the next look.