Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18303#discussion_r122596562
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/JsonProtocol.scala ---
    @@ -21,74 +21,192 @@ import org.json4s.JsonAST.JObject
     import org.json4s.JsonDSL._
     
     import org.apache.spark.deploy.DeployMessages.{MasterStateResponse, 
WorkerStateResponse}
    -import org.apache.spark.deploy.master.{ApplicationInfo, DriverInfo, 
WorkerInfo}
    +import org.apache.spark.deploy.master._
    +import org.apache.spark.deploy.master.RecoveryState.MasterState
     import org.apache.spark.deploy.worker.ExecutorRunner
     
     private[deploy] object JsonProtocol {
    - def writeWorkerInfo(obj: WorkerInfo): JObject = {
    -   ("id" -> obj.id) ~
    -   ("host" -> obj.host) ~
    -   ("port" -> obj.port) ~
    -   ("webuiaddress" -> obj.webUiAddress) ~
    -   ("cores" -> obj.cores) ~
    -   ("coresused" -> obj.coresUsed) ~
    -   ("coresfree" -> obj.coresFree) ~
    -   ("memory" -> obj.memory) ~
    -   ("memoryused" -> obj.memoryUsed) ~
    -   ("memoryfree" -> obj.memoryFree) ~
    -   ("state" -> obj.state.toString) ~
    -   ("lastheartbeat" -> obj.lastHeartbeat)
    - }
    +  /**
    +   * Export the [[WorkerInfo]] to a Json object, a [[WorkerInfo]] consists 
of the information of a
    +   * worker.
    +   *
    +   * @return a Json object containing the following fields:
    +   *         `id` a string identifier of the worker
    +   *         `host` the host that the worker is running on
    +   *         `port` the port that the worker is bound to
    +   *         `address` ${host}:${port}
    +   *         `webuiaddress` the address used in web UI
    +   *         `cores` total cores of the worker
    +   *         `coresused` allocated cores of the worker
    +   *         `coresfree` free cores of the worker
    +   *         `memory` total memory of the worker
    +   *         `memoryused` allocated memory of the worker
    +   *         `memoryfree` free memory of the worker
    +   *         `state` state of the worker, see [[WorkerState]]
    +   *         `lastheartbeat` time in milliseconds that the latest heart 
beat message from the
    +   *         worker is received.
    +   */
    +  def writeWorkerInfo(obj: WorkerInfo): JObject = {
    +    ("id" -> obj.id) ~
    +    ("host" -> obj.host) ~
    +    ("port" -> obj.port) ~
    +    ("address" -> obj.hostPort) ~
    +    ("webuiaddress" -> obj.webUiAddress) ~
    +    ("cores" -> obj.cores) ~
    +    ("coresused" -> obj.coresUsed) ~
    +    ("coresfree" -> obj.coresFree) ~
    +    ("memory" -> obj.memory) ~
    +    ("memoryused" -> obj.memoryUsed) ~
    +    ("memoryfree" -> obj.memoryFree) ~
    +    ("state" -> obj.state.toString) ~
    +    ("lastheartbeat" -> obj.lastHeartbeat)
    +  }
     
    +  /**
    +   * Export the [[ApplicationInfo]] to a Json object, an 
[[ApplicationInfo]] consists of the
    --- End diff --
    
    `, an` -> `. An`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to