Skip to content

Commit f50c088

Browse files
author
Andrew Or
committed
[SPARK-4281][Build] Package Yarn shuffle service into its own jar
This is another addendum to #3082, which added the Yarn shuffle service to run inside the NM. This PR makes the feature much more usable by packaging enough dependencies into the jar to run the service inside an NM. After these changes, the user can run `./make-distribution.sh` and find a `spark-network-yarn*.jar` in their `lib` directory. The equivalent change is done in SBT by making the `network-yarn` module an assembly project. Author: Andrew Or <[email protected]> Closes #3147 from andrewor14/yarn-shuffle-build and squashes the following commits: bda58d0 [Andrew Or] Fix line too long 81e9705 [Andrew Or] Merge branch 'master' of github.com:apache/spark into yarn-shuffle-build fb7f398 [Andrew Or] Rename jar to spark-{VERSION}-yarn-shuffle.jar 65db822 [Andrew Or] Actually mark slf4j as provided abcefd1 [Andrew Or] Do the same for SBT c653028 [Andrew Or] Package network-yarn and its dependencies (cherry picked from commit aa43a8d) Signed-off-by: Andrew Or <[email protected]>
1 parent 233f037 commit f50c088

File tree

5 files changed

+53
-10
lines changed

5 files changed

+53
-10
lines changed

make-distribution.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ echo "Spark $VERSION$GITREVSTRING built for Hadoop $SPARK_HADOOP_VERSION" > "$DI
181181
# Copy jars
182182
cp "$FWDIR"/assembly/target/scala*/*assembly*hadoop*.jar "$DISTDIR/lib/"
183183
cp "$FWDIR"/examples/target/scala*/spark-examples*.jar "$DISTDIR/lib/"
184+
cp "$FWDIR"/network/yarn/target/scala*/spark-*-yarn-shuffle.jar "$DISTDIR/lib/"
184185

185186
# Copy example sources (needed for python and SQL)
186187
mkdir -p "$DISTDIR/examples/src/main"

network/common/pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@
4141
<groupId>io.netty</groupId>
4242
<artifactId>netty-all</artifactId>
4343
</dependency>
44+
45+
<!-- Provided dependencies -->
4446
<dependency>
4547
<groupId>org.slf4j</groupId>
4648
<artifactId>slf4j-api</artifactId>
49+
<scope>provided</scope>
4750
</dependency>
48-
49-
<!-- Provided dependencies -->
5051
<dependency>
5152
<groupId>com.google.guava</groupId>
5253
<artifactId>guava</artifactId>

network/shuffle/pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@
4242
<artifactId>spark-network-common_${scala.binary.version}</artifactId>
4343
<version>${project.version}</version>
4444
</dependency>
45+
46+
<!-- Provided dependencies -->
4547
<dependency>
4648
<groupId>org.slf4j</groupId>
4749
<artifactId>slf4j-api</artifactId>
50+
<scope>provided</scope>
4851
</dependency>
49-
50-
<!-- Provided dependencies -->
5152
<dependency>
5253
<groupId>com.google.guava</groupId>
5354
<artifactId>guava</artifactId>

network/yarn/pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,38 @@
5454
<build>
5555
<outputDirectory>target/scala-${scala.binary.version}/classes</outputDirectory>
5656
<testOutputDirectory>target/scala-${scala.binary.version}/test-classes</testOutputDirectory>
57+
<plugins>
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-shade-plugin</artifactId>
61+
<configuration>
62+
<shadedArtifactAttached>false</shadedArtifactAttached>
63+
<outputFile>${project.build.directory}/scala-${scala.binary.version}/spark-${project.version}-yarn-shuffle.jar</outputFile>
64+
<artifactSet>
65+
<includes>
66+
<include>*:*</include>
67+
</includes>
68+
</artifactSet>
69+
<filters>
70+
<filter>
71+
<artifact>*:*</artifact>
72+
<excludes>
73+
<exclude>META-INF/*.SF</exclude>
74+
<exclude>META-INF/*.DSA</exclude>
75+
<exclude>META-INF/*.RSA</exclude>
76+
</excludes>
77+
</filter>
78+
</filters>
79+
</configuration>
80+
<executions>
81+
<execution>
82+
<phase>package</phase>
83+
<goals>
84+
<goal>shade</goal>
85+
</goals>
86+
</execution>
87+
</executions>
88+
</plugin>
89+
</plugins>
5790
</build>
5891
</project>

project/SparkBuild.scala

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ object BuildCommons {
3838
"streaming-flume", "streaming-kafka", "streaming-mqtt", "streaming-twitter",
3939
"streaming-zeromq").map(ProjectRef(buildLocation, _))
4040

41-
val optionallyEnabledProjects@Seq(yarn, yarnStable, yarnAlpha, networkYarn, java8Tests,
42-
sparkGangliaLgpl, sparkKinesisAsl) = Seq("yarn", "yarn-stable", "yarn-alpha", "network-yarn",
41+
val optionallyEnabledProjects@Seq(yarn, yarnStable, yarnAlpha, java8Tests,
42+
sparkGangliaLgpl, sparkKinesisAsl) = Seq("yarn", "yarn-stable", "yarn-alpha",
4343
"java8-tests", "ganglia-lgpl", "kinesis-asl").map(ProjectRef(buildLocation, _))
4444

45-
val assemblyProjects@Seq(assembly, examples) = Seq("assembly", "examples")
46-
.map(ProjectRef(buildLocation, _))
45+
val assemblyProjects@Seq(assembly, examples, networkYarn) =
46+
Seq("assembly", "examples", "network-yarn").map(ProjectRef(buildLocation, _))
4747

4848
val tools = ProjectRef(buildLocation, "tools")
4949
// Root project.
@@ -289,8 +289,15 @@ object Assembly {
289289

290290
lazy val settings = assemblySettings ++ Seq(
291291
test in assembly := {},
292-
jarName in assembly <<= (version, moduleName) map { (v, mName) => mName + "-"+v + "-hadoop" +
293-
Option(System.getProperty("hadoop.version")).getOrElse("1.0.4") + ".jar" },
292+
jarName in assembly <<= (version, moduleName) map { (v, mName) =>
293+
if (mName.contains("network-yarn")) {
294+
// This must match the same name used in maven (see network/yarn/pom.xml)
295+
"spark-" + v + "-yarn-shuffle.jar"
296+
} else {
297+
mName + "-" + v + "-hadoop" +
298+
Option(System.getProperty("hadoop.version")).getOrElse("1.0.4") + ".jar"
299+
}
300+
},
294301
mergeStrategy in assembly := {
295302
case PathList("org", "datanucleus", xs @ _*) => MergeStrategy.discard
296303
case m if m.toLowerCase.endsWith("manifest.mf") => MergeStrategy.discard

0 commit comments

Comments
 (0)