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

Commit bc845c3

Browse files
mccheahash211
authored andcommitted
Use paths to read small local files instead of URIs (#477)
1 parent 728ba0a commit bc845c3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/kubernetes/submit/submitsteps/MountSmallLocalFilesStep.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ private[spark] class MountSmallLocalFilesStep(
3434

3535
import MountSmallLocalFilesStep._
3636
override def configureDriver(driverSpec: KubernetesDriverSpec): KubernetesDriverSpec = {
37-
val localFiles = KubernetesFileUtils.getOnlySubmitterLocalFiles(sparkFiles).map(new File(_))
37+
val localFiles = KubernetesFileUtils.getOnlySubmitterLocalFiles(sparkFiles)
38+
.map(localFileUri => new File(Utils.resolveURI(localFileUri).getPath))
3839
val totalSizeBytes = localFiles.map(_.length()).sum
3940
val totalSizeBytesString = Utils.bytesToString(totalSizeBytes)
4041
require(totalSizeBytes < MAX_SECRET_BUNDLE_SIZE_BYTES,
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import org.apache.spark.deploy.kubernetes.constants._
3232
import org.apache.spark.deploy.kubernetes.submit.MountSmallFilesBootstrap
3333
import org.apache.spark.util.Utils
3434

35-
private[spark] class MountSmallLocalFilesStepTest extends SparkFunSuite with BeforeAndAfter {
35+
private[spark] class MountSmallLocalFilesStepSuite extends SparkFunSuite with BeforeAndAfter {
3636

3737
private val FIRST_TEMP_FILE_NAME = "file1.txt"
3838
private val SECOND_TEMP_FILE_NAME = "file2.txt"
@@ -56,11 +56,11 @@ private[spark] class MountSmallLocalFilesStepTest extends SparkFunSuite with Bef
5656

5757
test("Local files should be added to the secret.") {
5858
val firstTempFile = createTempFileWithContents(
59-
tempFolder, FIRST_TEMP_FILE_NAME, FIRST_TEMP_FILE_CONTENTS)
59+
tempFolder, FIRST_TEMP_FILE_NAME, FIRST_TEMP_FILE_CONTENTS)
6060
val secondTempFile = createTempFileWithContents(
6161
tempFolder, SECOND_TEMP_FILE_NAME, SECOND_TEMP_FILE_CONTENTS)
6262
val sparkFiles = Seq(
63-
firstTempFile.getAbsolutePath,
63+
s"file://${firstTempFile.getAbsolutePath}",
6464
secondTempFile.getAbsolutePath,
6565
REMOTE_FILE_URI)
6666
val configurationStep = new MountSmallLocalFilesStep(

0 commit comments

Comments
 (0)