Last active
November 16, 2017 15:42
-
-
Save somyamohanty/b4a407942742226391cf9d93ce9e3f7f to your computer and use it in GitHub Desktop.
This file contains 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
echo '>> Start of Script' | |
nodes=($( cat $PBS_NODEFILE | sort | uniq )) | |
nnodes=${#nodes[@]} | |
last=$(( $nnodes - 1 )) | |
export SPARK_HOME=/work/{user}/sparktest/spark/ | |
ssh ${nodes[0]} "cd ${SPARK_HOME}; ./sbin/start-master.sh" | |
sparkmaster="spark://${nodes[0]}:7077" | |
echo 'master created' | |
for i in $( seq 0 $last ) | |
do | |
ssh ${nodes[$i]} "cd ${SPARK_HOME}; nohup ./sbin/start-slave ${sparkmaster} &> /work/{user}/sparktest/testSucess/nohup-${nodes[$i]}.out" & | |
done | |
echo 'Worker Started' | |
${SPARK_HOME}/bin/spark-submit /work/{user}/sparktest/testSucess/sparkscript.py | |
echo 'application submitted' | |
echo ${nnodes[0]} | |
ssh ${nodes[0]} " cd ${SPARK_HOME}; ./sbin/stop-master.sh" | |
for i in $( seq 0 $last ) | |
do | |
ssh ${nodes[$i]} "cd ${SPARK_HOME}; ./sbin/stop-slaves.sh" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment