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_r308951452
##########
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:
We cannot avoid sed if we want to make sure the default is always added.
Otherwise if we just add `spark.driver.extraJavaOptions` to CMD, user provided
`spark.driver.extraJavaOptions` will override it.
----------------------------------------------------------------
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]