Ngone51 commented on a change in pull request #25047: [WIP][SPARK-27371][CORE] 
Support GPU-aware resources scheduling in Standalone
URL: https://github.com/apache/spark/pull/25047#discussion_r304912988
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/deploy/master/WorkerInfo.scala
 ##########
 @@ -40,13 +57,28 @@ private[spark] class WorkerInfo(
   @transient var state: WorkerState.Value = _
   @transient var coresUsed: Int = _
   @transient var memoryUsed: Int = _
+  @transient var driverToResourcesUsed:
+    mutable.HashMap[String, Map[String, ResourceInformation]] = _
+  @transient var execToResourcesUsed:
+    mutable.HashMap[String, Map[String, ResourceInformation]] = _
 
   @transient var lastHeartbeat: Long = _
 
   init()
 
   def coresFree: Int = cores - coresUsed
   def memoryFree: Int = memory - memoryUsed
+  def resourcesFree: Map[String, Int] = {
+    resources.map { case (rName, rInfo) =>
+      rName -> rInfo.availableAddrs.length
+    }
+  }
+
+  def resourcesCanBeReleased: Map[String, ResourceInformation] = {
+    resources.map { case (rName, rInfo) =>
+      rName -> new ResourceInformation(rName, rInfo.availableAddrs.toArray)
 
 Review comment:
   This was really a bug. Thanks for catching 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.
 
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]

Reply via email to