cc_staff
505
edits
No edit summary |
|||
Line 30: | Line 30: | ||
export SPARK_IDENT_STRING=$SLURM_JOBID | export SPARK_IDENT_STRING=$SLURM_JOBID | ||
export SPARK_WORKER_DIR=$SLURM_TMPDIR | export SPARK_WORKER_DIR=$SLURM_TMPDIR | ||
start-master.sh | start-master.sh | ||
sleep 1 | |||
MASTER_URL=$(grep -Po '(?=spark://).*' $SPARK_LOG_DIR/spark-${SPARK_IDENT_STRING}-org.apache.spark.deploy.master*.out) | |||
( | NWORKERS=$((SLURM_NTASKS - 1)) | ||
SPARK_NO_DAEMONIZE=1 srun -n ${NWORKERS} -N ${NWORKERS} --label --output=$SPARK_LOG_DIR/spark-%j-workers.out start-slave.sh -m ${SLURM_MEM_PER_NODE}M -c ${SLURM_CPUS_PER_TASK} ${MASTER_URL} & | |||
slaves_pid=$! | |||
spark-submit --master | SLURM_SPARK_SUBMIT="srun -n 1 -N 1 spark-submit --master ${MASTER_URL} --executor-memory ${SLURM_MEM_PER_NODE}M" | ||
$SLURM_SPARK_SUBMIT --class org.apache.spark.examples.SparkPi $SPARK_HOME/examples/jars/spark-examples_2.11-2.2.0.jar 1000 | |||
$SLURM_SPARK_SUBMIT --class org.apache.spark.examples.SparkLR $SPARK_HOME/examples/jars/spark-examples_2.11-2.2.0.jar 1000 | |||
kill $slaves_pid | |||
stop-master.sh | stop-master.sh | ||
}} | }} |