Skip to content

Commit

Permalink
fix: download spark if needed (#3459)
Browse files Browse the repository at this point in the history
  • Loading branch information
dl239 authored Sep 12, 2023
1 parent 21f98d4 commit aff5846
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions release/sbin/deploy-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,30 +121,37 @@ do
done

# deploy openmldbspark
if [[ -z "${SPARK_HOME}" ]]; then
echo "[ERROR] SPARK_HOME is not set"
else
if [[ ! -e "${SPARK_HOME}" ]]; then
echo "Downloading openmldbspark..."
spark_name=spark-3.2.1-bin-openmldbspark
spark_tar="${spark_name}".tgz
if [[ -e "${spark_tar}" ]]; then
echo "Skip downloading openmldbspark as ${spark_tar} already exists"
function download_spark {
if [[ -z "${SPARK_HOME}" ]]; then
echo "[ERROR] SPARK_HOME is not set"
else
if [[ ! -e "${SPARK_HOME}" ]]; then
echo "Downloading openmldbspark..."
spark_name=spark-3.2.1-bin-openmldbspark
spark_tar="${spark_name}".tgz
if [[ -e "${spark_tar}" ]]; then
echo "Skip downloading openmldbspark as ${spark_tar} already exists"
else
url="https://github.com/4paradigm/spark/releases/download/v3.2.1-openmldb${OPENMLDB_VERSION}/${spark_tar}"
echo "Download spark from $url"
curl -SLo ${spark_tar} "$url"
fi
tar -xzf ${spark_tar}
ln -s "$(pwd)"/"${spark_name}" "${SPARK_HOME}"
else
url="https://github.com/4paradigm/spark/releases/download/v3.2.1-openmldb${OPENMLDB_VERSION}/${spark_tar}"
echo "Download spark from $url"
curl -SLo ${spark_tar} "$url"
echo "${SPARK_HOME} already exists. Skip deploy spark locally"
fi
tar -xzf ${spark_tar}
ln -s "$(pwd)"/"${spark_name}" "${SPARK_HOME}"
else
echo "${SPARK_HOME} already exists. Skip deploy spark locally"
fi
fi
}

# deploy taskmanagers
downloaded=false
for line in $(parse_host conf/hosts taskmanager)
do
if ! $downloaded; then
download_spark
downloaded=true
fi
host=$(echo "$line" | awk -F ' ' '{print $1}')
port=$(echo "$line" | awk -F ' ' '{print $2}')
dir=$(echo "$line" | awk -F ' ' '{print $3}')
Expand Down

0 comments on commit aff5846

Please sign in to comment.