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

 ##########
 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'
 
 Review comment:
   If you follow https://github.com/apache/spark/pull/25229/files#r310866032, 
the suggested behavior is the following. So, it seems that we don't need this 
complexity.
   > At (1), if spark.driver.extraJavaOptions has -XX:OnOutOfMemoryError=, it 
will supersede DEFAULT_DRIVER_JVM_OPTIONS because the last one is used.

----------------------------------------------------------------
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