From 00e720d030a74f093ae181520b1e37ac9a61f30a Mon Sep 17 00:00:00 2001 From: Diego Alonso Marquez Palacios Date: Fri, 3 Mar 2023 13:44:31 -0500 Subject: [PATCH 1/8] fix(speech): increment retry setting values and test timeout values in IT --- .../com/google/cloud/speech/v1/it/ITSpeechTest.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java index 73546ae21e58..bd3f4f1dccb8 100644 --- a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java @@ -16,6 +16,7 @@ package com.google.cloud.speech.v1.it; +import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiStreamObserver; import com.google.cloud.speech.v1.LongRunningRecognizeResponse; import com.google.cloud.speech.v1.RecognitionAudio; @@ -34,14 +35,24 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; +import org.threeten.bp.Duration; public class ITSpeechTest { private static SpeechClient speechClient; - @Rule public Timeout globalTimeout = Timeout.seconds(300); + @Rule public Timeout globalTimeout = Timeout.seconds(1000); @BeforeClass public static void setupClass() throws Exception { + SpeechSettings.Builder settingsBuilder = SpeechSettings.newBuilder(); + settingsBuilder.longRunningRecognizeSettings() + .setRetrySettings(RetrySettings.newBuilder() + .setRetryDelayMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMinutes(10)) + .setInitialRetryDelay(Duration.ofSeconds(5)) + .setMaxAttempts(5) + .setMaxRetryDelay(Duration.ofSeconds(5)) + .build()); speechClient = SpeechClient.create(); } From 3d90a343eeca1e4a8e2430ced51030e15a084a07 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 3 Mar 2023 18:51:34 +0000 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- java-speech/README.md | 2 -- .../cloud/speech/v1/it/ITSpeechTest.java | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/java-speech/README.md b/java-speech/README.md index 72ed0cfd190e..ab504e652438 100644 --- a/java-speech/README.md +++ b/java-speech/README.md @@ -14,7 +14,6 @@ Java idiomatic client for [Cloud Speech][product-docs]. If you are using Maven, add this to your pom.xml file: - ```xml @@ -35,7 +34,6 @@ If you are using SBT, add this to your dependencies: ```Scala libraryDependencies += "com.google.cloud" % "google-cloud-speech" % "4.7.0" ``` - ## Authentication diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java index bd3f4f1dccb8..c3be2f3f1604 100644 --- a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java @@ -45,14 +45,16 @@ public class ITSpeechTest { @BeforeClass public static void setupClass() throws Exception { SpeechSettings.Builder settingsBuilder = SpeechSettings.newBuilder(); - settingsBuilder.longRunningRecognizeSettings() - .setRetrySettings(RetrySettings.newBuilder() - .setRetryDelayMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMinutes(10)) - .setInitialRetryDelay(Duration.ofSeconds(5)) - .setMaxAttempts(5) - .setMaxRetryDelay(Duration.ofSeconds(5)) - .build()); + settingsBuilder + .longRunningRecognizeSettings() + .setRetrySettings( + RetrySettings.newBuilder() + .setRetryDelayMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMinutes(10)) + .setInitialRetryDelay(Duration.ofSeconds(5)) + .setMaxAttempts(5) + .setMaxRetryDelay(Duration.ofSeconds(5)) + .build()); speechClient = SpeechClient.create(); } From f7303a4d27f52faf0afbc766ad53691f26051489 Mon Sep 17 00:00:00 2001 From: Diego Alonso Marquez Palacios Date: Fri, 3 Mar 2023 13:59:38 -0500 Subject: [PATCH 3/8] fix: add settings to client builder --- .../test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java index bd3f4f1dccb8..df80d0d5c95a 100644 --- a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java @@ -53,7 +53,7 @@ public static void setupClass() throws Exception { .setMaxAttempts(5) .setMaxRetryDelay(Duration.ofSeconds(5)) .build()); - speechClient = SpeechClient.create(); + speechClient = SpeechClient.create(settingsBuilder.build()); } @AfterClass From 33984968c122b998f32bd5cc6c22da48b0210775 Mon Sep 17 00:00:00 2001 From: Diego Alonso Marquez Palacios Date: Fri, 3 Mar 2023 14:10:49 -0500 Subject: [PATCH 4/8] chore: mvn format --- .../cloud/speech/v1/it/ITSpeechTest.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java index df80d0d5c95a..497e67308b1e 100644 --- a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java @@ -45,14 +45,16 @@ public class ITSpeechTest { @BeforeClass public static void setupClass() throws Exception { SpeechSettings.Builder settingsBuilder = SpeechSettings.newBuilder(); - settingsBuilder.longRunningRecognizeSettings() - .setRetrySettings(RetrySettings.newBuilder() - .setRetryDelayMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMinutes(10)) - .setInitialRetryDelay(Duration.ofSeconds(5)) - .setMaxAttempts(5) - .setMaxRetryDelay(Duration.ofSeconds(5)) - .build()); + settingsBuilder + .longRunningRecognizeSettings() + .setRetrySettings( + RetrySettings.newBuilder() + .setRetryDelayMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMinutes(10)) + .setInitialRetryDelay(Duration.ofSeconds(5)) + .setMaxAttempts(5) + .setMaxRetryDelay(Duration.ofSeconds(5)) + .build()); speechClient = SpeechClient.create(settingsBuilder.build()); } From cf3e9a1487ec7c1e5d774b2140f2a61a1728db7a Mon Sep 17 00:00:00 2001 From: Diego Alonso Marquez Palacios Date: Fri, 3 Mar 2023 14:27:51 -0500 Subject: [PATCH 5/8] chore: use approach suggested in - --- .../cloud/speech/v1/it/ITSpeechTest.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java index 497e67308b1e..d10786010bf8 100644 --- a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java @@ -16,7 +16,9 @@ package com.google.cloud.speech.v1.it; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.retrying.TimedRetryAlgorithm; import com.google.api.gax.rpc.ApiStreamObserver; import com.google.cloud.speech.v1.LongRunningRecognizeResponse; import com.google.cloud.speech.v1.RecognitionAudio; @@ -44,17 +46,22 @@ public class ITSpeechTest { @BeforeClass public static void setupClass() throws Exception { - SpeechSettings.Builder settingsBuilder = SpeechSettings.newBuilder(); - settingsBuilder - .longRunningRecognizeSettings() - .setRetrySettings( + TimedRetryAlgorithm timedRetryAlgorithm = + OperationTimedPollAlgorithm.create( + // These values are copied from com.google.cloud.speech.v1.stub.SpeechStubSettings... RetrySettings.newBuilder() - .setRetryDelayMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMinutes(10)) - .setInitialRetryDelay(Duration.ofSeconds(5)) - .setMaxAttempts(5) - .setMaxRetryDelay(Duration.ofSeconds(5)) + .setInitialRetryDelay(Duration.ofMillis(500L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(5000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofDays(1)) .build()); + SpeechSettings.Builder settingsBuilder = SpeechSettings.newBuilder(); + settingsBuilder + .longRunningRecognizeOperationSettings() + .setPollingAlgorithm(timedRetryAlgorithm); speechClient = SpeechClient.create(settingsBuilder.build()); } From fd71308487f953b43532f2bc47ee6e22329ffa47 Mon Sep 17 00:00:00 2001 From: Diego Alonso Marquez Palacios Date: Fri, 3 Mar 2023 14:48:31 -0500 Subject: [PATCH 6/8] chore: use reasonable timeout --- .../test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java index d10786010bf8..234541b9b476 100644 --- a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java @@ -56,7 +56,7 @@ public static void setupClass() throws Exception { .setInitialRpcTimeout(Duration.ZERO) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ZERO) - .setTotalTimeout(Duration.ofDays(1)) + .setTotalTimeout(Duration.ofHours(1)) .build()); SpeechSettings.Builder settingsBuilder = SpeechSettings.newBuilder(); settingsBuilder From 16724c1cd82c846a8353d4c29ff4a47bc3a23aed Mon Sep 17 00:00:00 2001 From: Diego Alonso Marquez Palacios Date: Fri, 3 Mar 2023 14:51:13 -0500 Subject: [PATCH 7/8] chore: use 10 min timeout --- .../test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java index 234541b9b476..d28277c7c551 100644 --- a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java @@ -56,7 +56,7 @@ public static void setupClass() throws Exception { .setInitialRpcTimeout(Duration.ZERO) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ZERO) - .setTotalTimeout(Duration.ofHours(1)) + .setTotalTimeout(Duration.ofMinutes(10)) .build()); SpeechSettings.Builder settingsBuilder = SpeechSettings.newBuilder(); settingsBuilder From a0605197fef2685587c38c09b22a359eb8dd0615 Mon Sep 17 00:00:00 2001 From: Diego Alonso Marquez Palacios Date: Fri, 3 Mar 2023 17:56:09 -0500 Subject: [PATCH 8/8] fix: import `SpeechSettings` --- .../test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java index d28277c7c551..a5ec67401e7d 100644 --- a/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java +++ b/java-speech/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/it/ITSpeechTest.java @@ -25,6 +25,7 @@ import com.google.cloud.speech.v1.RecognitionConfig; import com.google.cloud.speech.v1.RecognizeResponse; import com.google.cloud.speech.v1.SpeechClient; +import com.google.cloud.speech.v1.SpeechSettings; import com.google.cloud.speech.v1.StreamingRecognitionConfig; import com.google.cloud.speech.v1.StreamingRecognizeRequest; import com.google.cloud.speech.v1.StreamingRecognizeResponse;