#!/bin/bash # Copyright 2016 The MathWorks, Inc. if [ -n "$SPARK_HOME" ]; then spark_submit_name=$SPARK_HOME/bin/spark-submit echo Using SPARK_HOME: ${spark_submit_name} else echo "Cannot find Spark installed directory. Set the SPARK_HOME environment variable to a valid Spark installation folder and try again." exit 1 fi mcrRoot=$(dirname $(dirname $(readlink -e $0))) if [ $# -eq 1 -a "$1" == "-?" ]; then echo "Usage is: generatesparkjcpath [-o outputpath] [-" echo " -o outputpath- path to output, default is javaclasspath.txt" echo " -confdir- include HADOOP_CONF_DIR in javaclasspath.txt" exit fi majorVer=`$spark_submit_name --version 2>&1 | grep version | sed -e "s/.*version \([0-9]*\)\..*/\1/" | head -n 1` if [ "$majorVer" = "" ]; then echo Unable to determine spark major version exit fi $spark_submit_name --class com.mathworks.mlspark.createjcp.CreateJcp --master local[1] ${mcrRoot}/toolbox/compiler/mlspark/jars/${majorVer}.x/mlsubmit.jar $*