liyinan926 commented on a change in pull request #23546: [SPARK-23153][K8s] 
Support client dependencies with a HCFS
URL: https://github.com/apache/spark/pull/23546#discussion_r249116345
 
 

 ##########
 File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesUtils.scala
 ##########
 @@ -71,17 +75,64 @@ private[spark] object KubernetesUtils extends Logging {
    * - File URIs with scheme local:// resolve to just the path of the URI.
    * - Otherwise, the URIs are returned as-is.
    */
-  def resolveFileUrisAndPath(fileUris: Iterable[String]): Iterable[String] = {
+  def resolveFileUrisAndPath(fileUris: Iterable[String], conf: 
Option[SparkConf] = None)
+  : Iterable[String] = {
     fileUris.map { uri =>
-      resolveFileUri(uri)
+      resolveFileUri(uri, conf)
     }
   }
 
-  def resolveFileUri(uri: String): String = {
+  /**
+   * Get the final path for a client file, if not return the uri as is.
+   *
+   */
+  def getDestPathIfClientFile(uri: String, conf: SparkConf): String = {
+    val fileUri = Utils.resolveURI(uri)
+    val fileScheme = Option(fileUri.getScheme).getOrElse("file")
+    if (fileScheme == "client") {
+      if (conf.get(KUBERNETES_FILE_UPLOAD_PATH).isDefined) {
+        val uploadPath = conf.get(KUBERNETES_FILE_UPLOAD_PATH).get
+        s"${uploadPath}/${fileUri.getPath.split("/").last}"
 
 Review comment:
   So a file `client://path/to/app1.jar` will be uploaded to 
`${uploadPath}/app1.jar`? What if two client-local files at different local 
paths have the same file name?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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