|
||||
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 0020 # This script loads spark-env.sh if it exists, and ensures it is only loaded once. 0021 # spark-env.sh is loaded from SPARK_CONF_DIR if set, or within the current directory's 0022 # conf/ subdirectory. 0023 0024 # Figure out where Spark is installed 0025 if [ -z "${SPARK_HOME}" ]; then 0026 source "$(dirname "$0")"/find-spark-home 0027 fi 0028 0029 SPARK_ENV_SH="spark-env.sh" 0030 if [ -z "$SPARK_ENV_LOADED" ]; then 0031 export SPARK_ENV_LOADED=1 0032 0033 export SPARK_CONF_DIR="${SPARK_CONF_DIR:-"${SPARK_HOME}"/conf}" 0034 0035 SPARK_ENV_SH="${SPARK_CONF_DIR}/${SPARK_ENV_SH}" 0036 if [[ -f "${SPARK_ENV_SH}" ]]; then 0037 # Promote all variable declarations to environment (exported) variables 0038 set -a 0039 . ${SPARK_ENV_SH} 0040 set +a 0041 fi 0042 fi 0043 0044 # Setting SPARK_SCALA_VERSION if not already set. 0045 0046 # TODO: revisit for Scala 2.13 support 0047 export SPARK_SCALA_VERSION=2.12 0048 #if [ -z "$SPARK_SCALA_VERSION" ]; then 0049 # SCALA_VERSION_1=2.12 0050 # SCALA_VERSION_2=2.11 0051 # 0052 # ASSEMBLY_DIR_1="${SPARK_HOME}/assembly/target/scala-${SCALA_VERSION_1}" 0053 # ASSEMBLY_DIR_2="${SPARK_HOME}/assembly/target/scala-${SCALA_VERSION_2}" 0054 # ENV_VARIABLE_DOC="https://spark.apache.org/docs/latest/configuration.html#environment-variables" 0055 # if [[ -d "$ASSEMBLY_DIR_1" && -d "$ASSEMBLY_DIR_2" ]]; then 0056 # echo "Presence of build for multiple Scala versions detected ($ASSEMBLY_DIR_1 and $ASSEMBLY_DIR_2)." 1>&2 0057 # echo "Remove one of them or, export SPARK_SCALA_VERSION=$SCALA_VERSION_1 in ${SPARK_ENV_SH}." 1>&2 0058 # echo "Visit ${ENV_VARIABLE_DOC} for more details about setting environment variables in spark-env.sh." 1>&2 0059 # exit 1 0060 # fi 0061 # 0062 # if [[ -d "$ASSEMBLY_DIR_1" ]]; then 0063 # export SPARK_SCALA_VERSION=${SCALA_VERSION_1} 0064 # else 0065 # export SPARK_SCALA_VERSION=${SCALA_VERSION_2} 0066 # fi 0067 #fi
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |