tgravescs commented on a change in pull request #24841: [SPARK-27369][CORE] 
Setup resources when Standalone Worker starts up
URL: https://github.com/apache/spark/pull/24841#discussion_r292913851
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala
 ##########
 @@ -220,6 +225,38 @@ private[deploy] class Worker(
     metricsSystem.getServletHandlers.foreach(webUi.attachHandler)
   }
 
+  // TODO if we're starting up multi workers under the same host, discovery 
script won't work.
+  private def setupWorkerResources(): Unit = {
+    try {
+      resources = resourceFile.map { rFile =>
+        ResourceDiscoverer.parseAllocatedFromJsonFile(rFile)
+      }.getOrElse {
+        if (resourceDiscoveryScript.isEmpty) {
+          logWarning(s"Neither resourceFile nor resourceDiscoveryScript found 
for worker. " +
+            s"You can use SPARK_WORKER_RESOURCE_FILE(--resource-file) or " +
+            s"SPARK_WORKER_RESOURCE_DISCOVERY_SCRIPT(--resource-script) to 
config " +
+            s"resources(e.g. GPU/FPGA) for worker.")
+          Map.empty
+        } else {
+          resourceDiscoveryScript.map { case (rName, rScript) =>
+            val resInfo = ResourceDiscoverer.getResourceInfo(rScript, rName,
+              "SPARK_WORKER_RESOURCE_DISCOVERY_SCRIPT or (--resource-script)")
+            (rName, resInfo)
+          }
+        }
+      }
+    } catch {
+      case t: Throwable =>
+        logWarning("Failed to setup worker resources: ", t)
 
 Review comment:
   logError

----------------------------------------------------------------
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

Reply via email to