tgravescs commented on a change in pull request #24615: [SPARK-27488][CORE]
Driver interface to support GPU resources
URL: https://github.com/apache/spark/pull/24615#discussion_r286186226
##########
File path: core/src/main/scala/org/apache/spark/ResourceDiscoverer.scala
##########
@@ -73,21 +85,45 @@ private[spark] object ResourceDiscoverer extends Logging {
val output = executeAndGetOutput(Seq(script.get), new File("."))
val parsedJson = parse(output)
val name = (parsedJson \ "name").extract[String]
- val addresses = (parsedJson \
"addresses").extract[Array[String]].toArray
+ val addresses = (parsedJson \ "addresses").extract[Array[String]]
+ if (name != resourceName) {
+ throw new SparkException(s"Discovery script: ${script.get}
specified via " +
+ s"$discoveryConf returned a resource name: $name that doesn't
match the " +
+ s"config name: $resourceName")
+ }
new ResourceInformation(name, addresses)
} catch {
case e @ (_: SparkException | _: MappingException | _:
JsonParseException) =>
throw new SparkException(s"Error running the resource discovery
script: $scriptFile" +
- s" for $resourceType", e)
+ s" for $resourceName", e)
}
} else {
- throw new SparkException(s"Resource script: $scriptFile to discover
$resourceType" +
+ throw new SparkException(s"Resource script: $scriptFile to discover
$resourceName" +
s" doesn't exist!")
}
} else {
- throw new SparkException(s"User is expecting to use $resourceType
resources but " +
+ throw new SparkException(s"User is expecting to use $resourceName
resources but " +
s"didn't specify a script via conf: $discoveryConf, to find them!")
}
result
}
+
+ // Make sure the actual resources we have on startup is at least the number
the user
Review comment:
yep
----------------------------------------------------------------
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]