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 <arnau.badia.sampera@unacast.com>
Closes: #41838
Add optional
return_immediatelyparameter to PubSubPullSensor (default:Truefor backwards compatibility). This allows settingreturn_immediately=Falseto 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.rstor{issue_number}.significant.rst, in newsfragments.