-
Notifications
You must be signed in to change notification settings - Fork 1.6k
PubSub Publisher #3463
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
Merged
Merged
PubSub Publisher #3463
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
f784121
[WIP] Getting started on Pub/Sub.
c8a9fd6
stuff
9b09b8f
WIP
8f0832e
wip
lukesneeringer 02d7658
WIP
3a3ebe9
Merge branch 'pubsub' of github.com:GoogleCloudPlatform/google-cloud-…
503d11f
WIP, fixing bugs.
3b21b93
WIP
1e879a1
wip
4bf0552
wip
c6dc098
wip
13821a7
wip
c2d7af8
wip
4c0bf84
Merge branch 'public-master' into pubsub
783e9dd
Merge branch 'pubsub' into pubsub-publisher
7dd719f
Clean up a couple small things.
c1042ac
A couple more small fixes.
ccaa865
WIP
f2ee4d4
Rework based on @jonparrott concurrency ideas.
12d5546
Refactor the batching implementation.
e99d959
Remove unrelated files.
4774f2a
wip
lukesneeringer 1a53c37
Honor size and message count limits.
lukesneeringer 9a6b7cb
Update publisher to be thread-based.
b0f03a8
Merge branch 'public-master' into pubsub-publisher
dfe52ef
Merge branch 'pubsub' into pubsub-publisher
f553fd6
Add better Batch docstring.
356749a
Improve the max latency thread comments.
8242c9d
Collapse property docstrings.
db87dab
More @jonparrott feedback.
58072b8
Remove the client as a public item in the base batch.
8f67488
Remove the rejection batch.
a86d9b7
Lock batch acquisition.
df18615
Alter exception superclass.
5f0549b
Inherit from google.api.core.future.Future.
101d9ca
Move to @jonparrott's Future interface.
e6e58bb
Move Future off into its own module.
9fd490c
Add is not None.
469400e
Feedback.
31c0c81
Use concurrent.futures.TimeoutError where possible.
04ac278
Add a lock on commit to ensure no duplication.
37ee908
Move to an Event.
12d44be
Make _names private.
6fe1309
Pubsub subscriber (#3637)
lukesneeringer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
wip
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Copyright 2017, Google Inc. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| class PublishError(RuntimeError): | ||
|
||
| pass | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Copyright 2017, Google Inc. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| def retry(func, delay=0, count=0, err=None, **kwargs): | ||
|
||
| """Attempt to retry a function after the provided delay. | ||
|
|
||
| If there have been too many retries, raise an exception. | ||
|
|
||
| Args: | ||
| func (callable): The function to retry. | ||
| delay (int): The period to delay before retrying; specified in seconds. | ||
| count (int): The number of previous retries that have occurred. | ||
| If this is >= 5, an exception will be raised. | ||
| **kwargs (dict): Other keyword arguments to pass to the function. | ||
| """ | ||
| # If there have been too many retries, simply raise the exception. | ||
| if count >= 5: | ||
| raise err | ||
|
|
||
| # Sleep the given delay. | ||
| time.sleep(delay) | ||
|
|
||
| # Try calling the method again. | ||
| return func(delay=delay, count=count, **kwargs) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.