warrenzhu25 commented on a change in pull request #34035:
URL: https://github.com/apache/spark/pull/34035#discussion_r715190296



##########
File path: 
resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh
##########
@@ -103,4 +103,14 @@ case "$1" in
 esac
 
 # Execute the container CMD under tini for better hygiene
-exec /usr/bin/tini -s -- "${CMD[@]}"
+if [ -z "$K8S_SPARK_LOG_PATH" ]; then
+  exec /usr/bin/tini -s -- "${CMD[@]}"
+else
+  if [ -n "$K8S_SPARK_LOG_PATH" ]; then
+    mkdir -p "$K8S_SPARK_LOG_PATH"
+  fi
+  # TODO: support custom stdout/stderr file name by spark config
+  K8S_SPARK_LOG_STDOUT=$K8S_SPARK_LOG_PATH/stdout
+  K8S_SPARK_LOG_STDERR=$K8S_SPARK_LOG_PATH/stderr
+  exec /usr/bin/tini -s -- "${CMD[@]}" > >(tee $K8S_SPARK_LOG_STDOUT) 2> >(tee 
$K8S_SPARK_LOG_STDERR >&2)

Review comment:
       Use tee can make stdout/stderr captured by kubectl logs.




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



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

Reply via email to