Skip to content

Commit 60307b4

Browse files
authored
Fix PostRelease Nightly Snapshot job (#35079)
* Add retry loop * Remove typo
1 parent a2fc441 commit 60307b4

File tree

3 files changed

+95
-5
lines changed

3 files changed

+95
-5
lines changed

release/src/main/groovy/mobilegaming-java-dataflow.groovy

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,26 @@ mobileGamingCommands = new MobileGamingCommands(testScripts: t, testRunId: UUID.
3939

4040
t.intent("Running: UserScore example on DataflowRunner")
4141
t.run(mobileGamingCommands.createPipelineCommand("UserScore", runner))
42-
command_output_text = t.run "gsutil cat gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}* | grep user19_BananaWallaby"
42+
43+
int retries = 5
44+
int waitTime = 15 // seconds
45+
def outputPath = "gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}"
46+
def outputFound = false
47+
for (int i = 0; i < retries; i++) {
48+
def files = t.run("gsutil ls ${outputPath}*")
49+
if (files?.trim()) {
50+
outputFound = true
51+
break
52+
}
53+
t.intent("Output not found yet. Waiting ${waitTime}s...")
54+
Thread.sleep(waitTime * 1000)
55+
}
56+
57+
if (!outputFound) {
58+
throw new RuntimeException("No output files found for HourlyTeamScore after ${retries * waitTime} seconds.")
59+
}
60+
61+
command_output_text = t.run "gsutil cat ${outputPath}* | grep user19_BananaWallaby"
4362
t.see "total_score: 231, user: user19_BananaWallaby", command_output_text
4463
t.success("UserScore successfully run on DataflowRunner.")
4564
t.run "gsutil rm gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}*"
@@ -53,7 +72,24 @@ mobileGamingCommands = new MobileGamingCommands(testScripts: t, testRunId: UUID.
5372

5473
t.intent("Running: HourlyTeamScore example on DataflowRunner")
5574
t.run(mobileGamingCommands.createPipelineCommand("HourlyTeamScore", runner))
56-
command_output_text = t.run "gsutil cat gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}* | grep AzureBilby "
75+
76+
outputPath = "gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}"
77+
outputFound = false
78+
for (int i = 0; i < retries; i++) {
79+
def files = t.run("gsutil ls ${outputPath}*")
80+
if (files?.trim()) {
81+
outputFound = true
82+
break
83+
}
84+
t.intent("Output not found yet. Waiting ${waitTime}s...")
85+
Thread.sleep(waitTime * 1000)
86+
}
87+
88+
if (!outputFound) {
89+
throw new RuntimeException("No output files found for UserScore after ${retries * waitTime} seconds.")
90+
}
91+
92+
command_output_text = t.run "gsutil cat ${outputPath}* | grep AzureBilby "
5793
t.see "total_score: 2788, team: AzureBilby", command_output_text
5894
t.success("HourlyTeamScore successfully run on DataflowRunner.")
5995
t.run "gsutil rm gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}*"

release/src/main/groovy/mobilegaming-java-dataflowbom.groovy

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,26 @@ mobileGamingCommands = new MobileGamingCommands(testScripts: t, testRunId: UUID.
3939

4040
t.intent("Running: UserScore example with Beam GCP BOM on DataflowRunner")
4141
t.run(mobileGamingCommands.createPipelineCommand("UserScore", runner))
42-
command_output_text = t.run "gsutil cat gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}* | grep user19_BananaWallaby"
42+
43+
int retries = 5
44+
int waitTime = 15 // seconds
45+
def outputPath = "gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}"
46+
def outputFound = false
47+
for (int i = 0; i < retries; i++) {
48+
def files = t.run("gsutil ls ${outputPath}*")
49+
if (files?.trim()) {
50+
outputFound = true
51+
break
52+
}
53+
t.intent("Output not found yet. Waiting ${waitTime}s...")
54+
Thread.sleep(waitTime * 1000)
55+
}
56+
57+
if (!outputFound) {
58+
throw new RuntimeException("No output files found for UserScore after ${retries * waitTime} seconds.")
59+
}
60+
61+
command_output_text = t.run "gsutil cat ${outputPath}* | grep user19_BananaWallaby"
4362
t.see "total_score: 231, user: user19_BananaWallaby", command_output_text
4463
t.success("UserScore successfully run on DataflowRunner.")
4564
t.run "gsutil rm gs://${t.gcsBucket()}/${mobileGamingCommands.getUserScoreOutputName(runner)}*"
@@ -53,7 +72,24 @@ mobileGamingCommands = new MobileGamingCommands(testScripts: t, testRunId: UUID.
5372

5473
t.intent("Running: HourlyTeamScore example with Beam GCP BOM on DataflowRunner")
5574
t.run(mobileGamingCommands.createPipelineCommand("HourlyTeamScore", runner))
56-
command_output_text = t.run "gsutil cat gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}* | grep AzureBilby "
75+
76+
outputPath = "gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}"
77+
outputFound = false
78+
for (int i = 0; i < retries; i++) {
79+
def files = t.run("gsutil ls ${outputPath}*")
80+
if (files?.trim()) {
81+
outputFound = true
82+
break
83+
}
84+
t.intent("Output not found yet. Waiting ${waitTime}s...")
85+
Thread.sleep(waitTime * 1000)
86+
}
87+
88+
if (!outputFound) {
89+
throw new RuntimeException("No output files found for HourlyTeamScore after ${retries * waitTime} seconds.")
90+
}
91+
92+
command_output_text = t.run "gsutil cat ${outputPath}* | grep AzureBilby "
5793
t.see "total_score: 2788, team: AzureBilby", command_output_text
5894
t.success("HourlyTeamScore successfully run on DataflowRunner.")
5995
t.run "gsutil rm gs://${t.gcsBucket()}/${mobileGamingCommands.getHourlyTeamScoreOutputName(runner)}*"

release/src/main/groovy/quickstart-java-dataflow.groovy

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,26 @@ t.describe 'Run Apache Beam Java SDK Quickstart - Dataflow'
4949
--inputFile=gs://apache-beam-samples/shakespeare/*" \
5050
-Pdataflow-runner"""
5151

52+
int retries = 5
53+
int waitTime = 15 // seconds
54+
def outputPath = "gs://${t.gcsBucket()}/count"
55+
def outputFound = false
56+
for (int i = 0; i < retries; i++) {
57+
def files = t.run("gsutil ls ${outputPath}*")
58+
if (files?.trim()) {
59+
outputFound = true
60+
break
61+
}
62+
t.intent("Output not found yet. Waiting ${waitTime}s...")
63+
Thread.sleep(waitTime * 1000)
64+
}
65+
66+
if (!outputFound) {
67+
throw new RuntimeException("No output files found for WordCount after ${retries * waitTime} seconds.")
68+
}
69+
5270
// Verify wordcount text
53-
String result = t.run """gsutil cat gs://${t.gcsBucket()}/count* | grep Montague:"""
71+
String result = t.run """gsutil cat ${outputPath}* | grep Montague:"""
5472
t.see "Montague: 47", result
5573

5674
// Remove count files

0 commit comments

Comments
 (0)