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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add support for increasing partitions in python #74
Conversation
ca3b545
to
dcdfb85
Compare
dcdfb85
to
fdddd97
Compare
google/cloud/pubsublite/internal/wire/partition_count_watching_publisher.py
Outdated
Show resolved
Hide resolved
google/cloud/pubsublite/internal/wire/partition_count_watching_publisher.py
Outdated
Show resolved
Hide resolved
google/cloud/pubsublite/internal/wire/partition_count_watching_publisher.py
Outdated
Show resolved
Hide resolved
def set_box(): | ||
box.val = PartitionCountWatcherImpl(mock_admin, topic, 0.001) | ||
|
||
# Initialize publisher on another thread with a different event loop. |
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.
Any asyncio class cannot be accessed from a different event loop, or it is incorrect.
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.
Okay, before I didn't understand this was necessarily constructed in the same event loop as the publisher.
I still kind of think the property that everything works even if you call aenter from a different thread than you constructed the watcher is nice. I'm happy to remove it though if you think that would be better
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.
Can you add a utility to the testing helpers that does exactly this? I think this is a good idea, and we should do this more places. I.e. a "runOnThread" function that takes a Callable[[], T] and returns a T
4528a93
to
43ea68d
Compare
43ea68d
to
1e8e5a5
Compare
Partition(index): self._publisher_factory(Partition(index)) | ||
for index in range(current_count, partition_count) | ||
} | ||
await asyncio.gather(*[p.__aenter__() for p in new_publishers.values()]) |
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.
run nox
from the root directory before merging this.
.gitignore
Outdated
@@ -19,6 +19,7 @@ develop-eggs | |||
.installed.cfg | |||
lib | |||
lib64 | |||
venv |
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.
put this down with 'env/' and add the slash.
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.
done
ed857e5
to
9ef995d
Compare
9ef995d
to
4440ad3
Compare
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 馃