tgravescs commented on a change in pull request #25409: [SPARK-28414][WEBUI] UI
updates to show resource info in Standalone
URL: https://github.com/apache/spark/pull/25409#discussion_r315209513
##########
File path:
core/src/main/scala/org/apache/spark/deploy/StandaloneResourceUtils.scala
##########
@@ -345,4 +345,27 @@ private[spark] object StandaloneResourceUtils extends
Logging {
def needCoordinate(conf: SparkConf): Boolean = {
conf.get(SPARK_RESOURCES_COORDINATE)
}
+
+ // used for UI
+ def formatResourcesAddresses(resources: Map[String, ResourceInformation]):
String = {
+ resources.map { case (rName, rInfo) =>
+ s"$rName: ${rInfo.addresses.mkString("[", ", ", "]")}"
+ }.mkString(", ")
+ }
+
+ // used for UI
+ def formatResourcesUsed(
+ resources: Map[String, ResourceInformation],
+ resourcesUsed: Map[String, ResourceInformation]): String = {
+ resources.map { case (rName, rInfo) =>
+ val used = resourcesUsed(rName).addresses.length
+ val total = rInfo.addresses.length
+ s"$used / $total $rName"
+ }.mkString(", ")
+ }
+
+ // used for UI
+ def formatResourceRequirements(requirements: Seq[ResourceRequirement]):
String = {
+ requirements.map { req => s"${req.amount}
${req.resourceName}"}.mkString(", ")
Review comment:
sorry I wasn't clear I meant replace {} in the map with ().
requirements.map(req => ..) since it all fits on one line
----------------------------------------------------------------
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]