Skip to content

Commit c73aabe

Browse files
committed
address review comments
1 parent f06a754 commit c73aabe

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,19 @@ object SparkSubmit {
251251
}
252252

253253
val isYarnCluster = clusterManager == YARN && deployMode == CLUSTER
254-
if (args.packagesResolved != null) {
255-
args.jars = mergeFileLists(args.jars, args.packagesResolved)
256-
if (args.isPython) args.pyFiles = mergeFileLists(args.pyFiles, args.packagesResolved)
257-
} else {
258-
// This part needs to be added in case SparkSubmitDriverBootstrapper is not called
259-
val resolvedMavenCoordinates =
260-
SparkSubmitUtils.resolveMavenCoordinates(
261-
args.packages, Option(args.repositories), Option(args.ivyRepoPath)).mkString(",")
262-
if (resolvedMavenCoordinates.trim.length > 0) {
263-
args.jars = mergeFileLists(args.jars, resolvedMavenCoordinates)
264-
if (args.isPython) args.pyFiles = mergeFileLists(args.pyFiles, resolvedMavenCoordinates)
254+
val packagesResolved =
255+
if (args.packagesResolved != null) {
256+
// SparkSubmitDriverBootstrapper already downloaded the jars for us
257+
args.packagesResolved
258+
} else {
259+
SparkSubmitUtils.resolveMavenCoordinates(args.packages, Option(args.repositories),
260+
Option(args.ivyRepoPath)).mkString(",")
261+
}
262+
263+
if (packagesResolved.nonEmpty) {
264+
args.jars = mergeFileLists(args.jars, packagesResolved)
265+
if (args.isPython) {
266+
args.pyFiles = mergeFileLists(args.pyFiles, packagesResolved)
265267
}
266268
}
267269

@@ -713,7 +715,7 @@ private[spark] object SparkSubmitUtils {
713715
* after a '!' by Ivy. It also sometimes contains '(bundle)' after '.jar'. Remove that as well.
714716
* @param artifacts Sequence of dependencies that were resolved and retrieved
715717
* @param cacheDirectory directory where jars are cached
716-
* @return a comma-delimited list of paths for the dependencies
718+
* @return A sequence of paths for the dependencies
717719
*/
718720
private[spark] def resolveDependencyPaths(
719721
artifacts: Array[AnyRef],
@@ -778,7 +780,7 @@ private[spark] object SparkSubmitUtils {
778780
* @param coordinates Comma-delimited string of maven coordinates
779781
* @param remoteRepos Comma-delimited string of remote repositories other than maven central
780782
* @param ivyPath The path to the local ivy repository
781-
* @return The comma-delimited path to the jars of the given maven artifacts including their
783+
* @return A sequence of paths to the jars of the given maven artifacts including their
782784
* transitive dependencies
783785
*/
784786
private[spark] def resolveMavenCoordinates(
@@ -787,7 +789,7 @@ private[spark] object SparkSubmitUtils {
787789
ivyPath: Option[String],
788790
isTest: Boolean = false): Seq[String] = {
789791
if (coordinates == null || coordinates.trim.isEmpty) {
790-
Seq("")
792+
Seq.empty
791793
} else {
792794
val sysOut = System.out
793795
// To prevent ivy from logging to system out

core/src/main/scala/org/apache/spark/deploy/SparkSubmitArguments.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,8 @@ private[spark] class SparkSubmitArguments(args: Seq[String], env: Map[String, St
396396
packages = value
397397
parse(tail)
398398

399-
// Internal flag to receive the resolved maven jars and add to --jars
399+
// Spark-6031 Internal flag to receive the resolved maven jars and add to --jars.
400+
// This is only passed through the Bootstrapper
400401
case ("--packages-resolved") :: value :: tail =>
401402
packagesResolved = Utils.resolveURIs(value)
402403
parse(tail)

core/src/main/scala/org/apache/spark/deploy/SparkSubmitDriverBootstrapper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private[spark] object SparkSubmitDriverBootstrapper {
9797
val resolvedMavenCoordinates =
9898
SparkSubmitUtils.resolveMavenCoordinates(
9999
submitPackages, submitRepositories, confIvyRepo)
100-
if (resolvedMavenCoordinates.head.length > 0) {
100+
if (resolvedMavenCoordinates.nonEmpty) {
101101
newClasspath += sys.props("path.separator") +
102102
resolvedMavenCoordinates.mkString(sys.props("path.separator"))
103103
submitArgs =

0 commit comments

Comments
 (0)