tgravescs 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_r303965288
########## File path: core/src/main/scala/org/apache/spark/deploy/master/WorkerInfo.scala ########## @@ -89,17 +125,51 @@ private[spark] class WorkerInfo( drivers(driver.id) = driver memoryUsed += driver.desc.mem coresUsed += driver.desc.cores + driverToResourcesUsed(driver.id) = driver.resources } def removeDriver(driver: DriverInfo) { drivers -= driver.id memoryUsed -= driver.desc.mem coresUsed -= driver.desc.cores + driverToResourcesUsed.remove(driver.id) } def setState(state: WorkerState.Value): Unit = { this.state = state } def isAlive(): Boolean = this.state == WorkerState.ALIVE + + /** + * acquire specified amount resources for driver/executor from the worker + * @param resourceReqs the resources requirement from driver/executor + */ + def acquireResources(resourceReqs: Seq[ResourceRequirement]) + : Map[String, ResourceInformation] = { + resourceReqs.map { req => + val rName = req.resourceName + val amount = req.amount + rName -> resources(rName).acquire(amount) + }.toMap + } + + /** + * used during master recovery + */ + def notifyResources(expected: Map[String, ResourceInformation]): Unit = { Review comment: call this recoverResources instead since it looks like its only used for recovery ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org