Title: Make publish futures compatible with `concurrent.futures.as_completed()` · Issue #368 · googleapis/python-pubsub · GitHub
Open Graph Title: Make publish futures compatible with `concurrent.futures.as_completed()` · Issue #368 · googleapis/python-pubsub
X Title: Make publish futures compatible with `concurrent.futures.as_completed()` · Issue #368 · googleapis/python-pubsub
Description: Environment details OS type and version: Linux Python version: Python 3.7.7 pip version: pip 21.0.1 google-cloud-pubsub version: Version: 2.3.0 Summary: Google Cloud Pub/Sub API client library Home-page: https://github.com/googleapis/pyt...
Open Graph Description: Environment details OS type and version: Linux Python version: Python 3.7.7 pip version: pip 21.0.1 google-cloud-pubsub version: Version: 2.3.0 Summary: Google Cloud Pub/Sub API client library Home...
X Description: Environment details OS type and version: Linux Python version: Python 3.7.7 pip version: pip 21.0.1 google-cloud-pubsub version: Version: 2.3.0 Summary: Google Cloud Pub/Sub API client library Home...
Opengraph URL: https://github.com/googleapis/python-pubsub/issues/368
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Make publish futures compatible with `concurrent.futures.as_completed()`","articleBody":"#### Environment details\r\n\r\n - OS type and version: Linux\r\n - Python version: `Python 3.7.7`\r\n - pip version: `pip 21.0.1`\r\n - `google-cloud-pubsub` version: \r\n```Name: google-cloud-pubsub\r\nVersion: 2.3.0\r\nSummary: Google Cloud Pub/Sub API client library\r\nHome-page: https://github.com/googleapis/python-pubsub\r\nAuthor: Google LLC\r\nAuthor-email: googleapis-packages@google.com\r\nLicense: Apache 2.0\r\nLocation: /Users/mike/.pyenv/versions/3.8.6/envs/detection-processor/lib/python3.8/site-packages\r\nRequires: grpc-google-iam-v1, proto-plus, google-api-core, libcst\r\nRequired-by: \r\n```\r\n\r\n#### Steps to reproduce\r\n\r\n 1. Create multiple publish futures with `publisher.publish()`\r\n 2. Use `in concurrent.futures.as_completed()` as a generator to trigger on completion.\r\n\r\n#### Code example\r\n\r\n```python\r\nfuture_list = []\r\n\r\nfor msg in messages:\r\n future_list.append(publisher.publish(topic_path, msg))\r\n\r\nfor _ in concurrent.futures.as_completed(\r\n fs=future_list,\r\n):\r\n # Do something\r\n continue\r\n```\r\n\r\n#### Stack trace\r\n```\r\n'Future' object has no attribute '_condition'\r\n```\r\n\r\nI understand that the publish future is not REALLY a concurrent future object. This attribute error does not happen with all messages, it's a minority of messages. I'm not sure what causes some publish futures to work with `as_completed` and some do not.\r\n","author":{"url":"https://github.com/mbrancato","@type":"Person","name":"mbrancato"},"datePublished":"2021-04-06T13:40:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/368/python-pubsub/issues/368"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4e255e8a-d747-8c89-fe83-9d90c147f154 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8AB4:25F3E7:2A94D1B:3A17EF9:6A544F5D |
| html-safe-nonce | fac4fc4e4dacec88c708d680ca8b084750ccb5d8728348e9dcaf83d098a57451 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QUI0OjI1RjNFNzoyQTk0RDFCOjNBMTdFRjk6NkE1NDRGNUQiLCJ2aXNpdG9yX2lkIjoiMzY2MzQ4ODE1MTg1NzY4MDIyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 49d1abf6fc8c3678614c517857e6cd65075d59f12d774b7bad0a3397097da5bb |
| hovercard-subject-tag | issue:851436638 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/python-pubsub/368/issue_layout |
| twitter:image | https://opengraph.githubassets.com/25aae30ec4bf9a661fe519e1260a15bec0fb1f9698331a875a5639ab33cc7fc4/googleapis/python-pubsub/issues/368 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/25aae30ec4bf9a661fe519e1260a15bec0fb1f9698331a875a5639ab33cc7fc4/googleapis/python-pubsub/issues/368 |
| og:image:alt | Environment details OS type and version: Linux Python version: Python 3.7.7 pip version: pip 21.0.1 google-cloud-pubsub version: Version: 2.3.0 Summary: Google Cloud Pub/Sub API client library Home... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mbrancato |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/python-pubsub git https://github.com/googleapis/python-pubsub.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 226992581 |
| octolytics-dimension-repository_nwo | googleapis/python-pubsub |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 226992581 |
| octolytics-dimension-repository_network_root_nwo | googleapis/python-pubsub |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width