@@ -228,7 +228,7 @@ function cleanup_pubsub() {
228228# $2 - pid: the pid of running pipeline
229229# $3 - running_job (DataflowRunner only): the job id of streaming pipeline running on DataflowRunner
230230# ######################################
231- function verify_steaming_result () {
231+ function verify_streaming_result () {
232232 retry=3
233233 should_see=" Python: "
234234 while(( $retry > 0 )) ; do
@@ -295,9 +295,11 @@ function verify_user_score() {
295295function verify_hourly_team_score() {
296296 retry=3
297297 should_see=' AntiqueBrassPlatypus'
298+ runner=$1
299+
298300 while(( $retry >= 0 )) ; do
299301 if [[ $retry > 0 ]]; then
300- bq_pull_result=$( bq head -n 500 $DATASET .hourly_team_score_python_ $1 )
302+ bq_pull_result=$( bq head -n 500 ${ DATASET} . ${HOURLY_TEAM_SCORE_TABLE_PREFIX} _ ${runner} )
301303 if [[ $bq_pull_result = * " $should_see " * ]]; then
302304 echo " SUCCEED: hourly_team_score example successful run on $1 -runner"
303305 break
@@ -307,14 +309,38 @@ function verify_hourly_team_score() {
307309 sleep 15
308310 fi
309311 else
310- echo " FAILED: HourlyTeamScore example failed running on $1 - runner. \
311- Did not found scores of team $should_see in $DATASET .leader_board "
312+ echo " FAILED: HourlyTeamScore example failed running on $runner runner. \
313+ Did not found scores of team $should_see in ${ DATASET} . ${HOURLY_TEAM_SCORE_TABLE_PREFIX} _ ${runner} "
312314 complete " FAILED"
313315 exit 1
314316 fi
315317 done
316318}
317319
320+ function cleanup_hourly_team_score() {
321+ retry=3
322+ runner=$1
323+
324+ echo " Removing previously created table ${DATASET} .${HOURLY_TEAM_SCORE_TABLE_PREFIX} _${runner} ..."
325+ bq rm -q -f -t " ${DATASET} .${HOURLY_TEAM_SCORE_TABLE_PREFIX} _${runner} "
326+
327+ while(( $retry >= 0 )) ; do
328+ if [[ $retry > 0 ]]; then
329+ bq_ls_result=$( bq ls $DATASET )
330+ if [[ $bq_ls_result = * " ${HOURLY_TEAM_SCORE_TABLE_PREFIX} _${runner} " * ]]; then
331+ retry=$(( $retry - 1 ))
332+ echo " ${DATASET} .${HOURLY_TEAM_SCORE_TABLE_PREFIX} _${runner} not cleaned up yet, waiting"
333+ sleep 1000
334+ else
335+ echo " Confirmed ${DATASET} .${HOURLY_TEAM_SCORE_TABLE_PREFIX} _${runner} removed before running new test."
336+ break
337+ fi
338+ else
339+ echo " WARNING: Unable to clean up table ${DATASET} .${HOURLY_TEAM_SCORE_TABLE_PREFIX} _${runner} . \
340+ You may need to manually run 'bq rm -r -t ${DATASET} .${HOURLY_TEAM_SCORE_TABLE_PREFIX} _${runner} '."
341+ fi
342+ done
343+ }
318344
319345# Python RC configurations
320346VERSION=$( get_version)
@@ -336,4 +362,5 @@ PUBSUB_SUBSCRIPTION='wordstream-python-sub2'
336362# Mobile Gaming Configurations
337363DATASET=' beam_postrelease_mobile_gaming'
338364USERSCORE_OUTPUT_PREFIX=' python-userscore_result'
365+ HOURLY_TEAM_SCORE_TABLE_PREFIX=' hourly_team_score_python'
339366GAME_INPUT_DATA=' gs://dataflow-samples/game/5000_gaming_data.csv'
0 commit comments