Created
April 7, 2015 07:15
-
-
Save zapstar/519bd6b4401a074e1033 to your computer and use it in GitHub Desktop.
Run Spark Job by looking at the build File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # NOTE: Make sure we have $SPARK_HOME set... | |
| # Identify the build file | |
| BUILD_FILE=`ls *.sbt` | |
| # Find out the required variable from the build file | |
| PROJECT_NAME=`grep name $BUILD_FILE | cut -d" " -f 3- | sed -e 's/ /-/g' | awk '{ gsub(/"/, "", $0); print tolower($0) }'` | |
| SCALA_VERSION=`grep scalaVersion $BUILD_FILE | awk '{ gsub(/"/, "", $3); print $3 }' | rev | cut -d '.' -f 2- | rev` | |
| APP_VERSION=`grep version $BUILD_FILE | awk '{ gsub(/"/, "", $3); print $3 }'` | |
| # Start the Spark job | |
| $SPARK_HOME/bin/spark-submit --master local[4] --class "WordCount" target/scala-${SCALA_VERSION}/${PROJECT_NAME}_${SCALA_VERSION}-${APP_VERSION}.jar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment