You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dongjoon-hyun (via GitHub)" <gi...@apache.org> on 2024/01/25 22:57:55 UTC

[PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

dongjoon-hyun opened a new pull request, #44888:
URL: https://github.com/apache/spark/pull/44888

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'core/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   <!--
   If generative AI tooling has been used in the process of authoring this patch, please include the
   phrase: 'Generated-by: ' followed by the name of the tool and its version.
   If no, write 'No'.
   Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
   -->
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467169645


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {

Review Comment:
   Do we need to include this in the try-catch block below as well?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467172245


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {
+      normalizedLogDir.listFiles.map(_.getName).filter(_.endsWith(".out"))
+        .headOption.getOrElse(logType)

Review Comment:
   It seems inappropriate to always peek the head option as we support multiple `$instance`s on a single machine.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #44888: [SPARK-46868][CORE] Support Spark Worker Log UI
URL: https://github.com/apache/spark/pull/44888


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467174600


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {
+      normalizedLogDir.listFiles.map(_.getName).filter(_.endsWith(".out"))
+        .headOption.getOrElse(logType)

Review Comment:
   Ya, that's a possible configuration, but this PR is supposed to be used with an explicitly user-given `SPARK_LOG_DIR`, @yaooqinn . In addition, in these day, Spark Standalone cluster is running on top of K8s environment. I believe we can clarify the assumption during documentation, @yaooqinn .



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467142193


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {
+      normalizedLogDir.listFiles.map(_.getName).filter(_.endsWith(".out"))
+        .headOption.getOrElse(logType)

Review Comment:
   Yes, all Spark deamon's log file follows that.
   
   https://github.com/apache/spark/blob/25df5dad67610357287bef075ee755c59acdb904/sbin/spark-daemon.sh#L125



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467170559


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {

Review Comment:
   `normalizedLogDir.listFiles`?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467172845


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {

Review Comment:
   yes



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467155336


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -60,16 +63,19 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
     val appId = Option(request.getParameter("appId"))
     val executorId = Option(request.getParameter("executorId"))
     val driverId = Option(request.getParameter("driverId"))
+    val self = Option(request.getParameter("self"))
     val logType = request.getParameter("logType")
     val offset = Option(request.getParameter("offset")).map(_.toLong)
     val byteLength = Option(request.getParameter("byteLength")).map(_.toInt)
       .getOrElse(defaultBytes)
 
-    val (logDir, params, pageName) = (appId, executorId, driverId) match {
-      case (Some(a), Some(e), None) =>
+    val (logDir, params, pageName) = (appId, executorId, driverId, self) match {
+      case (Some(a), Some(e), None, None) =>
         (s"${workDir.getPath}/$a/$e/", s"appId=$a&executorId=$e", s"$a/$e")
-      case (None, None, Some(d)) =>
+      case (None, None, Some(d), None) =>
         (s"${workDir.getPath}/$d/", s"driverId=$d", d)
+      case (None, None, None, Some(_)) =>
+        (s"${sys.env.getOrElse("SPARK_LOG_DIR", workDir.getPath)}/", "self", "")

Review Comment:
   This is fixed.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467128281


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {
+      normalizedLogDir.listFiles.map(_.getName).filter(_.endsWith(".out"))
+        .headOption.getOrElse(logType)

Review Comment:
   What the "out" file is? Is it Worker's log fille?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467180112


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {
+      normalizedLogDir.listFiles.map(_.getName).filter(_.endsWith(".out"))
+        .headOption.getOrElse(logType)

Review Comment:
   I agree with you that `SPARK_LOG_DIR` for each or being isolated by Kubernetes does solve the issue. However, exporting `SPARK_LOG_DIR` system or session-wide may still pose problems. Besides standalone clusters, I am wondering the local-cluster mode I use extensively for dev might also have such an issue.
   
   
   
   



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467141790


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -60,16 +63,19 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
     val appId = Option(request.getParameter("appId"))
     val executorId = Option(request.getParameter("executorId"))
     val driverId = Option(request.getParameter("driverId"))
+    val self = Option(request.getParameter("self"))
     val logType = request.getParameter("logType")
     val offset = Option(request.getParameter("offset")).map(_.toLong)
     val byteLength = Option(request.getParameter("byteLength")).map(_.toInt)
       .getOrElse(defaultBytes)
 
-    val (logDir, params, pageName) = (appId, executorId, driverId) match {
-      case (Some(a), Some(e), None) =>
+    val (logDir, params, pageName) = (appId, executorId, driverId, self) match {
+      case (Some(a), Some(e), None, None) =>
         (s"${workDir.getPath}/$a/$e/", s"appId=$a&executorId=$e", s"$a/$e")
-      case (None, None, Some(d)) =>
+      case (None, None, Some(d), None) =>
         (s"${workDir.getPath}/$d/", s"driverId=$d", d)
+      case (None, None, None, Some(_)) =>
+        (s"${sys.env.getOrElse("SPARK_LOG_DIR", workDir.getPath)}/", "self", "")

Review Comment:
   Thanks. let me check.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467172245


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {
+      normalizedLogDir.listFiles.map(_.getName).filter(_.endsWith(".out"))
+        .headOption.getOrElse(logType)

Review Comment:
   It seems inappropriate to always peek the head as we support multiple `$instance`s on a single machine.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #44888:
URL: https://github.com/apache/spark/pull/44888#issuecomment-1911404775

   Thank you, @viirya and @yaooqinn .


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #44888:
URL: https://github.com/apache/spark/pull/44888#issuecomment-1911291486

   Thank you, @viirya . The PR description (screenshot) and code is updated.
   Now, it shows `out log page for worker`.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467173511


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {

Review Comment:
   Got it. Let me move.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467182297


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {
+      normalizedLogDir.listFiles.map(_.getName).filter(_.endsWith(".out"))
+        .headOption.getOrElse(logType)

Review Comment:
   > - `SPARK_WORKER_INSTANCES` is deprecated in Standalone mode. It's recommended to launch multiple executors in one worker and launch one worker per node instead of launching multiple workers per node and launching one executor per worker.
   
   I found this statement. I agree w/ you that we doc this. @dongjoon-hyun 



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467175060


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {
+      normalizedLogDir.listFiles.map(_.getName).filter(_.endsWith(".out"))
+        .headOption.getOrElse(logType)

Review Comment:
   To be clear, historically, spark worker log is generated outside `work` directory for security reasons. So, it means we should not expose it without human guiadance.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467192425


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {
+      normalizedLogDir.listFiles.map(_.getName).filter(_.endsWith(".out"))
+        .headOption.getOrElse(logType)

Review Comment:
   Thank you!



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467127987


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -60,16 +63,19 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
     val appId = Option(request.getParameter("appId"))
     val executorId = Option(request.getParameter("executorId"))
     val driverId = Option(request.getParameter("driverId"))
+    val self = Option(request.getParameter("self"))
     val logType = request.getParameter("logType")
     val offset = Option(request.getParameter("offset")).map(_.toLong)
     val byteLength = Option(request.getParameter("byteLength")).map(_.toInt)
       .getOrElse(defaultBytes)
 
-    val (logDir, params, pageName) = (appId, executorId, driverId) match {
-      case (Some(a), Some(e), None) =>
+    val (logDir, params, pageName) = (appId, executorId, driverId, self) match {
+      case (Some(a), Some(e), None, None) =>
         (s"${workDir.getPath}/$a/$e/", s"appId=$a&executorId=$e", s"$a/$e")
-      case (None, None, Some(d)) =>
+      case (None, None, Some(d), None) =>
         (s"${workDir.getPath}/$d/", s"driverId=$d", d)
+      case (None, None, None, Some(_)) =>
+        (s"${sys.env.getOrElse("SPARK_LOG_DIR", workDir.getPath)}/", "self", "")

Review Comment:
   Assign "" to `pageName` may produce a weird page title "...  log page for "?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46868][CORE] Support Spark Worker Log UI [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #44888:
URL: https://github.com/apache/spark/pull/44888#discussion_r1467170335


##########
core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala:
##########
@@ -137,8 +143,16 @@ private[ui] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") with
       return ("Error: invalid log directory " + logDirectory, 0, 0, 0)
     }
 
+    // Find a log file name
+    val fileName = if (logType.equals("out")) {

Review Comment:
   Which part are you worrying, @yaooqinn ?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org