-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Move redis subscribe to poke() method in Redis Sensor #32984
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
Move redis subscribe to poke() method in Redis Sensor #32984
Conversation
|
revealed after #32978 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, assuming that failing CI is just a bit of flake.
29fbbb5 to
e1bd4d8
Compare
|
Actually the integration test needed to be fixed too @ferruzzi -> the problem was that the way it was constructed, the test actually depended on first subscribing in init(), then publishing and then poke(). I had to update it a bit and make sure that we do not re-subscribe if we already run poke() in the same active sensor task. Now it should be fine. |
|
Sounds good, I'll take another look. |
|
Interesting. It's a shame subscribe() didn't return a value you could have used instead of creating an new field, but oh well. re-approved; CI is green |
In RedisPubSubSensor subscription has been done in constructor, which was pretty wrong - for example it means that when scheduler parses the sensor, it involves subscribing to the messages and commmunication with redis DB. This PR moves subscription to "poke()" method, which is executed on worker instead.
e1bd4d8 to
1f2b72b
Compare
|
Not that my approval means much at this point, but Approved? Again? |
The fix in apache#32984 moved redis hook to be initialized in a cached property but "subscription" call has been moved to the poke - which would cause multiple subscribe calls in regular mode of the sensor (i.e. not poke-reschedule mode). This one fixes it by subscribing only once - when the cached property gets initialized. Fixes: apache#33138
The fix in #32984 moved redis hook to be initialized in a cached property but "subscription" call has been moved to the poke - which would cause multiple subscribe calls in regular mode of the sensor (i.e. not poke-reschedule mode). This one fixes it by subscribing only once - when the cached property gets initialized. Fixes: #33138
In RedisPubSubSensor subscription has been done in constructor, which was pretty wrong - for example it means that when scheduler parses the sensor, it involves subscribing to the messages and commmunication with redis DB.
This PR moves subscription to "poke()" method, which is executed on worker instead.
^ 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.