skonto commented on a change in pull request #25229: [SPARK-27900][K8s] Add jvm 
oom flag
URL: https://github.com/apache/spark/pull/25229#discussion_r308942384
 
 

 ##########
 File path: 
resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh
 ##########
 @@ -60,14 +60,44 @@ if ! [ -z ${HADOOP_CONF_DIR+x} ]; then
   SPARK_CLASSPATH="$HADOOP_CONF_DIR:$SPARK_CLASSPATH";
 fi
 
+IGNORE_DEFAULT_DRIVER_JVM_OPTIONS=${IGNORE_DEFAULT_DRIVER_JVM_OPTIONS:-false}
+DRIVER_VERBOSE=${DRIVER_VERBOSE:-false}
+
+function get_verbose_flag()
+{
+  if [[ $DRIVER_VERBOSE == "true" ]]; then
+    echo "--verbose"
+  else
+    echo ""
+  fi
+}
+
+function get_args_with_defaults()
+{
+  if [[ $IGNORE_DEFAULT_DRIVER_JVM_OPTIONS == "true" ]]; then
+    echo "$@"
+  else
+    if grep -q "spark.driver.extraJavaOptions" 
"/opt/spark/conf/spark.properties"; then
+      sed 's/spark.driver.extraJavaOptions=/&-XX:OnOutOfMemoryError="kill -9 
%p" /g' /opt/spark/conf/spark.properties > /tmp/spark.properties
+    else
+      cp /opt/spark/conf/spark.properties /tmp/spark.properties
+      echo 'spark.driver.extraJavaOptions=-XX:OnOutOfMemoryError="kill -9 %p"' 
>> /tmp/spark.properties
+    fi
+     echo "$@" | sed  's|/opt/spark/conf/spark.properties 
|/tmp/spark.properties |g'
+  fi
+}
+
 case "$1" in
   driver)
     shift 1
+    DRIVER_ARGS=$(get_args_with_defaults "$@")
+    VERBOSE_FLAG=$(get_verbose_flag)
 
 Review comment:
   We use this flag so in the tests we can detect what properties we get. Also 
it it useful in general users want to debug Spark.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to