You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by vt...@apache.org on 2025/05/28 14:06:35 UTC
(beam) 01/01: Add retry loop
This is an automated email from the ASF dual-hosted git repository.
vterentev pushed a commit to branch fix-post-release-nightly
in repository https://gitbox.apache.org/repos/asf/beam.git
commit 83a27bcab808267a553cbf48c135fec318e2d57c
Author: Vitaly Terentyev <vi...@akvelon.com>
AuthorDate: Wed May 28 18:06:19 2025 +0400
Add retry loop
---
.../main/groovy/mobilegaming-java-dataflow.groovy | 40 ++++++++++++++++++++--
.../groovy/mobilegaming-java-dataflowbom.groovy | 40 ++++++++++++++++++++--
2 files changed, 76 insertions(+), 4 deletions(-)
diff --git a/release/src/main/groovy/mobilegaming-java-dataflow.groovy b/release/src/main/groovy/mobilegaming-java-dataflow.groovy
index 9ce93d31c14..a2164aa6a01 100644
--- a/release/src/main/groovy/mobilegaming-java-dataflow.groovy
+++ b/release/src/main/groovy/mobilegaming-java-dataflow.groovy
@@ -39,7 +39,26 @@ mobileGamingCommands = new MobileGamingCommands(testScripts: t, testRunId: UUID.
t.intent("Running: UserScore example on DataflowRunner")
t.run(mobileGamingCommands.createPipelineCommand("UserScore", runner))
-command_output_text = t.run "gsutil cat gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}* | grep user19_BananaWallaby"
+
+int retries = 5
+int waitTime = 15 // seconds
+def outputPath = "gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}"
+def outputFound = false
+for (int i = 0; i < retries; i++) {
+ def files = t.run("gsutil ls ${outputPath}*")
+ if (files?.trim()) {
+ outputFound = true
+ break
+ }
+ t.intent("Output not found yet. Waiting ${waitTime}s...")
+ Thread.sleep(waitTime * 1000)
+}
+
+if (!outputFound) {
+ throw new RuntimeException("No output files found for HourlyTeamScore after ${retries * waitTime} seconds.")
+}
+
+command_output_text = t.run "gsutil cat ${outputPath}* | grep user19_BananaWallaby"
t.see "total_score: 231, user: user19_BananaWallaby", command_output_text
t.success("UserScore successfully run on DataflowRunner.")
t.run "gsutil rm gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}*"
@@ -53,7 +72,24 @@ mobileGamingCommands = new MobileGamingCommands(testScripts: t, testRunId: UUID.
t.intent("Running: HourlyTeamScore example on DataflowRunner")
t.run(mobileGamingCommands.createPipelineCommand("HourlyTeamScore", runner))
-command_output_text = t.run "gsutil cat gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}* | grep AzureBilby "
+
+outputPath = "gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}"
+outputFound = false
+for (int i = 0; i < retries; i++) {
+ def files = t.run("gsutil ls ${outputPath}*")
+ if (files?.trim()) {
+ outputFound = true
+ break
+ }
+ t.intent("Output not found yet. Waiting ${waitTime}s...")
+ Thread.sleep(waitTime * 1000)
+}
+
+if (!outputFound) {
+ throw new RuntimeException("No output files found for UserScore after ${retries * waitTime} seconds.")
+}
+
+command_output_text = t.run "gsutil cat ${outputPath}* | grep AzureBilby "
t.see "total_score: 2788, team: AzureBilby", command_output_text
t.success("HourlyTeamScore successfully run on DataflowRunner.")
t.run "gsutil rm gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}*"
diff --git a/release/src/main/groovy/mobilegaming-java-dataflowbom.groovy b/release/src/main/groovy/mobilegaming-java-dataflowbom.groovy
index a0fd0f13c75..f1ec236c001 100644
--- a/release/src/main/groovy/mobilegaming-java-dataflowbom.groovy
+++ b/release/src/main/groovy/mobilegaming-java-dataflowbom.groovy
@@ -39,7 +39,26 @@ mobileGamingCommands = new MobileGamingCommands(testScripts: t, testRunId: UUID.
t.intent("Running: UserScore example with Beam GCP BOM on DataflowRunner")
t.run(mobileGamingCommands.createPipelineCommand("UserScore", runner))
-command_output_text = t.run "gsutil cat gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}* | grep user19_BananaWallaby"
+
+int retries = 5
+int waitTime = 15 // seconds
+def outputPath = "gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}"
+def outputFound = false
+for (int i = 0; i < retries; i++) {
+ def files = t.run("gsutil ls ${outputPath}*")
+ if (files?.trim()) {
+ outputFound = true
+ break
+ }
+ t.intent("Output not found yet. Waiting ${waitTime}s...")
+ Thread.sleep(waitTime * 1000)
+}
+
+if (!outputFound) {
+ throw new RuntimeException("No output files found for UserScore after ${retries * waitTime} seconds.")
+}
+
+command_output_text = t.run "gsutil cat ${outputPath}* | grep user19_BananaWallaby"
t.see "total_score: 231, user: user19_BananaWallaby", command_output_text
t.success("UserScore successfully run on DataflowRunner.")
t.run "gsutil rm gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}*"
@@ -53,7 +72,24 @@ mobileGamingCommands = new MobileGamingCommands(testScripts: t, testRunId: UUID.
t.intent("Running: HourlyTeamScore example with Beam GCP BOM on DataflowRunner")
t.run(mobileGamingCommands.createPipelineCommand("HourlyTeamScore", runner))
-command_output_text = t.run "gsutil cat gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}* | grep AzureBilby "
+
+outputPath = "gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}"
+outputFound = false
+for (int i = 0; i < retries; i++) {
+ def files = t.run("gsutil ls ${outputPath}*")
+ if (files?.trim()) {
+ outputFound = true
+ break
+ }
+ t.intent("Output not found yet. Waiting ${waitTime}s...")
+ Thread.sleep(waitTime * 1000)
+}
+
+if (!outputFound) {
+ throw new RuntimeException("No output files found for HourlyTeamScore after ${retries * waitTime} seconds.")
+}
+
+command_output_text = t.run "gsutil cat ${outputPath}}* | grep AzureBilby "
t.see "total_score: 2788, team: AzureBilby", command_output_text
t.success("HourlyTeamScore successfully run on DataflowRunner.")
t.run "gsutil rm gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}*"