Back to home page

OSCL-LXR

 
 

    


0001 #!/usr/bin/env bash
0002 
0003 #
0004 # Licensed to the Apache Software Foundation (ASF) under one or more
0005 # contributor license agreements.  See the NOTICE file distributed with
0006 # this work for additional information regarding copyright ownership.
0007 # The ASF licenses this file to You under the Apache License, Version 2.0
0008 # (the "License"); you may not use this file except in compliance with
0009 # the License.  You may obtain a copy of the License at
0010 #
0011 #    http://www.apache.org/licenses/LICENSE-2.0
0012 #
0013 # Unless required by applicable law or agreed to in writing, software
0014 # distributed under the License is distributed on an "AS IS" BASIS,
0015 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 # See the License for the specific language governing permissions and
0017 # limitations under the License.
0018 #
0019 # Starts the Mesos Cluster Dispatcher on the machine this script is executed on.
0020 # The Mesos Cluster Dispatcher is responsible for launching the Mesos framework and
0021 # Rest server to handle driver requests for Mesos cluster mode.
0022 # Only one cluster dispatcher is needed per Mesos cluster.
0023 
0024 if [ -z "${SPARK_HOME}" ]; then
0025   export SPARK_HOME="$(cd "`dirname "$0"`"/..; pwd)"
0026 fi
0027 
0028 . "${SPARK_HOME}/sbin/spark-config.sh"
0029 
0030 . "${SPARK_HOME}/bin/load-spark-env.sh"
0031 
0032 if [ "$SPARK_MESOS_DISPATCHER_PORT" = "" ]; then
0033   SPARK_MESOS_DISPATCHER_PORT=7077
0034 fi
0035 
0036 if [ "$SPARK_MESOS_DISPATCHER_HOST" = "" ]; then
0037   case `uname` in
0038       (SunOS)
0039           SPARK_MESOS_DISPATCHER_HOST="`/usr/sbin/check-hostname | awk '{print $NF}'`"
0040           ;;
0041       (*)
0042           SPARK_MESOS_DISPATCHER_HOST="`hostname -f`"
0043           ;;
0044   esac
0045 fi
0046 
0047 if [ "$SPARK_MESOS_DISPATCHER_NUM" = "" ]; then
0048   SPARK_MESOS_DISPATCHER_NUM=1
0049 fi
0050 
0051 "${SPARK_HOME}/sbin"/spark-daemon.sh start org.apache.spark.deploy.mesos.MesosClusterDispatcher $SPARK_MESOS_DISPATCHER_NUM --host $SPARK_MESOS_DISPATCHER_HOST --port $SPARK_MESOS_DISPATCHER_PORT "$@"