@@ -39,7 +39,26 @@ mobileGamingCommands = new MobileGamingCommands(testScripts: t, testRunId: UUID.
3939
4040t. intent(" Running: UserScore example with Beam GCP BOM on DataflowRunner" )
4141t. 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"
4362t. see " total_score: 231, user: user19_BananaWallaby" , command_output_text
4463t. success(" UserScore successfully run on DataflowRunner." )
4564t. run " gsutil rm gs://${ t.gcsBucket()} /${ mobileGamingCommands.getUserScoreOutputName(runner)} *"
@@ -53,7 +72,24 @@ mobileGamingCommands = new MobileGamingCommands(testScripts: t, testRunId: UUID.
5372
5473t. intent(" Running: HourlyTeamScore example with Beam GCP BOM on DataflowRunner" )
5574t. 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 "
5793t. see " total_score: 2788, team: AzureBilby" , command_output_text
5894t. success(" HourlyTeamScore successfully run on DataflowRunner." )
5995t. run " gsutil rm gs://${ t.gcsBucket()} /${ mobileGamingCommands.getHourlyTeamScoreOutputName(runner)} *"
0 commit comments