-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Using Iterators for list_topics() in Pub/Sub. #2602
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
Conversation
core/google/cloud/_testing.py
Outdated
| raise StopIteration | ||
| else: | ||
| items = self._items | ||
| self._items = None |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| :class:`Iterator` that started the page. By default uses | ||
| the HTTP pages iterator. Meant to provide a custom | ||
| way to create pages (potentially with a custom | ||
| transport such as gRPC). |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| # iterator instance returned. | ||
| return Iterator(client=None, path=path, | ||
| item_to_value=_item_to_topic, | ||
| page_iter=page_iter) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| def list_topics(self, project, page_size=None, page_token=None): | ||
| @staticmethod | ||
| def list_topics(project, page_size=None, page_token=None): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| def test_list_topics(self): | ||
| before, _ = Config.CLIENT.list_topics() | ||
| before = list(Config.CLIENT.list_topics()) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Can we disable the Circle CI bit until we fix its config? Issues with it:
|
In the process, had to add custom support for the GAX page iterator in our core Iterator implementation.
f757733 to
83beb2c
Compare
Also tweaking an exhausted _GAXPageIterator in google.cloud._testing.
|
LGTM with the |
|
@tseaver So I am good to merge? I am currently in the process of breaking As for the Travis failure, that is due to a merge of |
tseaver
left a comment
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.
@dhermes Yes, the "LGTM" was sincere.
|
@tseaver Haha thanks. (I wasn't sure if you were LGTM-ing the PR or just the single commit, pending work to be done.) I'll make sure to get the refactor out soon. |
Using Iterators for list_topics() in Pub/Sub.
Using Iterators for list_topics() in Pub/Sub.
In the process, had to add custom support for the GAX page iterator in our core Iterator implementation.
@tseaver @jonparrott I am sending this out as-is hoping for some feedback (
list_subscriptionsandtopic_list_subscriptionsalso need to be done). I don't feel that great about the way I did custom paging inIterator, maybe it's worth defining a GAX subclass ofIterator?Also, in order to avoid too many radical changes to the code, I punted on getting a
clientinto theIteratorreturned by the_gax/connectionimplementations. As can be seen by the unit tests, this effectively makes them useless (more-so in the HTTP case than in the GAX case). I'd be happy to send a follow-up PR to makeclientaccessible in the_PublisherAPIimplementation, but again, wanted to make this commit digestible.NOTE: Has #2594 as diffbase.