Skip to content
This repository has been archived by the owner on Jan 9, 2020. It is now read-only.

Check for user jars/files existence before creating the driver pod. #86

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ private[spark] class Client(

def run(): Unit = {
logInfo(s"Starting application $kubernetesAppId in Kubernetes...")
val (driverSubmitSslOptions, isKeyStoreLocalFile) = parseDriverSubmitSslOptions()

Seq(uploadedFiles, uploadedJars, Some(mainAppResource)).foreach(checkForFilesExistence)

val (driverSubmitSslOptions, isKeyStoreLocalFile) = parseDriverSubmitSslOptions()
val parsedCustomLabels = parseCustomLabels(customLabels)
var k8ConfBuilder = new K8SConfigBuilder()
.withApiVersion("v1")
Expand Down Expand Up @@ -661,6 +663,22 @@ private[spark] class Client(
}).toMap
}).getOrElse(Map.empty[String, String])
}

private def checkForFilesExistence(maybePaths: Option[String]): Unit = {
maybePaths.foreach { paths =>
paths.split(",").foreach { path =>
val uri = Utils.resolveURI(path)
uri.getScheme match {
case "file" | null =>
val file = new File(uri.getPath)
if (!file.isFile) {
throw new SparkException(s"""file "${uri}" does not exist!""")
}
case _ =>
}
}
}
}
}

private[spark] object Client extends Logging {
Expand Down