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 2023/10/10 03:05:57 UTC

[PR] [SPARK-45474][CORE] Support top-level filtering in MasterPage JSON API [spark]

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

   <!--
   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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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

   Thank you, @beliefer ~


-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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

   Thank you for review, @beliefer !


-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -210,22 +210,59 @@ private[deploy] object JsonProtocol {
    *         `status` status of the master,
    *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
    */
-  def writeMasterState(obj: MasterStateResponse): JObject = {
+  def writeMasterState(field: Option[String], obj: MasterStateResponse): JObject = {
     val aliveWorkers = obj.workers.filter(_.isAlive())
-    ("url" -> obj.uri) ~
-    ("workers" -> obj.workers.toList.map(writeWorkerInfo)) ~
-    ("aliveworkers" -> aliveWorkers.length) ~
-    ("cores" -> aliveWorkers.map(_.cores).sum) ~
-    ("coresused" -> aliveWorkers.map(_.coresUsed).sum) ~
-    ("memory" -> aliveWorkers.map(_.memory).sum) ~
-    ("memoryused" -> aliveWorkers.map(_.memoryUsed).sum) ~
-    ("resources" -> aliveWorkers.map(_.resourcesInfo).toList.map(writeResourcesInfo)) ~
-    ("resourcesused" -> aliveWorkers.map(_.resourcesInfoUsed).toList.map(writeResourcesInfo)) ~
-    ("activeapps" -> obj.activeApps.toList.map(writeApplicationInfo)) ~
-    ("completedapps" -> obj.completedApps.toList.map(writeApplicationInfo)) ~
-    ("activedrivers" -> obj.activeDrivers.toList.map(writeDriverInfo)) ~
-    ("completeddrivers" -> obj.completedDrivers.toList.map(writeDriverInfo)) ~
-    ("status" -> obj.status.toString)
+    field match {
+      case None =>
+        ("url" -> obj.uri) ~
+        ("workers" -> obj.workers.toList.map (writeWorkerInfo) ) ~
+        ("aliveworkers" -> aliveWorkers.length) ~
+        ("cores" -> aliveWorkers.map (_.cores).sum) ~
+        ("coresused" -> aliveWorkers.map (_.coresUsed).sum) ~
+        ("memory" -> aliveWorkers.map (_.memory).sum) ~
+        ("memoryused" -> aliveWorkers.map (_.memoryUsed).sum) ~
+        ("resources" -> aliveWorkers.map (_.resourcesInfo).toList.map (writeResourcesInfo) ) ~
+        ("resourcesused" ->
+          aliveWorkers.map (_.resourcesInfoUsed).toList.map (writeResourcesInfo) ) ~
+        ("activeapps" -> obj.activeApps.toList.map (writeApplicationInfo) ) ~
+        ("completedapps" -> obj.completedApps.toList.map (writeApplicationInfo) ) ~
+        ("activedrivers" -> obj.activeDrivers.toList.map (writeDriverInfo) ) ~
+        ("completeddrivers" -> obj.completedDrivers.toList.map (writeDriverInfo) ) ~
+        ("status" -> obj.status.toString)
+      case Some(field) =>
+        field match {
+          case "url" =>
+            ("url" -> obj.uri)
+          case "workers" =>
+            ("workers" -> obj.workers.toList.map (writeWorkerInfo) )
+          case "aliveworkers" =>
+            ("aliveworkers" -> aliveWorkers.length)
+          case "cores" =>
+            ("cores" -> aliveWorkers.map (_.cores).sum)
+          case "coresused" =>
+            ("coresused" -> aliveWorkers.map (_.coresUsed).sum)
+          case "memory" =>
+            ("memory" -> aliveWorkers.map (_.memory).sum)
+          case "memoryused" =>
+            ("memoryused" -> aliveWorkers.map (_.memoryUsed).sum)
+          case "resources" =>
+            ("resources" -> aliveWorkers.map (_.resourcesInfo).toList.map (writeResourcesInfo) )
+          case "resourcesused" =>
+            ("resourcesused" ->
+              aliveWorkers.map (_.resourcesInfoUsed).toList.map (writeResourcesInfo) )
+          case "activeapps" =>
+            ("activeapps" -> obj.activeApps.toList.map (writeApplicationInfo) )
+          case "completedapps" =>
+            ("completedapps" -> obj.completedApps.toList.map (writeApplicationInfo) )
+          case "activedrivers" =>
+            ("activedrivers" -> obj.activeDrivers.toList.map (writeDriverInfo) )
+          case "completeddrivers" =>
+            ("completeddrivers" -> obj.completedDrivers.toList.map (writeDriverInfo) )
+          case "status" =>
+            ("status" -> obj.status.toString)
+          case field => (field -> "")

Review Comment:
   OK



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -210,22 +210,59 @@ private[deploy] object JsonProtocol {
    *         `status` status of the master,
    *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
    */
-  def writeMasterState(obj: MasterStateResponse): JObject = {
+  def writeMasterState(field: Option[String], obj: MasterStateResponse): JObject = {

Review Comment:
   I mean the `@return` part above 



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -208,24 +208,63 @@ private[deploy] object JsonProtocol {
    *         `completeddrivers` a list of Json objects of [[DriverInfo]] of the completed drivers
    *         of the master
    *         `status` status of the master,
-   *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
+   *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]].
+   *         If `field` is not None, the Json object will contain the matched field.

Review Comment:
   Thank you. I re-read about this, @beliefer .
   
   In this paragraph, it's a logical continuation of three sentences. (1) If None, (2) If not None, (2-1) If `field` doesn't matched. Since (2) starts to mention that `will contain the matched field` and the very next (and final sentence) says, `unmatched` case, I believe the AS-IS is better. These three follow the end of previous sentences.
   ```
   a Json object containing the following fields if `field` is None: ...
   ```
   ```
   If `field` is not None, the Json object will contain the matched field.
   ```
   ```
   If `field` doesn't match, the Json object `(field -> "")` is returned.
   ```



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -208,24 +208,63 @@ private[deploy] object JsonProtocol {
    *         `completeddrivers` a list of Json objects of [[DriverInfo]] of the completed drivers
    *         of the master
    *         `status` status of the master,
-   *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
+   *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]].
+   *         If `field` is not None, the Json object will contain the matched field.

Review Comment:
   `is not None` -> `is matched`?



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #43303: [SPARK-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API
URL: https://github.com/apache/spark/pull/43303


-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -210,22 +210,59 @@ private[deploy] object JsonProtocol {
    *         `status` status of the master,
    *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
    */
-  def writeMasterState(obj: MasterStateResponse): JObject = {
+  def writeMasterState(field: Option[String], obj: MasterStateResponse): JObject = {
     val aliveWorkers = obj.workers.filter(_.isAlive())
-    ("url" -> obj.uri) ~
-    ("workers" -> obj.workers.toList.map(writeWorkerInfo)) ~
-    ("aliveworkers" -> aliveWorkers.length) ~
-    ("cores" -> aliveWorkers.map(_.cores).sum) ~
-    ("coresused" -> aliveWorkers.map(_.coresUsed).sum) ~
-    ("memory" -> aliveWorkers.map(_.memory).sum) ~
-    ("memoryused" -> aliveWorkers.map(_.memoryUsed).sum) ~
-    ("resources" -> aliveWorkers.map(_.resourcesInfo).toList.map(writeResourcesInfo)) ~
-    ("resourcesused" -> aliveWorkers.map(_.resourcesInfoUsed).toList.map(writeResourcesInfo)) ~
-    ("activeapps" -> obj.activeApps.toList.map(writeApplicationInfo)) ~
-    ("completedapps" -> obj.completedApps.toList.map(writeApplicationInfo)) ~
-    ("activedrivers" -> obj.activeDrivers.toList.map(writeDriverInfo)) ~
-    ("completeddrivers" -> obj.completedDrivers.toList.map(writeDriverInfo)) ~
-    ("status" -> obj.status.toString)
+    field match {
+      case None =>
+        ("url" -> obj.uri) ~
+        ("workers" -> obj.workers.toList.map (writeWorkerInfo) ) ~
+        ("aliveworkers" -> aliveWorkers.length) ~
+        ("cores" -> aliveWorkers.map (_.cores).sum) ~
+        ("coresused" -> aliveWorkers.map (_.coresUsed).sum) ~
+        ("memory" -> aliveWorkers.map (_.memory).sum) ~
+        ("memoryused" -> aliveWorkers.map (_.memoryUsed).sum) ~
+        ("resources" -> aliveWorkers.map (_.resourcesInfo).toList.map (writeResourcesInfo) ) ~
+        ("resourcesused" ->
+          aliveWorkers.map (_.resourcesInfoUsed).toList.map (writeResourcesInfo) ) ~
+        ("activeapps" -> obj.activeApps.toList.map (writeApplicationInfo) ) ~
+        ("completedapps" -> obj.completedApps.toList.map (writeApplicationInfo) ) ~
+        ("activedrivers" -> obj.activeDrivers.toList.map (writeDriverInfo) ) ~
+        ("completeddrivers" -> obj.completedDrivers.toList.map (writeDriverInfo) ) ~
+        ("status" -> obj.status.toString)
+      case Some(field) =>
+        field match {
+          case "url" =>
+            ("url" -> obj.uri)
+          case "workers" =>
+            ("workers" -> obj.workers.toList.map (writeWorkerInfo) )
+          case "aliveworkers" =>
+            ("aliveworkers" -> aliveWorkers.length)
+          case "cores" =>
+            ("cores" -> aliveWorkers.map (_.cores).sum)
+          case "coresused" =>
+            ("coresused" -> aliveWorkers.map (_.coresUsed).sum)
+          case "memory" =>
+            ("memory" -> aliveWorkers.map (_.memory).sum)
+          case "memoryused" =>
+            ("memoryused" -> aliveWorkers.map (_.memoryUsed).sum)
+          case "resources" =>
+            ("resources" -> aliveWorkers.map (_.resourcesInfo).toList.map (writeResourcesInfo) )
+          case "resourcesused" =>
+            ("resourcesused" ->
+              aliveWorkers.map (_.resourcesInfoUsed).toList.map (writeResourcesInfo) )
+          case "activeapps" =>
+            ("activeapps" -> obj.activeApps.toList.map (writeApplicationInfo) )
+          case "completedapps" =>
+            ("completedapps" -> obj.completedApps.toList.map (writeApplicationInfo) )
+          case "activedrivers" =>
+            ("activedrivers" -> obj.activeDrivers.toList.map (writeDriverInfo) )
+          case "completeddrivers" =>
+            ("completeddrivers" -> obj.completedDrivers.toList.map (writeDriverInfo) )
+          case "status" =>
+            ("status" -> obj.status.toString)
+          case field => (field -> "")

Review Comment:
   Use 404?



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -208,24 +208,63 @@ private[deploy] object JsonProtocol {
    *         `completeddrivers` a list of Json objects of [[DriverInfo]] of the completed drivers
    *         of the master
    *         `status` status of the master,
-   *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
+   *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]].
+   *         If `field` is not None, the Json object will contain the matched field.

Review Comment:
   Thank you. I re-read about this, @beliefer .
   
   In this paragraph, it's a logical continuation of three sentences. (1) If None, (2) If not None, (2-1) If `field` doesn't matched. Since (2) starts to mention that `will contain the matched field`. And, the very next (and final sentence) says, `unmatched` case. I believe the AS-IS is better.
   ```
   a Json object containing the following fields if `field` is None: ...
   ```
   ```
   If `field` is not None, the Json object will contain the matched field.
   ```
   ```
   If `field` doesn't match, the Json object `(field -> "")` is returned.
   ```



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -208,24 +208,63 @@ private[deploy] object JsonProtocol {
    *         `completeddrivers` a list of Json objects of [[DriverInfo]] of the completed drivers
    *         of the master
    *         `status` status of the master,
-   *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
+   *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]].
+   *         If `field` is not None, the Json object will contain the matched field.

Review Comment:
   Thank you. I re-read about this, @beliefer .
   
   In this paragraph, it's a logical continuation of three sentences. (1) If None, (2) If not None, (2-1) If `field` doesn't matched. Since (2) starts to mention that `will contain the matched field` and the very next (and final sentence) says, `unmatched` case, I believe the AS-IS is better.
   ```
   a Json object containing the following fields if `field` is None: ...
   ```
   ```
   If `field` is not None, the Json object will contain the matched field.
   ```
   ```
   If `field` doesn't match, the Json object `(field -> "")` is returned.
   ```



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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

   Thank you for review and approval, @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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -210,22 +210,59 @@ private[deploy] object JsonProtocol {
    *         `status` status of the master,
    *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
    */
-  def writeMasterState(obj: MasterStateResponse): JObject = {
+  def writeMasterState(field: Option[String], obj: MasterStateResponse): JObject = {

Review Comment:
   Sure. Thanks.



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -210,22 +210,59 @@ private[deploy] object JsonProtocol {
    *         `status` status of the master,
    *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
    */
-  def writeMasterState(obj: MasterStateResponse): JObject = {
+  def writeMasterState(field: Option[String], obj: MasterStateResponse): JObject = {

Review Comment:
   Do you mean the documentation?



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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

   Thank you, @viirya !


-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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

   `core` module passed and this new feature is not invoked in the old code. Let me merge this. Thank you again!
   
   ![Screenshot 2023-10-09 at 11 43 51 PM](https://github.com/apache/spark/assets/9700541/56ccc35f-756a-40a3-aad8-b20e32cd0950)
   


-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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

   Could you review this when you have some time, @viirya ?


-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -208,24 +208,63 @@ private[deploy] object JsonProtocol {
    *         `completeddrivers` a list of Json objects of [[DriverInfo]] of the completed drivers
    *         of the master
    *         `status` status of the master,
-   *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
+   *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]].
+   *         If `field` is not None, the Json object will contain the matched field.

Review Comment:
   Got 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.

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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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

   Thank you again. The arguments are switched and the default value is given, @beliefer .


-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -210,22 +210,59 @@ private[deploy] object JsonProtocol {
    *         `status` status of the master,
    *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
    */
-  def writeMasterState(obj: MasterStateResponse): JObject = {
+  def writeMasterState(field: Option[String], obj: MasterStateResponse): JObject = {

Review Comment:
   Shall we update the annotation, too?



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -210,22 +210,59 @@ private[deploy] object JsonProtocol {
    *         `status` status of the master,
    *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
    */
-  def writeMasterState(obj: MasterStateResponse): JObject = {
+  def writeMasterState(field: Option[String], obj: MasterStateResponse): JObject = {
     val aliveWorkers = obj.workers.filter(_.isAlive())
-    ("url" -> obj.uri) ~
-    ("workers" -> obj.workers.toList.map(writeWorkerInfo)) ~
-    ("aliveworkers" -> aliveWorkers.length) ~
-    ("cores" -> aliveWorkers.map(_.cores).sum) ~
-    ("coresused" -> aliveWorkers.map(_.coresUsed).sum) ~
-    ("memory" -> aliveWorkers.map(_.memory).sum) ~
-    ("memoryused" -> aliveWorkers.map(_.memoryUsed).sum) ~
-    ("resources" -> aliveWorkers.map(_.resourcesInfo).toList.map(writeResourcesInfo)) ~
-    ("resourcesused" -> aliveWorkers.map(_.resourcesInfoUsed).toList.map(writeResourcesInfo)) ~
-    ("activeapps" -> obj.activeApps.toList.map(writeApplicationInfo)) ~
-    ("completedapps" -> obj.completedApps.toList.map(writeApplicationInfo)) ~
-    ("activedrivers" -> obj.activeDrivers.toList.map(writeDriverInfo)) ~
-    ("completeddrivers" -> obj.completedDrivers.toList.map(writeDriverInfo)) ~
-    ("status" -> obj.status.toString)
+    field match {
+      case None =>
+        ("url" -> obj.uri) ~
+        ("workers" -> obj.workers.toList.map (writeWorkerInfo) ) ~
+        ("aliveworkers" -> aliveWorkers.length) ~
+        ("cores" -> aliveWorkers.map (_.cores).sum) ~
+        ("coresused" -> aliveWorkers.map (_.coresUsed).sum) ~
+        ("memory" -> aliveWorkers.map (_.memory).sum) ~
+        ("memoryused" -> aliveWorkers.map (_.memoryUsed).sum) ~
+        ("resources" -> aliveWorkers.map (_.resourcesInfo).toList.map (writeResourcesInfo) ) ~
+        ("resourcesused" ->
+          aliveWorkers.map (_.resourcesInfoUsed).toList.map (writeResourcesInfo) ) ~
+        ("activeapps" -> obj.activeApps.toList.map (writeApplicationInfo) ) ~
+        ("completedapps" -> obj.completedApps.toList.map (writeApplicationInfo) ) ~
+        ("activedrivers" -> obj.activeDrivers.toList.map (writeDriverInfo) ) ~
+        ("completeddrivers" -> obj.completedDrivers.toList.map (writeDriverInfo) ) ~
+        ("status" -> obj.status.toString)
+      case Some(field) =>
+        field match {
+          case "url" =>
+            ("url" -> obj.uri)
+          case "workers" =>
+            ("workers" -> obj.workers.toList.map (writeWorkerInfo) )
+          case "aliveworkers" =>
+            ("aliveworkers" -> aliveWorkers.length)
+          case "cores" =>
+            ("cores" -> aliveWorkers.map (_.cores).sum)
+          case "coresused" =>
+            ("coresused" -> aliveWorkers.map (_.coresUsed).sum)
+          case "memory" =>
+            ("memory" -> aliveWorkers.map (_.memory).sum)
+          case "memoryused" =>
+            ("memoryused" -> aliveWorkers.map (_.memoryUsed).sum)
+          case "resources" =>
+            ("resources" -> aliveWorkers.map (_.resourcesInfo).toList.map (writeResourcesInfo) )
+          case "resourcesused" =>
+            ("resourcesused" ->
+              aliveWorkers.map (_.resourcesInfoUsed).toList.map (writeResourcesInfo) )
+          case "activeapps" =>
+            ("activeapps" -> obj.activeApps.toList.map (writeApplicationInfo) )
+          case "completedapps" =>
+            ("completedapps" -> obj.completedApps.toList.map (writeApplicationInfo) )
+          case "activedrivers" =>
+            ("activedrivers" -> obj.activeDrivers.toList.map (writeDriverInfo) )
+          case "completeddrivers" =>
+            ("completeddrivers" -> obj.completedDrivers.toList.map (writeDriverInfo) )
+          case "status" =>
+            ("status" -> obj.status.toString)
+          case field => (field -> "")

Review Comment:
   This is intentional instead of 404.



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -210,22 +210,59 @@ private[deploy] object JsonProtocol {
    *         `status` status of the master,
    *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
    */
-  def writeMasterState(obj: MasterStateResponse): JObject = {
+  def writeMasterState(field: Option[String], obj: MasterStateResponse): JObject = {

Review Comment:
   Sure~



-- 
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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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

   Thank you for review. The document is updated too, @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-45474][CORE][WEBUI] Support top-level filtering in MasterPage JSON API [spark]

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


##########
core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala:
##########
@@ -210,22 +210,59 @@ private[deploy] object JsonProtocol {
    *         `status` status of the master,
    *         see [[org.apache.spark.deploy.master.RecoveryState.MasterState]]
    */
-  def writeMasterState(obj: MasterStateResponse): JObject = {
+  def writeMasterState(field: Option[String], obj: MasterStateResponse): JObject = {

Review Comment:
   Uh, I missed the signature. Could we put `field: Option[String]` as the last parameter?
   It seems give a default `None` is better.



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