From 9a58bf3209e08028a10feb09632a37aad594d720 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 27 Jul 2023 20:42:59 +0200 Subject: [PATCH 1/6] chore(deps): update dependency google-cloud-pubsub to v2.18.1 (#967) --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index f74ea492b..9b5ef8e5b 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-pubsub==2.18.0 +google-cloud-pubsub==2.18.1 avro==1.11.2 From 3a0122ac4f92a8dadd748cc3ef0973a825edf50e Mon Sep 17 00:00:00 2001 From: Anna Cocuzzo <63511057+acocuzzo@users.noreply.github.com> Date: Mon, 31 Jul 2023 04:17:09 -1000 Subject: [PATCH 2/6] Samples: Add CloudStorage Subscription (#928) * add cloudstorage samples * fix lint * add protobuf * Create unused topic --- samples/snippets/requirements-test.txt | 1 + samples/snippets/requirements.txt | 2 + samples/snippets/subscriber.py | 69 ++++++++++++++++++++ samples/snippets/subscriber_test.py | 90 ++++++++++++++++++++------ 4 files changed, 142 insertions(+), 20 deletions(-) diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt index 53d976a09..9f0580cbf 100644 --- a/samples/snippets/requirements-test.txt +++ b/samples/snippets/requirements-test.txt @@ -3,3 +3,4 @@ pytest==7.4.0 mock==5.1.0 flaky==3.7.0 google-cloud-bigquery==3.11.4 +google-cloud-storage==2.9.0 diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 9b5ef8e5b..dd5fae7c8 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,2 +1,4 @@ google-cloud-pubsub==2.18.1 avro==1.11.2 +protobuf==4.21.9 +avro==1.11.2 diff --git a/samples/snippets/subscriber.py b/samples/snippets/subscriber.py index b7fd1ebdd..897d2f47b 100644 --- a/samples/snippets/subscriber.py +++ b/samples/snippets/subscriber.py @@ -354,6 +354,62 @@ def create_bigquery_subscription( # [END pubsub_create_bigquery_subscription] +def create_cloudstorage_subscription( + project_id: str, topic_id: str, subscription_id: str, bucket: str +) -> None: + """Create a new CloudStorage subscription on the given topic.""" + # [START pubsub_cloudstorage_subscription] + from google.cloud import pubsub_v1 + from google.protobuf import duration_pb2 + + # TODO(developer) + # project_id = "your-project-id" + # topic_id = "your-topic-id" + # subscription_id = "your-subscription-id" + # bucket = "my-bucket" + + filename_prefix = "log_events_" + filename_suffix = ".avro" + # Either CloudStorageConfig.AvroConfig or CloudStorageConfig.TextConfig + # defaults to TextConfig + avro_config = pubsub_v1.types.CloudStorageConfig.AvroConfig(write_metadata=True) + + publisher = pubsub_v1.PublisherClient() + subscriber = pubsub_v1.SubscriberClient() + topic_path = publisher.topic_path(project_id, topic_id) + subscription_path = subscriber.subscription_path(project_id, subscription_id) + max_duration = duration_pb2.Duration() + max_duration.FromSeconds(300) + + cloudstorage_config = pubsub_v1.types.CloudStorageConfig( + bucket=bucket, + filename_prefix=filename_prefix, + filename_suffix=filename_suffix, + avro_config=avro_config, + # Min 1 minutes, max 10 minutes + max_duration=max_duration, + # Min 1 KB, max 10 GiB + max_bytes=2000, + ) + + # Wrap the subscriber in a 'with' block to automatically call close() to + # close the underlying gRPC channel when done. + with subscriber: + subscription = subscriber.create_subscription( + request={ + "name": subscription_path, + "topic": topic_path, + "cloud_storage_config": cloudstorage_config, + } + ) + + print(f"CloudStorage subscription created: {subscription}.") + print(f"Bucket for subscription is: {bucket}") + print(f"Prefix is: {filename_prefix}") + print(f"Suffix is: {filename_suffix}") + # [END pubsub_cloudstorage_subscription] + + def delete_subscription(project_id: str, subscription_id: str) -> None: """Deletes an existing Pub/Sub topic.""" # [START pubsub_delete_subscription] @@ -1023,6 +1079,14 @@ def callback(message: pubsub_v1.subscriber.message.Message) -> None: create_bigquery_subscription_parser.add_argument("subscription_id") create_bigquery_subscription_parser.add_argument("bigquery_table_id") + create_cloudstorage_subscription_parser = subparsers.add_parser( + "create-cloudstorage", + help=create_cloudstorage_subscription.__doc__, + ) + create_cloudstorage_subscription_parser.add_argument("topic_id") + create_cloudstorage_subscription_parser.add_argument("subscription_id") + create_cloudstorage_subscription_parser.add_argument("bucket") + delete_parser = subparsers.add_parser("delete", help=delete_subscription.__doc__) delete_parser.add_argument("subscription_id") @@ -1162,6 +1226,11 @@ def callback(message: pubsub_v1.subscriber.message.Message) -> None: args.subscription_id, args.bigquery_table_id, ) + elif args.command == "create-cloudstorage": + create_cloudstorage_subscription( + args.project_id, args.topic_id, args.subscription_id, args.bucket + ) + elif args.command == "delete": delete_subscription(args.project_id, args.subscription_id) elif args.command == "update-push": diff --git a/samples/snippets/subscriber_test.py b/samples/snippets/subscriber_test.py index 3eed0d886..3fa94761c 100644 --- a/samples/snippets/subscriber_test.py +++ b/samples/snippets/subscriber_test.py @@ -23,7 +23,7 @@ import backoff from flaky import flaky from google.api_core.exceptions import NotFound -from google.cloud import bigquery, pubsub_v1 +from google.cloud import bigquery, pubsub_v1, storage import pytest import subscriber @@ -35,6 +35,7 @@ PROJECT_ID = os.environ["GOOGLE_CLOUD_PROJECT"] TOPIC = f"subscription-test-topic-{PY_VERSION}-{UUID}" DEAD_LETTER_TOPIC = f"subscription-test-dead-letter-topic-{PY_VERSION}-{UUID}" +UNUSED_TOPIC = f"subscription-unused-topic-{PY_VERSION}-{UUID}" EOD_TOPIC = f"subscription-test-eod-topic-{PY_VERSION}-{UUID}" SUBSCRIPTION_ADMIN = f"subscription-test-subscription-admin-{PY_VERSION}-{UUID}" ENDPOINT = f"https://{PROJECT_ID}.appspot.com/push" @@ -45,6 +46,7 @@ FILTER = 'attributes.author="unknown"' BIGQUERY_DATASET_ID = f"python_samples_dataset_{UNDERSCORE_PY_VERSION}_{UUID}" BIGQUERY_TABLE_ID = f"python_samples_table_{UNDERSCORE_PY_VERSION}_{UUID}" +CLOUDSTORAGE_BUCKET = f"python_samples_bucket_{UNDERSCORE_PY_VERSION}_{UUID}" C = TypeVar("C", bound=Callable[..., Any]) @@ -103,6 +105,23 @@ def topic(publisher_client: pubsub_v1.PublisherClient) -> Generator[str, None, N publisher_client.delete_topic(request={"topic": topic.name}) +# This topic is only for creating subscriptions, no messages should be published on this topic. +@pytest.fixture(scope="module") +def unused_topic( + publisher_client: pubsub_v1.PublisherClient, +) -> Generator[str, None, None]: + topic_path = publisher_client.topic_path(PROJECT_ID, UNUSED_TOPIC) + + try: + topic = publisher_client.get_topic(request={"topic": topic_path}) + except: # noqa + topic = publisher_client.create_topic(request={"name": topic_path}) + + yield topic.name + + publisher_client.delete_topic(request={"topic": topic.name}) + + @pytest.fixture(scope="module") def dead_letter_topic( publisher_client: pubsub_v1.PublisherClient, @@ -191,7 +210,6 @@ def test_create_subscription( topic: str, capsys: CaptureFixture[str], ) -> None: - subscription_for_create_name = ( f"subscription-test-subscription-for-create-{PY_VERSION}-{UUID}" ) @@ -221,7 +239,6 @@ def test_create_subscription_with_dead_letter_policy( dead_letter_topic: str, capsys: CaptureFixture[str], ) -> None: - subscription_dlq_name = ( f"subscription-test-subscription-dlq-for-create-{PY_VERSION}-{UUID}" ) @@ -257,7 +274,6 @@ def test_receive_with_delivery_attempts( dead_letter_topic: str, capsys: CaptureFixture[str], ) -> None: - from google.cloud.pubsub_v1.types import DeadLetterPolicy subscription_dlq_for_receive_name = ( @@ -304,7 +320,6 @@ def test_update_dead_letter_policy( dead_letter_topic: str, capsys: CaptureFixture[str], ) -> None: - from google.cloud.pubsub_v1.types import DeadLetterPolicy subscription_dlq_for_update_name = ( @@ -354,7 +369,6 @@ def test_remove_dead_letter_policy( dead_letter_topic: str, capsys: CaptureFixture[str], ) -> None: - from google.cloud.pubsub_v1.types import DeadLetterPolicy subscription_dlq_for_remove_name = ( @@ -425,7 +439,6 @@ def test_create_subscription_with_filtering( topic: str, capsys: CaptureFixture[str], ) -> None: - subscription_with_filtering_name = ( f"subscription-test-subscription-with-filtering-{PY_VERSION}-{UUID}" ) @@ -458,7 +471,6 @@ def test_create_subscription_with_exactly_once_delivery( exactly_once_delivery_topic: str, capsys: CaptureFixture[str], ) -> None: - subscription_eod_for_create_name = ( f"subscription-test-subscription-eod-for-create-{PY_VERSION}-{UUID}" ) @@ -492,7 +504,6 @@ def test_create_push_subscription( topic: str, capsys: CaptureFixture[str], ) -> None: - push_subscription_for_create_name = ( f"subscription-test-subscription-push-for-create-{PY_VERSION}-{UUID}" ) @@ -523,7 +534,6 @@ def test_update_push_subscription( topic: str, capsys: CaptureFixture[str], ) -> None: - push_subscription_for_update_name = ( f"subscription-test-subscription-push-for-create-{PY_VERSION}-{UUID}" ) @@ -555,7 +565,6 @@ def test_create_push_no_wrapper_subscription( topic: str, capsys: CaptureFixture[str], ) -> None: - push_subscription_for_create_name = ( f"subscription-test-subscription-push-no-wrapper-for-create-{PY_VERSION}-{UUID}" ) @@ -636,11 +645,60 @@ def test_create_bigquery_subscription( subscriber_client.delete_subscription(request={"subscription": subscription_path}) +@pytest.fixture(scope="module") +def cloudstorage_bucket() -> Generator[str, None, None]: + storage_client = storage.Client() + + bucket_name = CLOUDSTORAGE_BUCKET + + bucket = storage_client.create_bucket(bucket_name) + print(f"Bucket {bucket.name} created.") + + yield bucket.name + + bucket.delete() + + +def test_create_cloudstorage_subscription( + subscriber_client: pubsub_v1.SubscriberClient, + unused_topic: str, + cloudstorage_bucket: str, + capsys: CaptureFixture[str], +) -> None: + cloudstorage_subscription_for_create_name = ( + f"subscription-test-subscription-cloudstorage-for-create-{PY_VERSION}-{UUID}" + ) + + subscription_path = subscriber_client.subscription_path( + PROJECT_ID, cloudstorage_subscription_for_create_name + ) + try: + subscriber_client.delete_subscription( + request={"subscription": subscription_path} + ) + except NotFound: + pass + + subscriber.create_cloudstorage_subscription( + PROJECT_ID, + # We have to use a topic with no messages published, + # so that the bucket will be empty and can be deleted. + UNUSED_TOPIC, + cloudstorage_subscription_for_create_name, + cloudstorage_bucket, + ) + + out, _ = capsys.readouterr() + assert f"{cloudstorage_subscription_for_create_name}" in out + + # Clean up. + subscriber_client.delete_subscription(request={"subscription": subscription_path}) + + def test_delete_subscription( subscriber_client: pubsub_v1.SubscriberClient, topic: str, ) -> None: - subscription_for_delete_name = ( f"subscription-test-subscription-for-delete-{PY_VERSION}-{UUID}" ) @@ -672,7 +730,6 @@ def test_receive( publisher_client: pubsub_v1.PublisherClient, capsys: CaptureFixture[str], ) -> None: - subscription_async_for_receive_name = ( f"subscription-test-subscription-async-for-receive-{PY_VERSION}-{UUID}" ) @@ -707,7 +764,6 @@ def test_receive_with_custom_attributes( topic: str, capsys: CaptureFixture[str], ) -> None: - subscription_async_receive_with_custom_name = ( f"subscription-test-subscription-async-receive-with-custom-{PY_VERSION}-{UUID}" ) @@ -745,7 +801,6 @@ def test_receive_with_flow_control( topic: str, capsys: CaptureFixture[str], ) -> None: - subscription_async_receive_with_flow_control_name = f"subscription-test-subscription-async-receive-with-flow-control-{PY_VERSION}-{UUID}" subscription_path = subscriber_client.subscription_path( @@ -780,7 +835,6 @@ def test_receive_with_blocking_shutdown( topic: str, capsys: CaptureFixture[str], ) -> None: - subscription_async_receive_with_blocking_name = f"subscription-test-subscription-async-receive-with-blocking-shutdown-{PY_VERSION}-{UUID}" subscription_path = subscriber_client.subscription_path( @@ -851,7 +905,6 @@ def test_receive_messages_with_exactly_once_delivery_enabled( exactly_once_delivery_topic: str, capsys: CaptureFixture[str], ) -> None: - subscription_eod_for_receive_name = ( f"subscription-test-subscription-eod-for-receive-{PY_VERSION}-{UUID}" ) @@ -894,7 +947,6 @@ def test_listen_for_errors( topic: str, capsys: CaptureFixture[str], ) -> None: - subscription_async_listen = ( f"subscription-test-subscription-async-listen-{PY_VERSION}-{UUID}" ) @@ -928,7 +980,6 @@ def test_receive_synchronously( topic: str, capsys: CaptureFixture[str], ) -> None: - subscription_sync_for_receive_name = ( f"subscription-test-subscription-sync-for-receive-{PY_VERSION}-{UUID}" ) @@ -964,7 +1015,6 @@ def test_receive_synchronously_with_lease( topic: str, capsys: CaptureFixture[str], ) -> None: - subscription_sync_for_receive_with_lease_name = f"subscription-test-subscription-sync-for-receive-with-lease-{PY_VERSION}-{UUID}" subscription_path = subscriber_client.subscription_path( From d643dcc437ef6cfb3c1c3e78d92eaf90d4b45646 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 1 Aug 2023 16:15:13 -0400 Subject: [PATCH 3/6] chore: [autoapprove] Pin flake8 version (#969) Source-Link: https://github.com/googleapis/synthtool/commit/0ddbff8012e47cde4462fe3f9feab01fbc4cdfd6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- .pre-commit-config.yaml | 2 +- noxfile.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 0ddd0e4d1..d71329cc8 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:6c1cbc75c74b8bdd71dada2fa1677e9d6d78a889e9a70ee75b93d1d0543f96e1 -# created: 2023-07-25T21:01:10.396410762Z + digest: sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b +# created: 2023-08-01T17:41:45.434027321Z diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e3898fd1..19409cbd3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,6 @@ repos: hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 + rev: 6.1.0 hooks: - id: flake8 diff --git a/noxfile.py b/noxfile.py index e93740a13..ae863d0fa 100644 --- a/noxfile.py +++ b/noxfile.py @@ -25,6 +25,7 @@ import nox +FLAKE8_VERSION = "flake8==6.1.0" BLACK_VERSION = "black==22.3.0" ISORT_VERSION = "isort==5.10.1" LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] @@ -134,7 +135,7 @@ def lint(session): Returns a failure if the linters find linting errors or sufficiently serious code quality issues. """ - session.install("flake8", BLACK_VERSION) + session.install(FLAKE8_VERSION, BLACK_VERSION) session.run( "black", "--check", From 62c595aa97434e518c7dd78faa1ac91afb575179 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 10:20:07 -0400 Subject: [PATCH 4/6] build: [autoapprove] bump cryptography from 41.0.2 to 41.0.3 (#973) Source-Link: https://github.com/googleapis/synthtool/commit/352b9d4c068ce7c05908172af128b294073bf53c Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 48 +++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index d71329cc8..a3da1b0d4 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b -# created: 2023-08-01T17:41:45.434027321Z + digest: sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7 +# created: 2023-08-02T10:53:29.114535628Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 76d9bba0f..029bd342d 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,30 +113,30 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==41.0.2 \ - --hash=sha256:01f1d9e537f9a15b037d5d9ee442b8c22e3ae11ce65ea1f3316a41c78756b711 \ - --hash=sha256:079347de771f9282fbfe0e0236c716686950c19dee1b76240ab09ce1624d76d7 \ - --hash=sha256:182be4171f9332b6741ee818ec27daff9fb00349f706629f5cbf417bd50e66fd \ - --hash=sha256:192255f539d7a89f2102d07d7375b1e0a81f7478925b3bc2e0549ebf739dae0e \ - --hash=sha256:2a034bf7d9ca894720f2ec1d8b7b5832d7e363571828037f9e0c4f18c1b58a58 \ - --hash=sha256:342f3767e25876751e14f8459ad85e77e660537ca0a066e10e75df9c9e9099f0 \ - --hash=sha256:439c3cc4c0d42fa999b83ded80a9a1fb54d53c58d6e59234cfe97f241e6c781d \ - --hash=sha256:49c3222bb8f8e800aead2e376cbef687bc9e3cb9b58b29a261210456a7783d83 \ - --hash=sha256:674b669d5daa64206c38e507808aae49904c988fa0a71c935e7006a3e1e83831 \ - --hash=sha256:7a9a3bced53b7f09da251685224d6a260c3cb291768f54954e28f03ef14e3766 \ - --hash=sha256:7af244b012711a26196450d34f483357e42aeddb04128885d95a69bd8b14b69b \ - --hash=sha256:7d230bf856164de164ecb615ccc14c7fc6de6906ddd5b491f3af90d3514c925c \ - --hash=sha256:84609ade00a6ec59a89729e87a503c6e36af98ddcd566d5f3be52e29ba993182 \ - --hash=sha256:9a6673c1828db6270b76b22cc696f40cde9043eb90373da5c2f8f2158957f42f \ - --hash=sha256:9b6d717393dbae53d4e52684ef4f022444fc1cce3c48c38cb74fca29e1f08eaa \ - --hash=sha256:9c3fe6534d59d071ee82081ca3d71eed3210f76ebd0361798c74abc2bcf347d4 \ - --hash=sha256:a719399b99377b218dac6cf547b6ec54e6ef20207b6165126a280b0ce97e0d2a \ - --hash=sha256:b332cba64d99a70c1e0836902720887fb4529ea49ea7f5462cf6640e095e11d2 \ - --hash=sha256:d124682c7a23c9764e54ca9ab5b308b14b18eba02722b8659fb238546de83a76 \ - --hash=sha256:d73f419a56d74fef257955f51b18d046f3506270a5fd2ac5febbfa259d6c0fa5 \ - --hash=sha256:f0dc40e6f7aa37af01aba07277d3d64d5a03dc66d682097541ec4da03cc140ee \ - --hash=sha256:f14ad275364c8b4e525d018f6716537ae7b6d369c094805cae45300847e0894f \ - --hash=sha256:f772610fe364372de33d76edcd313636a25684edb94cee53fd790195f5989d14 +cryptography==41.0.3 \ + --hash=sha256:0d09fb5356f975974dbcb595ad2d178305e5050656affb7890a1583f5e02a306 \ + --hash=sha256:23c2d778cf829f7d0ae180600b17e9fceea3c2ef8b31a99e3c694cbbf3a24b84 \ + --hash=sha256:3fb248989b6363906827284cd20cca63bb1a757e0a2864d4c1682a985e3dca47 \ + --hash=sha256:41d7aa7cdfded09b3d73a47f429c298e80796c8e825ddfadc84c8a7f12df212d \ + --hash=sha256:42cb413e01a5d36da9929baa9d70ca90d90b969269e5a12d39c1e0d475010116 \ + --hash=sha256:4c2f0d35703d61002a2bbdcf15548ebb701cfdd83cdc12471d2bae80878a4207 \ + --hash=sha256:4fd871184321100fb400d759ad0cddddf284c4b696568204d281c902fc7b0d81 \ + --hash=sha256:5259cb659aa43005eb55a0e4ff2c825ca111a0da1814202c64d28a985d33b087 \ + --hash=sha256:57a51b89f954f216a81c9d057bf1a24e2f36e764a1ca9a501a6964eb4a6800dd \ + --hash=sha256:652627a055cb52a84f8c448185922241dd5217443ca194d5739b44612c5e6507 \ + --hash=sha256:67e120e9a577c64fe1f611e53b30b3e69744e5910ff3b6e97e935aeb96005858 \ + --hash=sha256:6af1c6387c531cd364b72c28daa29232162010d952ceb7e5ca8e2827526aceae \ + --hash=sha256:6d192741113ef5e30d89dcb5b956ef4e1578f304708701b8b73d38e3e1461f34 \ + --hash=sha256:7efe8041897fe7a50863e51b77789b657a133c75c3b094e51b5e4b5cec7bf906 \ + --hash=sha256:84537453d57f55a50a5b6835622ee405816999a7113267739a1b4581f83535bd \ + --hash=sha256:8f09daa483aedea50d249ef98ed500569841d6498aa9c9f4b0531b9964658922 \ + --hash=sha256:95dd7f261bb76948b52a5330ba5202b91a26fbac13ad0e9fc8a3ac04752058c7 \ + --hash=sha256:a74fbcdb2a0d46fe00504f571a2a540532f4c188e6ccf26f1f178480117b33c4 \ + --hash=sha256:a983e441a00a9d57a4d7c91b3116a37ae602907a7618b882c8013b5762e80574 \ + --hash=sha256:ab8de0d091acbf778f74286f4989cf3d1528336af1b59f3e5d2ebca8b5fe49e1 \ + --hash=sha256:aeb57c421b34af8f9fe830e1955bf493a86a7996cc1338fe41b30047d16e962c \ + --hash=sha256:ce785cf81a7bdade534297ef9e490ddff800d956625020ab2ec2780a556c313e \ + --hash=sha256:d0d651aa754ef58d75cec6edfbd21259d93810b73f6ec246436a21b7841908de # via # gcp-releasetool # secretstorage From e4364d2a061bb73fe3410d2ef213a04f3315e282 Mon Sep 17 00:00:00 2001 From: amfisher-404 Date: Mon, 7 Aug 2023 14:14:30 -0400 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20Change=20retry=20multiplier=20from?= =?UTF-8?q?=201.3=20to=204,=20for=20requests=20that=20retry=20Resour?= =?UTF-8?q?=E2=80=A6=20(#971)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Change retry multiplier from 1.3 to 4, for requests that retry ResourceExhausted. --- google/pubsub_v1/services/publisher/async_client.py | 2 +- google/pubsub_v1/services/publisher/transports/base.py | 2 +- google/pubsub_v1/services/subscriber/async_client.py | 2 +- google/pubsub_v1/services/subscriber/transports/base.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/pubsub_v1/services/publisher/async_client.py b/google/pubsub_v1/services/publisher/async_client.py index 2950acb68..e3c9647e9 100644 --- a/google/pubsub_v1/services/publisher/async_client.py +++ b/google/pubsub_v1/services/publisher/async_client.py @@ -556,7 +556,7 @@ async def sample_publish(): default_retry=retries.Retry( initial=0.1, maximum=60.0, - multiplier=1.3, + multiplier=4.0, predicate=retries.if_exception_type( core_exceptions.Aborted, core_exceptions.Cancelled, diff --git a/google/pubsub_v1/services/publisher/transports/base.py b/google/pubsub_v1/services/publisher/transports/base.py index e24ec314d..e8caa080b 100644 --- a/google/pubsub_v1/services/publisher/transports/base.py +++ b/google/pubsub_v1/services/publisher/transports/base.py @@ -162,7 +162,7 @@ def _prep_wrapped_messages(self, client_info): default_retry=retries.Retry( initial=0.1, maximum=60.0, - multiplier=1.3, + multiplier=4.0, predicate=retries.if_exception_type( core_exceptions.Aborted, core_exceptions.Cancelled, diff --git a/google/pubsub_v1/services/subscriber/async_client.py b/google/pubsub_v1/services/subscriber/async_client.py index c4ed218d0..fbc5535f1 100644 --- a/google/pubsub_v1/services/subscriber/async_client.py +++ b/google/pubsub_v1/services/subscriber/async_client.py @@ -1383,7 +1383,7 @@ def request_generator(): default_retry=retries.Retry( initial=0.1, maximum=60.0, - multiplier=1.3, + multiplier=4.0, predicate=retries.if_exception_type( core_exceptions.Aborted, core_exceptions.DeadlineExceeded, diff --git a/google/pubsub_v1/services/subscriber/transports/base.py b/google/pubsub_v1/services/subscriber/transports/base.py index a9ebec196..d50b8baf6 100644 --- a/google/pubsub_v1/services/subscriber/transports/base.py +++ b/google/pubsub_v1/services/subscriber/transports/base.py @@ -255,7 +255,7 @@ def _prep_wrapped_messages(self, client_info): default_retry=retries.Retry( initial=0.1, maximum=60.0, - multiplier=1.3, + multiplier=4.0, predicate=retries.if_exception_type( core_exceptions.Aborted, core_exceptions.DeadlineExceeded, From dfad5e039b1cd354c5776ffac7651ef064d50e96 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 16:28:47 -0400 Subject: [PATCH 6/6] chore(main): release 2.18.2 (#974) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ google/pubsub/gapic_version.py | 2 +- google/pubsub_v1/gapic_version.py | 2 +- .../snippet_metadata_google.pubsub.v1.json | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 75006b003..e97945cb8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,4 +1,4 @@ { - ".": "2.18.1" + ".": "2.18.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bfdb68028..53108031e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ [1]: https://pypi.org/project/google-cloud-pubsub/#history +## [2.18.2](https://github.com/googleapis/python-pubsub/compare/v2.18.1...v2.18.2) (2023-08-07) + + +### Bug Fixes + +* Change retry multiplier from 1.3 to 4, for requests that retry Resour… ([#971](https://github.com/googleapis/python-pubsub/issues/971)) ([e4364d2](https://github.com/googleapis/python-pubsub/commit/e4364d2a061bb73fe3410d2ef213a04f3315e282)) + ## [2.18.1](https://github.com/googleapis/python-pubsub/compare/v2.18.0...v2.18.1) (2023-07-26) diff --git a/google/pubsub/gapic_version.py b/google/pubsub/gapic_version.py index e1b4da1de..6f338c034 100644 --- a/google/pubsub/gapic_version.py +++ b/google/pubsub/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.18.1" # {x-release-please-version} +__version__ = "2.18.2" # {x-release-please-version} diff --git a/google/pubsub_v1/gapic_version.py b/google/pubsub_v1/gapic_version.py index e1b4da1de..6f338c034 100644 --- a/google/pubsub_v1/gapic_version.py +++ b/google/pubsub_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.18.1" # {x-release-please-version} +__version__ = "2.18.2" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.pubsub.v1.json b/samples/generated_samples/snippet_metadata_google.pubsub.v1.json index 551a55277..8c531f980 100644 --- a/samples/generated_samples/snippet_metadata_google.pubsub.v1.json +++ b/samples/generated_samples/snippet_metadata_google.pubsub.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-pubsub", - "version": "2.18.1" + "version": "2.18.2" }, "snippets": [ {