craigcondit commented on code in PR #553:
URL: https://github.com/apache/yunikorn-k8shim/pull/553#discussion_r1153684465


##########
scripts/run-e2e-tests.sh:
##########
@@ -101,14 +101,24 @@ function install_kind() {
 }
 
 function install_spark() {
-  check_cmd "wget"
-  wget -qO-  
https://archive.apache.org/dist/spark/spark-3.3.1/spark-3.3.1-bin-hadoop3.tgz | 
tar xzvf - && chmod +x spark-3.3.1-bin-hadoop3 && sudo mv 
spark-3.3.1-bin-hadoop3 /opt/.
-  exit_on_error "install spark failed."
-  sudo ln -s /opt/spark-3.3.1-bin-hadoop3 /opt/spark
-  exit_on_error "install spark failed. unable to create symlink"
-  export SPARK_HOME=/opt/spark/
-  export SPARK_PYTHON_IMAGE=docker.io/apache/spark-py:v3.3.1
+  CURRENT=$(pwd)
+  SPARK_VERSION="3.3.1"
+  DOWNLOAD="${CURRENT}/_spark"
+  SPARK_SUBMIT_CMD="${DOWNLOAD}/spark/bin/spark-submit"

Review Comment:
   Set this to 
"${DOWNLOAD}/spark-${SPARK_VERSION}-bin-hadoop3/bin/spark-submit", then you 
don't have to move the archive, and you can properly detect if this needs a new 
version installed (for example to move to 3.3.2). In that case, the test will 
succeed, even though the wrong version of spark is downloaded. If you use the 
fully-qualitifed path, the expected version will not exist, and we will 
re-download as expected.



##########
scripts/run-e2e-tests.sh:
##########
@@ -101,14 +101,24 @@ function install_kind() {
 }
 
 function install_spark() {
-  check_cmd "wget"
-  wget -qO-  
https://archive.apache.org/dist/spark/spark-3.3.1/spark-3.3.1-bin-hadoop3.tgz | 
tar xzvf - && chmod +x spark-3.3.1-bin-hadoop3 && sudo mv 
spark-3.3.1-bin-hadoop3 /opt/.
-  exit_on_error "install spark failed."
-  sudo ln -s /opt/spark-3.3.1-bin-hadoop3 /opt/spark
-  exit_on_error "install spark failed. unable to create symlink"
-  export SPARK_HOME=/opt/spark/
-  export SPARK_PYTHON_IMAGE=docker.io/apache/spark-py:v3.3.1
+  CURRENT=$(pwd)
+  SPARK_VERSION="3.3.1"
+  DOWNLOAD="${CURRENT}/_spark"
+  SPARK_SUBMIT_CMD="${DOWNLOAD}/spark/bin/spark-submit"
+  if [[ ! -d "${DOWNLOAD}" || ! -f "${SPARK_SUBMIT_CMD}" ]]; then
+    echo  "Installing spark in yunikorn rep."
+    rm -rf "${DOWNLOAD}"
+    mkdir "${DOWNLOAD}" \
+      && cd "${DOWNLOAD}" \
+      && curl 
"https://archive.apache.org/dist/spark/spark-${SPARK_VERSION}/spark-${SPARK_VERSION}-bin-hadoop3.tgz";
 | tar xzvf - \
+      && mv "spark-${SPARK_VERSION}-bin-hadoop3" spark \

Review Comment:
   Don't move the downloaded dir, just use it as-is.



##########
scripts/run-e2e-tests.sh:
##########
@@ -101,14 +101,24 @@ function install_kind() {
 }
 
 function install_spark() {
-  check_cmd "wget"
-  wget -qO-  
https://archive.apache.org/dist/spark/spark-3.3.1/spark-3.3.1-bin-hadoop3.tgz | 
tar xzvf - && chmod +x spark-3.3.1-bin-hadoop3 && sudo mv 
spark-3.3.1-bin-hadoop3 /opt/.
-  exit_on_error "install spark failed."
-  sudo ln -s /opt/spark-3.3.1-bin-hadoop3 /opt/spark
-  exit_on_error "install spark failed. unable to create symlink"
-  export SPARK_HOME=/opt/spark/
-  export SPARK_PYTHON_IMAGE=docker.io/apache/spark-py:v3.3.1
+  CURRENT=$(pwd)
+  SPARK_VERSION="3.3.1"
+  DOWNLOAD="${CURRENT}/_spark"
+  SPARK_SUBMIT_CMD="${DOWNLOAD}/spark/bin/spark-submit"
+  if [[ ! -d "${DOWNLOAD}" || ! -f "${SPARK_SUBMIT_CMD}" ]]; then
+    echo  "Installing spark in yunikorn rep."
+    rm -rf "${DOWNLOAD}"
+    mkdir "${DOWNLOAD}" \
+      && cd "${DOWNLOAD}" \
+      && curl 
"https://archive.apache.org/dist/spark/spark-${SPARK_VERSION}/spark-${SPARK_VERSION}-bin-hadoop3.tgz";
 | tar xzvf - \
+      && mv "spark-${SPARK_VERSION}-bin-hadoop3" spark \
+      && chmod +x spark
+    exit_on_error "install spark failed."
+  fi
+  export SPARK_HOME="${DOWNLOAD}/spark"

Review Comment:
   Set this to "${DOWNLOAD}/spark-${SPARK_VERSION}-bin-hadoop3"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to