-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-14423][YARN] Avoid same name files added to distributed cache again #12203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ | |
|
|
||
| package org.apache.spark.deploy.yarn | ||
|
|
||
| import java.io.{File, FileOutputStream} | ||
| import java.io.{File, FileInputStream, FileOutputStream} | ||
| import java.net.URI | ||
| import java.util.Properties | ||
|
|
||
|
|
@@ -285,6 +285,36 @@ class ClientSuite extends SparkFunSuite with Matchers with BeforeAndAfterAll | |
| classpath(client) should contain (buildPath(PWD, LOCALIZED_LIB_DIR, "*")) | ||
| } | ||
|
|
||
| test("ignore same name jars") { | ||
| val libs = Utils.createTempDir() | ||
| val jarsDir = new File(libs, "jars") | ||
| assert(jarsDir.mkdir()) | ||
| new FileOutputStream(new File(libs, "RELEASE")).close() | ||
| val userLibs = Utils.createTempDir() | ||
|
|
||
| val jar1 = TestUtils.createJarWithFiles(Map(), jarsDir) | ||
| val jar2 = TestUtils.createJarWithFiles(Map(), userLibs) | ||
| // Copy jar2 to jar3 with same name | ||
| val jar3 = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could have used |
||
| val target = new File(userLibs, new File(jar1.toURI).getName) | ||
| val input = new FileInputStream(jar2.getPath) | ||
| val output = new FileOutputStream(target) | ||
| Utils.copyStream(input, output, closeStreams = true) | ||
| target.toURI.toURL | ||
| } | ||
|
|
||
| val sparkConf = new SparkConfWithEnv(Map("SPARK_HOME" -> libs.getAbsolutePath)) | ||
| .set(JARS_TO_DISTRIBUTE, Seq(jar2.getPath, jar3.getPath)) | ||
|
|
||
| val client = createClient(sparkConf) | ||
| val tempDir = Utils.createTempDir() | ||
| client.prepareLocalResources(tempDir.getAbsolutePath(), Nil) | ||
|
|
||
| // Only jar2 will be added to SECONDARY_JARS, jar3 which has the same name with jar1 will be | ||
| // ignored. | ||
| sparkConf.get(SECONDARY_JARS) should be (Some(Seq(new File(jar2.toURI).getName))) | ||
| } | ||
|
|
||
| object Fixtures { | ||
|
|
||
| val knownDefYarnAppCP: Seq[String] = | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this change about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewor14 , in the previous code we assume all the files will be uploaded into distributed cache, so this
localizedPathshould not be null. But here with my change, some duplicated files will be neglected, this is returnlocalizedPathas null instead, so here I change to this way.