From aff5846768da9768a1ed77e9fc5aa9606cbb3a01 Mon Sep 17 00:00:00 2001 From: dl239 Date: Tue, 12 Sep 2023 15:58:04 +0800 Subject: [PATCH] fix: download spark if needed (#3459) --- release/sbin/deploy-all.sh | 41 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/release/sbin/deploy-all.sh b/release/sbin/deploy-all.sh index f665810f7e4..3a4f101b15b 100755 --- a/release/sbin/deploy-all.sh +++ b/release/sbin/deploy-all.sh @@ -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}')