[ 
https://issues.apache.org/jira/browse/BEAM-3840?focusedWorklogId=81687&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-81687
 ]

ASF GitHub Bot logged work on BEAM-3840:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Mar/18 20:27
            Start Date: 18/Mar/18 20:27
    Worklog Time Spent: 10m 
      Work Description: aaltay commented on a change in pull request #4853: 
[BEAM-3840] Get python mobile-gaming automating on core runners
URL: https://github.com/apache/beam/pull/4853#discussion_r175302327
 
 

 ##########
 File path: 
release/src/main/groovy/run_release_candidate_python_mobile_gaming.sh
 ##########
 @@ -0,0 +1,167 @@
+#!/bin/bash
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You under the Apache License, Version 2.0
+#    (the "License"); you may not use this file except in compliance with
+#    the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+
+#  This file will verify Apache/Beam release candidate python by following 
steps:
+#
+#  1. Create a new virtualenv and install the SDK
+#  2. Run UserScore examples with DirectRunner
+#  3. Run UserScore examples with DataflowRunner
+#  4. Run HourlyTeamScore on DirectRunner
+#  5. Run HourlyTeamScore on DataflowRunner
+#
+
+set -e
+set -v
+
+source release/src/main/groovy/python_release_automation_utils.sh
+
+complete() {
+    print_separator "Validation $1"
+    rm -rf $TMPDIR
+}
+
+verify_houly_team_score() {
+    # $1 runner type
+    retry=3
+    should_see='AntiqueBrassPlatypus'
+    while(( $retry >= 0 ))
+    do
+        if [[ $retry > 0 ]]
+        then
+            bq_pull_result=$(bq head -n 100 
$DATASET.hourly_team_score_python_$1)
+            if [[ $bq_pull_result = *"$should_see"* ]]
+            then
+                echo "SUCCEED: HourlyTeamScore example successful run on 
$1-runner"
+                break
+            else
+                retry=$(($retry-1))
+                echo "Did not find team scores, retry left: $retry"
+                sleep 15
+            fi
+        else
+            echo "FAILED: HourlyTeamScore example failed running on $1-runner. 
Did not found scores of team $should_see in $DATASET.leader_board"
+            complete "FAILED"
+            exit 1
+        fi
+    done
+}
+
+
+print_separator "Start Mobile Gaming Examples"
+echo "SDK version: $VERSION"
+
+TMPDIR=$(mktemp -d)
+echo $TMPDIR
+pushd $TMPDIR
+
+#
+# 1. Download files from RC staging location, install python sdk
+#
+
+wget $CANDIDATE_URL$BEAM_PYTHON_SDK
+print_separator "Creating new virtualenv and installing the SDK"
+virtualenv temp_virtualenv
+. temp_virtualenv/bin/activate
+gcloud_version=$(gcloud --version | head -1 | awk '{print $4}')
+if [[ "$gcloud_version" < "189" ]]
+then
+  update_gcloud
+fi
+pip install $BEAM_PYTHON_SDK[gcp]
+
+
+#
+# 2. Run UserScore with DirectRunner
+#
+
+print_separator "Running userscore example with DirectRunner"
+output_file_name="$USERSCORE_OUTPUT_PREFIX-direct-runner.txt"
+python -m apache_beam.examples.complete.game.user_score \
+--output=$output_file_name \
+--project=$PROJECT_ID \
+--dataset=$DATASET \
+--input=gs://$BUCKET_NAME/5000_gaming_data.csv
+if ls $output_file_name* 1> /dev/null 2>&1;
+then
+       echo "Found output file(s):"
+       ls $output_file_name*
+else
+       echo "ERROR: output file not found."
+       complete "failed when running userscore example with DirectRunner."
+       exit 1
+fi
+echo "SUCCEED: UserScore successfully run on DirectRunner."
+
+
+#
+# 3. Run UserScore with DataflowRunner
+#
+
+print_separator "Running userscore example with DataflowRunner"
+output_file_name="$USERSCORE_OUTPUT_PREFIX-dataflow-runner.txt"
+python -m apache_beam.examples.complete.game.user_score \
+--project=$PROJECT_ID \
+--runner=DataflowRunner \
+--temp_location=gs://$BUCKET_NAME/temp/ \
+--sdk_location=$BEAM_PYTHON_SDK \
+--input=gs://$BUCKET_NAME/5000_gaming_data.csv \
+--output=gs://$BUCKET_NAME/$output_file_name
+# verify results.
+userscore_output_in_gcs="gs://$BUCKET_NAME/$output_file_name"
+gcs_pull_result=$(gsutil ls gs://$BUCKET_NAME)
+if [[ $gcs_pull_result != *$userscore_output_in_gcs* ]]
 
 Review comment:
   Curious why this verification is not similar to `verify_houly_team_score` 
and is done in a common place. Other that using `ls` and `gsutil ls` they look 
similar.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 81687)
    Time Spent: 13h 20m  (was: 13h 10m)

> Get Python Mobile-Gaming Running on Core Runners
> ------------------------------------------------
>
>                 Key: BEAM-3840
>                 URL: https://issues.apache.org/jira/browse/BEAM-3840
>             Project: Beam
>          Issue Type: Sub-task
>          Components: examples-python
>    Affects Versions: 2.5.0
>            Reporter: yifan zou
>            Assignee: yifan zou
>            Priority: Major
>             Fix For: 2.5.0
>
>          Time Spent: 13h 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to