-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add return_immediately parameter to PubSubPullSensor class #41842
Add return_immediately parameter to PubSubPullSensor class #41842
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 (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
My PR only removed the deprecated code. it was deprecated 4 years ago in #7766 The original PR claims
You didn't explain why it's not valid any more. Specifically about underlying PubSub API implementation detail and why |
The removed code in PR #23231 claims that return_immediately "has no effect on PubSubPullSensor behaviour" and "It should be left as default value of True." I claim this is not true based on empirical evidence (sometimes the sensor didn't pull messages even if there are unacked messages available) and based on the comment in the pull function of SubscriberClient (from google.cloud.pubsub_v1 import SubscriberClient), which is called by PubSubHook.pull in the poke function of the sensor:
The PubSubPullOperator doesn't cover my use case because I don't want to continue with the DAG run if there are no messages available. I want to wait until there's a new message available and use the contents of the message in the DAG run. |
Lets wait for review of someone from the Google team cc @VladaZakharova |
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
…che#41842) Co-authored-by: Arnau Badia Sampera <[email protected]>
Closes: #41838
Add optional
return_immediately
parameter to PubSubPullSensor (default:True
for backwards compatibility). This allows settingreturn_immediately=False
to resolve issue #41838 and improve performance. The parameter was originally removed from the class but hard-coded to True in the PubSubHook.pull call in the poke function in PR #23231.Note: SubscriberClient.pull (called by PubSubHook.pull) warns that setting return_immediately=True is discouraged due to performance impact.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.