Skip to content
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

samples: add samples from pubsub/cloud-client #134

Merged
merged 103 commits into from
Jun 26, 2020

Conversation

plamut
Copy link
Contributor

@plamut plamut commented Jun 25, 2020

Jon Wayne Parrott and others added 30 commits August 24, 2016 14:51
Change-Id: I38b90c10aef72c37188c4520897302933b9d2ea7
Change-Id: Ie95e2e1556a8d97b5321dc86bf8de431aa36a2d5
Change-Id: I12c407d3cdf4a3f9736dfaeca6f20b31df6d310a
Change-Id: Ifebdab0b974cc3d3fe8900a23ca7416fed9e026a
Change-Id: I7dfe60b0f1240dc58a664968fd97ca5a8fa1109d
…hon-docs-samples#1004)

* Auto-update dependencies.

* Fix natural language samples

* Fix pubsub iam samples

* Fix language samples

* Fix bigquery samples
…hon-docs-samples#1055)

* Auto-update dependencies.

* Explicitly use latest bigtable client

Change-Id: Id71e9e768f020730e4ca9514a0d7ebaa794e7d9e

* Revert language update for now

Change-Id: I8867f154e9a5aae00d0047c9caf880e5e8f50c53

* Remove pdb. smh

Change-Id: I5ff905fadc026eebbcd45512d4e76e003e3b2b43
Change-Id: I776863091846ee8ff8a70078c8b8d5498cf81ed6
Change-Id: I149fc1242ceb6b2cff8eae7ef18b364dd5c26566
…orm/python-docs-samples#1158)

* Update Readme.rst to add Python setup guide

As requested in b/64770713.

This sample is linked in documentation https://cloud.google.com/bigtable/docs/scaling, and it would make more sense to update the guide here than in the documentation.

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update install_deps.tmpl.rst

* Updated readmegen scripts and re-generated related README files

* Fixed the lint error
Change-Id: I0d420f3053f391fa225e4b8179e45fd1138f5c65
@busunkim96
Copy link
Contributor

Just opened a PR internally to add the additional Kokoro checks for samples.

@busunkim96 busunkim96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 25, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 25, 2020
@anguillanneuf
Copy link
Contributor

anguillanneuf commented Jun 25, 2020

@plamut Let's coordinate on the merge because we don't want Cloud docs to link to non-existing samples. I have prepared an internal CL (cl/318355428) for docs so we can merge/submit at roughly the same time. Thanks!


Tests are failing due to a missing noxfile.py.

@anguillanneuf anguillanneuf self-requested a review June 25, 2020 22:06
@anguillanneuf anguillanneuf changed the title docs: add samples from pubsub/cloud-client samples: add samples from pubsub/cloud-client Jun 25, 2020
@plamut
Copy link
Contributor Author

plamut commented Jun 26, 2020

@anguillanneuf Generated/updated the templates, including the noxfile.py for the snippets. The PR is ready for another round of reviews now (cc: @busunkim96).

Re: internal PR - I think it should be fine (can't see its contents), as the samples have been copied from the samples repo. When this is approved an merged, we can just "redirect" the docs to point at the new location.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Jun 26, 2020
Copy link
Contributor

@anguillanneuf anguillanneuf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!
Sometimes we ask people to clone python-docs-samples and cd into pubsub. Those instructions need to be updated accordingly too :)

@anguillanneuf anguillanneuf added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Jun 26, 2020
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@anguillanneuf anguillanneuf merged commit e204b86 into googleapis:master Jun 26, 2020
@plamut plamut deleted the add-snippets-samples branch June 26, 2020 21:04
@plamut
Copy link
Contributor Author

plamut commented Jun 30, 2020

@busunkim96 @anguillanneuf Uh-oh, it appears that the sample history was squash-merged instead of using rebase and merge as specified by the migration doc.

How important is the history in this case? Do we need to purge this PR and merge it again with history preserved?

@anguillanneuf
Copy link
Contributor

anguillanneuf commented Jun 30, 2020

Is it still possible to rebase? If so, please do! Thanks @plamut. And if not, we can live with this mistake.

Copy link

@sgerrand sgerrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like some URLs weren't updated during this migration. I've noted the key ones which are broken.

Comment on lines +16 to +17
- name: Quickstart
file: quickstart.py
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth noting that this file doesn't exist.

===============================================================================

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=pubsub/cloud-client/README.rst
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


.. code-block:: bash

$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-        $ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
+        $ git clone https://github.com/googleapis/python-pubsub.git

sethmaxwl pushed a commit to sethmaxwl/python-pubsub that referenced this pull request Jul 9, 2020
* Add pubsub publisher and subscriber samples

Change-Id: I38b90c10aef72c37188c4520897302933b9d2ea7

* Update readme

Change-Id: Ie95e2e1556a8d97b5321dc86bf8de431aa36a2d5

* Add pubsub iam samples

Change-Id: I12c407d3cdf4a3f9736dfaeca6f20b31df6d310a

* Fix lint issue

Change-Id: Ifebdab0b974cc3d3fe8900a23ca7416fed9e026a

* Auto-update dependencies. [(googleapis#540)](GoogleCloudPlatform/python-docs-samples#540)

* Auto-update dependencies. [(googleapis#542)](GoogleCloudPlatform/python-docs-samples#542)

* Move to google-cloud [(googleapis#544)](GoogleCloudPlatform/python-docs-samples#544)

* Add new "quickstart" samples [(googleapis#547)](GoogleCloudPlatform/python-docs-samples#547)

* Quickstart tests [(googleapis#569)](GoogleCloudPlatform/python-docs-samples#569)

* Add tests for quickstarts
* Update secrets

* Generate readmes for most service samples [(googleapis#599)](GoogleCloudPlatform/python-docs-samples#599)

* Update samples to support latest Google Cloud Python [(googleapis#656)](GoogleCloudPlatform/python-docs-samples#656)

* Auto-update dependencies. [(googleapis#715)](GoogleCloudPlatform/python-docs-samples#715)

* Fix pubusb tests

Change-Id: I7dfe60b0f1240dc58a664968fd97ca5a8fa1109d

* Auto-update dependencies. [(googleapis#825)](GoogleCloudPlatform/python-docs-samples#825)

* Auto-update dependencies. [(googleapis#876)](GoogleCloudPlatform/python-docs-samples#876)

* Fix reference to our testing tools

* Re-generate all readmes

* Auto-update dependencies. [(googleapis#922)](GoogleCloudPlatform/python-docs-samples#922)

* Auto-update dependencies.

* Fix pubsub iam samples

* Fix README rst links [(googleapis#962)](GoogleCloudPlatform/python-docs-samples#962)

* Fix README rst links

* Update all READMEs

* Auto-update dependencies. [(googleapis#1004)](GoogleCloudPlatform/python-docs-samples#1004)

* Auto-update dependencies.

* Fix natural language samples

* Fix pubsub iam samples

* Fix language samples

* Fix bigquery samples

* Auto-update dependencies. [(googleapis#1055)](GoogleCloudPlatform/python-docs-samples#1055)

* Auto-update dependencies.

* Explicitly use latest bigtable client

Change-Id: Id71e9e768f020730e4ca9514a0d7ebaa794e7d9e

* Revert language update for now

Change-Id: I8867f154e9a5aae00d0047c9caf880e5e8f50c53

* Remove pdb. smh

Change-Id: I5ff905fadc026eebbcd45512d4e76e003e3b2b43

* Update pubsub samples [(googleapis#1092)](GoogleCloudPlatform/python-docs-samples#1092)

* Fix argpraser for pubsub subscriber

Change-Id: I776863091846ee8ff8a70078c8b8d5498cf81ed6

* Add comment about result blocking in pubsub samples

Change-Id: I149fc1242ceb6b2cff8eae7ef18b364dd5c26566

* Auto-update dependencies. [(googleapis#1097)](GoogleCloudPlatform/python-docs-samples#1097)

* Update all generated readme auth instructions [(googleapis#1121)](GoogleCloudPlatform/python-docs-samples#1121)

Change-Id: I03b5eaef8b17ac3dc3c0339fd2c7447bd3e11bd2

* Added Link to Python Setup Guide [(googleapis#1158)](GoogleCloudPlatform/python-docs-samples#1158)

* Update Readme.rst to add Python setup guide

As requested in b/64770713.

This sample is linked in documentation https://cloud.google.com/bigtable/docs/scaling, and it would make more sense to update the guide here than in the documentation.

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update install_deps.tmpl.rst

* Updated readmegen scripts and re-generated related README files

* Fixed the lint error

* Auto-update dependencies. [(googleapis#1138)](GoogleCloudPlatform/python-docs-samples#1138)

* Fix a few more lint issues

Change-Id: I0d420f3053f391fa225e4b8179e45fd1138f5c65

* Add Snippet for Listing All Subscriptions in a Project [(googleapis#1169)](GoogleCloudPlatform/python-docs-samples#1169)

* Auto-update dependencies. [(googleapis#1186)](GoogleCloudPlatform/python-docs-samples#1186)

* Auto-update dependencies. [(googleapis#1234)](GoogleCloudPlatform/python-docs-samples#1234)

* Auto-update dependencies.

* Drop pytest-logcapture as it's no longer needed

Change-Id: Ia8b9e8aaf248e9770db6bc4842a4532df8383893

* Auto-update dependencies. [(googleapis#1239)](GoogleCloudPlatform/python-docs-samples#1239)

* Added "Open in Cloud Shell" buttons to README files [(googleapis#1254)](GoogleCloudPlatform/python-docs-samples#1254)

* Auto-update dependencies. [(googleapis#1263)](GoogleCloudPlatform/python-docs-samples#1263)

* Auto-update dependencies. [(googleapis#1272)](GoogleCloudPlatform/python-docs-samples#1272)

* Auto-update dependencies.

* Update requirements.txt

* Auto-update dependencies. [(googleapis#1282)](GoogleCloudPlatform/python-docs-samples#1282)

* Auto-update dependencies.

* Fix storage acl sample

Change-Id: I413bea899fdde4c4859e4070a9da25845b81f7cf

* Add listen for errors sample. [(#1306)](GoogleCloudPlatform/python-docs-samples#1306)

* Add listen for errors sample.

* Update subscriber.py

* Update subscriber.py

* Fix subscription.open get called twice in the client libraries [(#1321)](GoogleCloudPlatform/python-docs-samples#1321)

* Add tests for creating push subscription. [(#1332)](GoogleCloudPlatform/python-docs-samples#1332)

This is a separate PR from actually adding the sample, which is in GoogleCloudPlatform/python-docs-samples#1331.

* Add create push subscription sample. [(#1331)](GoogleCloudPlatform/python-docs-samples#1331)

* Update API version and body. [(#1326)](GoogleCloudPlatform/python-docs-samples#1326)

The API version should be v1, not v1beta1. Also remove the unnecessary 'data' field from the body and just use 'binary_data'.

* Add sample for updating a subscription. [(#1335)](GoogleCloudPlatform/python-docs-samples#1335)

* Change update_subscription to change endpoint URL. [(#1344)](GoogleCloudPlatform/python-docs-samples#1344)

The documentation specifies that the update subscription commands show how to update an endpoint URL: https://cloud.google.com/pubsub/docs/admin#update_a_subscription.

* Auto-update dependencies. [(#1359)](GoogleCloudPlatform/python-docs-samples#1359)

* Auto-update dependencies. [(#1389)](GoogleCloudPlatform/python-docs-samples#1389)

* Added sample for publishing/receiving messages with custom attributes [(#1409)](GoogleCloudPlatform/python-docs-samples#1409)

* Auto-update dependencies.

* Regenerate the README files and fix the Open in Cloud Shell link for some samples [(#1441)](GoogleCloudPlatform/python-docs-samples#1441)

* Update READMEs to fix numbering and add git clone [(#1464)](GoogleCloudPlatform/python-docs-samples#1464)

* PubSub: adds region tags and updates existing to standard [(#1491)](GoogleCloudPlatform/python-docs-samples#1491)

* Pubsub: Add missing region tag [(#1498)](GoogleCloudPlatform/python-docs-samples#1498)

* Add the Pub/Sub handle_publisher_error sample [(#1440)](GoogleCloudPlatform/python-docs-samples#1440)

* Add the Pub/Sub handle_publisher_error sample

* Update requirements.txt

* Update publisher.py

* Update publisher.py

* Added region tag

* Modified publisher with error handling [(#1568)](GoogleCloudPlatform/python-docs-samples#1568)

* Updated google-cloud-pubsub to version 0.35 [(#1624)](GoogleCloudPlatform/python-docs-samples#1624)

* Updated library version

* Rewrote test for publish with error handler

* Custom _publish function in test prints no 'Attributes'

* Added timeout in error handling [(#1636)](GoogleCloudPlatform/python-docs-samples#1636)

* Auto-update dependencies. [(#1658)](GoogleCloudPlatform/python-docs-samples#1658)

* Auto-update dependencies.

* Rollback appengine/standard/bigquery/.

* Rollback appengine/standard/iap/.

* Rollback bigtable/metricscaler.

* Rolledback appengine/flexible/datastore.

* Rollback dataproc/

* Rollback jobs/api_client

* Rollback vision/cloud-client.

* Rollback functions/ocr/app.

* Rollback iot/api-client/end_to_end_example.

* Rollback storage/cloud-client.

* Rollback kms/api-client.

* Rollback dlp/

* Rollback bigquery/cloud-client.

* Rollback iot/api-client/manager.

* Rollback appengine/flexible/cloudsql_postgresql.

* Added sample for Pub/Sub synchronous pull subscriber [(#1673)](GoogleCloudPlatform/python-docs-samples#1673)

* Added sample for synchronous pull

* Updated variable name [(#1680)](GoogleCloudPlatform/python-docs-samples#1680)

* Fixed return object from `subscriber.subscribe()` [(#1685)](GoogleCloudPlatform/python-docs-samples#1685)

* Pub/Sub: synchronous pull with lease management [(#1701)](GoogleCloudPlatform/python-docs-samples#1701)

* Synchronous pull with lease management

* Updated library version

* Pub/Sub: moved import statements inside region tags [(#1753)](GoogleCloudPlatform/python-docs-samples#1753)

* Moved import stataments inside region tags

* Explained topic and subscription path methods

* Pub/Sub end-to-end sample [(#1800)](GoogleCloudPlatform/python-docs-samples#1800)

* Created new end-to-end sample, moved old sample

* Add space around operator

* Add test for updating a subscription. [(#1336)](GoogleCloudPlatform/python-docs-samples#1336)

Tests for GoogleCloudPlatform/python-docs-samples#1335. Using ack_deadline_seconds as the example.

* Fix update test to use new endpoint [(#1925)](GoogleCloudPlatform/python-docs-samples#1925)

* Fix update test to use new endpoint

* Handle subscription already exists

Previous deletions don't always succeed

* Use a new endpoint for update

* Auto-update dependencies. [(#1980)](GoogleCloudPlatform/python-docs-samples#1980)

* Auto-update dependencies.

* Update requirements.txt

* Update requirements.txt

* Cloud Pub/Sub Quickstart V2 [(#2004)](GoogleCloudPlatform/python-docs-samples#2004)

* Quickstart V2

* Adopts Kir's suggestions

* Adopted Tim's suggestions

* proper resource deletion during teardown

* Pub/Sub: publish with error-handling comments [(#2222)](GoogleCloudPlatform/python-docs-samples#2222)

* Resolve all futures [(#2231)](GoogleCloudPlatform/python-docs-samples#2231)

* Pub/Sub: add publish retry sample [(#2273)](GoogleCloudPlatform/python-docs-samples#2273)

* Publish retry sample

* double to single quotes

* double to single quotes

* license year

* Fix a TODO comment on pubsub/cloud-client/subscriber.py [(#2302)](GoogleCloudPlatform/python-docs-samples#2302)

* Print actual number of messages pulled [(#2078)](GoogleCloudPlatform/python-docs-samples#2078)

* Print actual number of messages pulled

* Pub/Sub: fix subscriber async region tag mistake [(#2334)](GoogleCloudPlatform/python-docs-samples#2334)

* Pub/Sub: update retry settings in sample [(#2395)](GoogleCloudPlatform/python-docs-samples#2395)

* Pub/Sub: improve pub.py [(#2403)](GoogleCloudPlatform/python-docs-samples#2403)

* print number of messages published

* two nit's

* Adds updates for samples profiler ... vision [(#2439)](GoogleCloudPlatform/python-docs-samples#2439)

* Pub/Sub: update how subscriber client listens to StreamingPullFuture [(#2475)](GoogleCloudPlatform/python-docs-samples#2475)

* update sub.py & requirements.txt
* fix flaky subscriber test with separate subscriptions

* Pub/Sub: update how to test with mock [(#2555)](GoogleCloudPlatform/python-docs-samples#2555)

* Update test with mock
* Clean up resources after tests
* Use unique resource names avoid test failures
* Delete subscriptions in cleanup phase
* Ensure unique topic name
* Update assert to remove bytestring notation
* Rewrite PubSubToGCS test using dataflow testing module

* Pub/Sub: remove infinite while loops in subscriber examples [(#2604)](GoogleCloudPlatform/python-docs-samples#2604)

* use result() on streaming pull futures instead of infinite while
* remove unused imports

* Pub/Sub: add timeout in argparse [(#2637)](GoogleCloudPlatform/python-docs-samples#2637)

* Auto-update dependencies. [(#2005)](GoogleCloudPlatform/python-docs-samples#2005)

* Auto-update dependencies.

* Revert update of appengine/flexible/datastore.

* revert update of appengine/flexible/scipy

* revert update of bigquery/bqml

* revert update of bigquery/cloud-client

* revert update of bigquery/datalab-migration

* revert update of bigtable/quickstart

* revert update of compute/api

* revert update of container_registry/container_analysis

* revert update of dataflow/run_template

* revert update of datastore/cloud-ndb

* revert update of dialogflow/cloud-client

* revert update of dlp

* revert update of functions/imagemagick

* revert update of functions/ocr/app

* revert update of healthcare/api-client/fhir

* revert update of iam/api-client

* revert update of iot/api-client/gcs_file_to_device

* revert update of iot/api-client/mqtt_example

* revert update of language/automl

* revert update of run/image-processing

* revert update of vision/automl

* revert update testing/requirements.txt

* revert update of vision/cloud-client/detect

* revert update of vision/cloud-client/product_search

* revert update of jobs/v2/api_client

* revert update of jobs/v3/api_client

* revert update of opencensus

* revert update of translate/cloud-client

* revert update to speech/cloud-client

Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>
Co-authored-by: Doug Mahugh <dmahugh@gmail.com>

* remove publish concurrency control sample [(#2960)](GoogleCloudPlatform/python-docs-samples#2960)

* Pub/Sub: remove unreferenced samples [(#2986)](GoogleCloudPlatform/python-docs-samples#2986)

* remove qs samples

* update README

* Pub/Sub: add SubscriberClient.close() to examples [(#3118)](GoogleCloudPlatform/python-docs-samples#3118)

* Add SubscriberClient.close() to examples.

Co-authored-by: Prad Nelluru <pradn@google.com>
Co-authored-by: Prad Nelluru <prad.nelluru@gmail.com>

* Pub/Sub: update publish with batch settings sample [(#3137)](GoogleCloudPlatform/python-docs-samples#3137)

* non-blocking publish

* remove unused lib

* lint

* add defaults

* Simplify noxfile setup. [(#2806)](GoogleCloudPlatform/python-docs-samples#2806)

* chore(deps): update dependency requests to v2.23.0

* Simplify noxfile and add version control.

* Configure appengine/standard to only test Python 2.7.

* Update Kokokro configs to match noxfile.

* Add requirements-test to each folder.

* Remove Py2 versions from everything execept appengine/standard.

* Remove conftest.py.

* Remove appengine/standard/conftest.py

* Remove 'no-sucess-flaky-report' from pytest.ini.

* Add GAE SDK back to appengine/standard tests.

* Fix typo.

* Roll pytest to python 2 version.

* Add a bunch of testing requirements.

* Remove typo.

* Add appengine lib directory back in.

* Add some additional requirements.

* Fix issue with flake8 args.

* Even more requirements.

* Readd appengine conftest.py.

* Add a few more requirements.

* Even more Appengine requirements.

* Add webtest for appengine/standard/mailgun.

* Add some additional requirements.

* Add workaround for issue with mailjet-rest.

* Add responses for appengine/standard/mailjet.

Co-authored-by: Renovate Bot <bot@renovateapp.com>

* chore: remove gcp-devrel-py-tools from iot and pubsub [(#3470)](GoogleCloudPlatform/python-docs-samples#3470)

* [iot] chore: remove unused dependency

* [pubsub] chore: remove gcp-devrel-py-tools

* Update dependency google-cloud-pubsub to v1.4.2 in Storage and Pub/Sub [(#3343)](GoogleCloudPlatform/python-docs-samples#3343)

* chore: some lint fixes [(#3748)](GoogleCloudPlatform/python-docs-samples#3748)

* chore(deps): update dependency google-cloud-pubsub to v1.4.3 [(#3725)](GoogleCloudPlatform/python-docs-samples#3725)

Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Co-authored-by: Takashi Matsuo <tmatsuo@google.com>

* chore(deps): update dependency google-cloud-pubsub to v1.5.0 [(#3781)](GoogleCloudPlatform/python-docs-samples#3781)

Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>

* samples: add Pub/Sub dead letter queue samples [(#3904)](GoogleCloudPlatform/python-docs-samples#3904)

* fix: make timeout an optional positional arg [(#3938)](GoogleCloudPlatform/python-docs-samples#3938)

* fix: make timeout an optional positional arg

* place `none` back in function signature

Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>

* fix: replace name with id in samples [(#3953)](GoogleCloudPlatform/python-docs-samples#3953)

* Replace GCLOUD_PROJECT with GOOGLE_CLOUD_PROJECT. [(#4022)](GoogleCloudPlatform/python-docs-samples#4022)

* nit: remove redundant/wrong Pub/Sub region tag [(#4027)](GoogleCloudPlatform/python-docs-samples#4027)

* Pub/Sub: wrap subscriber in a with block and add comments [(#4070)](GoogleCloudPlatform/python-docs-samples#4070)

Use a `with` block to wrap subscriber and describe its purpose.

Internal bug: b/157401623

* Update dependency google-cloud-pubsub to v1.6.0 [(#4039)](GoogleCloudPlatform/python-docs-samples#4039)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [google-cloud-pubsub](https://togithub.com/googleapis/python-pubsub) | minor | `==1.5.0` -> `==1.6.0` |

---

<details>
<summary>googleapis/python-pubsub</summary>

[Compare Source](https://togithub.com/googleapis/python-pubsub/compare/v1.5.0...v1.6.0)

-   Add flow control for message publishing ([#&#8203;96](https://www.github.com/googleapis/python-pubsub/issues/96)) ([06085c4](https://www.github.com/googleapis/python-pubsub/commit/06085c4083b9dccdd50383257799904510bbf3a0))

-   Fix PubSub incompatibility with api-core 1.17.0+ ([#&#8203;103](https://www.github.com/googleapis/python-pubsub/issues/103)) ([c02060f](https://www.github.com/googleapis/python-pubsub/commit/c02060fbbe6e2ca4664bee08d2de10665d41dc0b))

-   Clarify that Schedulers shouldn't be used with multiple SubscriberClients ([#&#8203;100](https://togithub.com/googleapis/python-pubsub/pull/100)) ([cf9e87c](https://togithub.com/googleapis/python-pubsub/commit/cf9e87c80c0771f3fa6ef784a8d76cb760ad37ef))
-   Fix update subscription/snapshot/topic samples ([#&#8203;113](https://togithub.com/googleapis/python-pubsub/pull/113)) ([e62c38b](https://togithub.com/googleapis/python-pubsub/commit/e62c38bb33de2434e32f866979de769382dea34a))

-   Re-generated service implementaton using synth: removed experimental notes from the RetryPolicy and filtering features in anticipation of GA, added DetachSubscription (experimental) ([#&#8203;114](https://togithub.com/googleapis/python-pubsub/pull/114)) ([0132a46](https://togithub.com/googleapis/python-pubsub/commit/0132a4680e0727ce45d5e27d98ffc9f3541a0962))
-   Incorporate will_accept() checks into publish() ([#&#8203;108](https://togithub.com/googleapis/python-pubsub/pull/108)) ([6c7677e](https://togithub.com/googleapis/python-pubsub/commit/6c7677ecb259672bbb9b6f7646919e602c698570))

</details>

---

:date: **Schedule**: At any time (no schedule defined).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Never, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#GoogleCloudPlatform/python-docs-samples).

* chore: update templates

Co-authored-by: Jon Wayne Parrott <jonwayne@google.com>
Co-authored-by: DPE bot <dpebot@google.com>
Co-authored-by: Jason Dobry <jmdobry@users.noreply.github.com>
Co-authored-by: Bill Prin <waprin@gmail.com>
Co-authored-by: michaelawyu <chenyumic@google.com>
Co-authored-by: noerog <32459203+noerog@users.noreply.github.com>
Co-authored-by: L J <luxiangu@users.noreply.github.com>
Co-authored-by: Frank Natividad <frankyn@users.noreply.github.com>
Co-authored-by: Alix Hamilton <ajhamilton@google.com>
Co-authored-by: michaelawyu <michael.a.w.yu@hotmail.com>
Co-authored-by: Tianzi Cai <tianzih@outlook.com>
Co-authored-by: Charles Engelke <github@engelke.com>
Co-authored-by: Tianzi Cai <anguillanneuf@gmail.com>
Co-authored-by: Keiji Yoshida <keijiy@google.com>
Co-authored-by: oli <oliver.coad@gmail.com>
Co-authored-by: Gus Class <gguuss@gmail.com>
Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>
Co-authored-by: Doug Mahugh <dmahugh@gmail.com>
Co-authored-by: Prad Nelluru <pradn@google.com>
Co-authored-by: Prad Nelluru <prad.nelluru@gmail.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Takashi Matsuo <tmatsuo@google.com>
Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
plamut added a commit to plamut/python-pubsub that referenced this pull request Jul 10, 2020
This reverts commit e204b86.

We want to merge the samples branch *unsquashed* to preserve
samples commit history.
plamut added a commit that referenced this pull request Jul 10, 2020
This reverts commit e204b86.

We want to merge the samples branch *unsquashed* to preserve
samples commit history.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement. type: docs Improvement to the documentation for an API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add pubsub/cloud-client samples from the samples repo