Skip to content
Snippets Groups Projects
Commit 245e5a2f authored by Kishor Patil's avatar Kishor Patil Committed by Tom Graves
Browse files

[SPARK-18357] Fix yarn files/archive broken issue andd unit tests

## What changes were proposed in this pull request?

The #15627 broke functionality with yarn --files --archives does not accept any files.
This patch ensures that --files and --archives accept unique files.

## How was this patch tested?

A. I added unit tests.
B. Also, manually tested --files with --archives to throw exception if duplicate files are specified and continue if unique files are specified.

Author: Kishor Patil <kpatil@yahoo-inc.com>

Closes #15810 from kishorvpatil/SPARK18357.
parent 9c419698
No related branches found
No related tags found
No related merge requests found
......@@ -604,7 +604,7 @@ private[spark] class Client(
cachedSecondaryJarLinks += localizedPath
}
} else {
if (localizedPath != null) {
if (localizedPath == null) {
throw new IllegalArgumentException(s"Attempt to add ($file) multiple times" +
" to the distributed cache.")
}
......
......@@ -322,6 +322,23 @@ class ClientSuite extends SparkFunSuite with Matchers with BeforeAndAfterAll
intercept[IllegalArgumentException] {
clientArchives.prepareLocalResources(new Path(tempDirForArchives.getAbsolutePath()), Nil)
}
// Case 4: FILES_TO_DISTRIBUTE can have unique file.
val sparkConfFilesUniq = new SparkConfWithEnv(Map("SPARK_HOME" -> libs.getAbsolutePath))
.set(FILES_TO_DISTRIBUTE, Seq(testJar.getPath))
val clientFilesUniq = createClient(sparkConfFilesUniq)
val tempDirForFilesUniq = Utils.createTempDir()
clientFilesUniq.prepareLocalResources(new Path(tempDirForFilesUniq.getAbsolutePath()), Nil)
// Case 5: ARCHIVES_TO_DISTRIBUTE can have unique file.
val sparkConfArchivesUniq = new SparkConfWithEnv(Map("SPARK_HOME" -> libs.getAbsolutePath))
.set(ARCHIVES_TO_DISTRIBUTE, Seq(testJar.getPath))
val clientArchivesUniq = createClient(sparkConfArchivesUniq)
val tempDirArchivesUniq = Utils.createTempDir()
clientArchivesUniq.prepareLocalResources(new Path(tempDirArchivesUniq.getAbsolutePath()), Nil)
}
test("distribute local spark jars") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment