-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Bigtable: Add 'PartialRowsData.cancel'. #8176
Conversation
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.
This change needs a unit test, and ideally a system test.
@mf2199, I had some comments that need to be addressed regarding this PR. |
Appending unit-test to assert stop iteration of PartialRowsData() upon calling the cancel() method.
The |
@@ -376,6 +376,9 @@ def __init__(self, read_method, request, retry=DEFAULT_RETRY_READ_ROWS): | |||
self.rows = {} | |||
self._state = self.STATE_NEW_ROW | |||
|
|||
# Flag to stop iteration, for any reason not related to self.retry() | |||
self._stop = False |
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.
Looking over the code, it seems this is marking if the iterator has been cancelled. The comment and name of this sort of directed me to think maybe this did something different. would naming this self._cancelled
be accurate?
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.
+1 for _cancelled
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.
Makes sense. Done.
|
Fixes #7760.
Introducing a "stop" flag into the iterable PartialRowsData() class. Setting this flag to True results in cancelling of the iteration the next time the iterator is called.