vanzin commented on a change in pull request #24879: [SPARK-28042][K8S] Support 
using volume mount as local storage
URL: https://github.com/apache/spark/pull/24879#discussion_r307400113
 
 

 ##########
 File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/features/LocalDirsFeatureStep.scala
 ##########
 @@ -66,10 +76,22 @@ private[spark] class LocalDirsFeatureStep(
     val containerWithLocalDirVolumeMounts = new ContainerBuilder(pod.container)
       .addNewEnv()
         .withName("SPARK_LOCAL_DIRS")
-        .withValue(resolvedLocalDirs.mkString(","))
+        .withValue(localDirs.mkString(","))
         .endEnv()
       .addToVolumeMounts(localDirVolumeMounts: _*)
       .build()
     SparkPod(podWithLocalDirVolumes, containerWithLocalDirVolumeMounts)
   }
+
+  def findLocalDirVolumeMount(pod: SparkPod): Seq[String] = {
+    val localDirVolumes = pod.pod.getSpec.getVolumes.asScala
+      .filter(v => v.getName.startsWith("spark-local-dir-"))
+
+    localDirVolumes.map { volume => pod.container.getVolumeMounts.asScala
+      .find(m => m.getName.equals(volume.getName)) match {
+          case Some(m) => m.getMountPath
+          case _ => ""
+      }
+    }.filter(s => s.length > 0)
 
 Review comment:
   You can use `localDirVolumes.flatMap` and avoid this filter.

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