-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-8095] Resolve dependencies of --packages in local ivy cache #6788
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 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b6ef038
[SPARK-8095] Resolve dependencies of Spark Packages in local ivy cache
brkyvz f60772c
use different folder for m2 cache during testing
brkyvz 0037197
fix merge conflicts
brkyvz a69e3e6
delete cache before test as well
brkyvz 48cc648
improve deletion
brkyvz 2875bf4
fix temp dir bug
brkyvz 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
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 |
|---|---|---|
|
|
@@ -24,7 +24,7 @@ import org.scalatest.BeforeAndAfterAll | |
|
|
||
| import org.apache.ivy.core.module.descriptor.MDArtifact | ||
| import org.apache.ivy.core.settings.IvySettings | ||
| import org.apache.ivy.plugins.resolver.IBiblioResolver | ||
| import org.apache.ivy.plugins.resolver.{AbstractResolver, FileSystemResolver, IBiblioResolver} | ||
|
|
||
| import org.apache.spark.SparkFunSuite | ||
| import org.apache.spark.deploy.SparkSubmitUtils.MavenCoordinate | ||
|
|
@@ -68,18 +68,18 @@ class SparkSubmitUtilsSuite extends SparkFunSuite with BeforeAndAfterAll { | |
| // should have central and spark-packages by default | ||
| assert(res1.getResolvers.size() === 4) | ||
| assert(res1.getResolvers.get(0).asInstanceOf[IBiblioResolver].getName === "local-m2-cache") | ||
| assert(res1.getResolvers.get(1).asInstanceOf[IBiblioResolver].getName === "local-ivy-cache") | ||
| assert(res1.getResolvers.get(1).asInstanceOf[FileSystemResolver].getName === "local-ivy-cache") | ||
| assert(res1.getResolvers.get(2).asInstanceOf[IBiblioResolver].getName === "central") | ||
| assert(res1.getResolvers.get(3).asInstanceOf[IBiblioResolver].getName === "spark-packages") | ||
|
|
||
| val repos = "a/1,b/2,c/3" | ||
| val resolver2 = SparkSubmitUtils.createRepoResolvers(Option(repos), settings) | ||
| assert(resolver2.getResolvers.size() === 7) | ||
| val expected = repos.split(",").map(r => s"$r/") | ||
| resolver2.getResolvers.toArray.zipWithIndex.foreach { case (resolver: IBiblioResolver, i) => | ||
| resolver2.getResolvers.toArray.zipWithIndex.foreach { case (resolver: AbstractResolver, i) => | ||
| if (i > 3) { | ||
| assert(resolver.getName === s"repo-${i - 3}") | ||
| assert(resolver.getRoot === expected(i - 4)) | ||
| assert(resolver.asInstanceOf[IBiblioResolver].getRoot === expected(i - 4)) | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -112,26 +112,32 @@ class SparkSubmitUtilsSuite extends SparkFunSuite with BeforeAndAfterAll { | |
| } | ||
|
|
||
| test("search for artifact at local repositories") { | ||
| val main = new MavenCoordinate("my.awesome.lib", "mylib", "0.1") | ||
| val main = new MavenCoordinate("my.great.lib", "mylib", "0.1") | ||
| val dep = "my.great.dep:mydep:0.5" | ||
|
Contributor
Author
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. Added this dependency as a regression test |
||
| // Local M2 repository | ||
| IvyTestUtils.withRepository(main, None, Some(SparkSubmitUtils.m2Path)) { repo => | ||
| IvyTestUtils.withRepository(main, Some(dep), Some(SparkSubmitUtils.m2Path)) { repo => | ||
| val jarPath = SparkSubmitUtils.resolveMavenCoordinates(main.toString, None, None, true) | ||
| assert(jarPath.indexOf("mylib") >= 0, "should find artifact") | ||
| assert(jarPath.indexOf("mydep") >= 0, "should find dependency") | ||
| } | ||
| // Local Ivy Repository | ||
| val settings = new IvySettings | ||
| val ivyLocal = new File(settings.getDefaultIvyUserDir, "local" + File.separator) | ||
| IvyTestUtils.withRepository(main, None, Some(ivyLocal), true) { repo => | ||
| IvyTestUtils.withRepository(main, Some(dep), Some(ivyLocal), useIvyLayout = true) { repo => | ||
| val jarPath = SparkSubmitUtils.resolveMavenCoordinates(main.toString, None, None, true) | ||
| assert(jarPath.indexOf("mylib") >= 0, "should find artifact") | ||
| assert(jarPath.indexOf("mydep") >= 0, "should find dependency") | ||
| } | ||
| // Local ivy repository with modified home | ||
| val dummyIvyLocal = new File(tempIvyPath, "local" + File.separator) | ||
| IvyTestUtils.withRepository(main, None, Some(dummyIvyLocal), true) { repo => | ||
| settings.setDefaultIvyUserDir(new File(tempIvyPath)) | ||
| IvyTestUtils.withRepository(main, Some(dep), Some(dummyIvyLocal), useIvyLayout = true, | ||
| ivySettings = settings) { repo => | ||
| val jarPath = SparkSubmitUtils.resolveMavenCoordinates(main.toString, None, | ||
| Some(tempIvyPath), true) | ||
| assert(jarPath.indexOf("mylib") >= 0, "should find artifact") | ||
| assert(jarPath.indexOf(tempIvyPath) >= 0, "should be in new ivy path") | ||
| assert(jarPath.indexOf("mydep") >= 0, "should find dependency") | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
We need to delete the cache for these fake libraries, or they affect each other between tests.