Skip to content

Latest commit

 

History

History
140 lines (100 loc) · 4.47 KB

beam_example_game.md

File metadata and controls

140 lines (100 loc) · 4.47 KB

Reference link

wordcount

Generate pom

mvn archetype:generate \
      -DarchetypeGroupId=org.apache.beam \
      -DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
      -DarchetypeVersion=2.21.0 \
      -DgroupId=org.example \
      -DartifactId=word-count-beam \
      -Dversion="0.1" \
      -Dpackage=org.apache.beam.examples \
      -DinteractiveMode=false

Run WordCount

mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.WordCount \
     -Dexec.args="--inputFile=input_1.txt --output=counts" -Pdirect-runner

Test

more counts*

Run MinimalWordCount

mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.MinimalWordCount

Game

Generate pom

mvn archetype:generate \
      -DarchetypeGroupId=org.apache.beam \
      -DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
      -DarchetypeVersion=2.21.0 \
      -DgroupId=org.example \
      -DartifactId=word-count-beam \
      -Dversion="0.1" \
      -Dpackage=org.apache.beam.examples \
      -DinteractiveMode=false

Generate beamgame.txt in local

mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.complete.game.injector.Injector -Dexec.args="beamgame none beamgame.txt"

UserScore

mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.complete.game.UserScore -Dexec.args="--output=userscore" -Pdirect-runner
cat userscore-0000* > userscore-total
sort -rn -t $'\t' -k2,2rn userscore-total

HourlyTeamScore

mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.complete.game.HourlyTeamScore -Dexec.args="--output=userscorehourly" -Pdirect-runner

LeaderBoard

steps:

mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.complete.game.injector.Injector -Dexec.args="constant-jigsaw-272415 beamgame none"

// * Injector <project-name> <topic-name> none
// Injector constant-jigsaw-272415 beamgame none

// delete topic
gcloud pubsub subscriptions seek projects/constant-jigsaw-272415/topics/beamgame --time=$(date +%Y-%m-%dT%H:%M:%S) 
// some modification to make it running slower
  // QPS ranges from 800 to 1000.
  private static final int MIN_QPS = 80;
  private static final int QPS_RANGE = 20;
  // How long to sleep, in ms, between creation of the threads that make API requests to PubSub.
  private static final int THREAD_SLEEP_MS = 5000;
mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.complete.game.LeaderBoard -Dexec.args="--project=constant-jigsaw-272415 --dataset=beamgame2 --topic=projects/constant-jigsaw-272415/topics/beamgame"

Result

dataflow_frances_perry_mobile_game

dataflow_frances_perry_mobile_game

Issue

  • Met following problem

dataflow_frances_perry_mobile_game

According to here

mvn clean