Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion network/yarn/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
<sbt.project.name>network-yarn</sbt.project.name>
<!-- Make sure all Hadoop dependencies are provided to avoid repackaging. -->
<hadoop.deps.scope>provided</hadoop.deps.scope>
<shuffle.jar>${project.build.directory}/scala-${scala.binary.version}/spark-${project.version}-yarn-shuffle.jar</shuffle.jar>
<shaded.jackson>org/spark-project/com/fasterxml/jackson</shaded.jackson>
</properties>

<dependencies>
Expand Down Expand Up @@ -70,7 +72,7 @@
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<outputFile>${project.build.directory}/scala-${scala.binary.version}/spark-${project.version}-yarn-shuffle.jar</outputFile>
<outputFile>${shuffle.jar}</outputFile>
<artifactSet>
<includes>
<include>*:*</include>
Expand All @@ -86,6 +88,15 @@
</excludes>
</filter>
</filters>
<relocations>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about doing this for all of Spark?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm now thinking all the dependencies should be relocated, with the exception of the jni leveldb stuff —not the thing you can shade; not the thing you can isolate in a classloader hierarchy instead.

What I can do there is add a profile, leveldb-provided which excludes leveldb in this situation. That's important as leveldb does creep onto the classpath from elsewhere —and while the version in Hadoop currently matches that in this JAR, there's no guarantee of that continuing to hold.

<relocation>
<pattern>com.fasterxml.jackson</pattern>
<shadedPattern>org.spark-project.com.fasterxml.jackson</shadedPattern>
<includes>
<include>com.fasterxml.jackson.**</include>
</includes>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
Expand All @@ -96,6 +107,54 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem worth the complexity; why would the shading fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regression control. How do you think I got it to work in the first place? How to verify that it keeps working? I want to add some more shading; for that I'll use a small ant macro to make things terser.

Consider this: A build is an execution of a program; programs needs tests. This is the test of the shading process.

<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<fail message="Not found: ${shaded.jackson}/core/JsonParser.class">
<condition>
<not>
<resourceexists>
<zipentry zipfile="${shuffle.jar}"
name="${shaded.jackson}/core/JsonParser.class"/>
</resourceexists>
</not>
</condition>
</fail>
<fail message="Not found: ${shaded.jackson}/annotation/JacksonAnnotation.class">
<condition>
<not>
<resourceexists>
<zipentry zipfile="${shuffle.jar}"
name="${shaded.jackson}/annotation/JacksonAnnotation.class"/>
</resourceexists>
</not>
</condition>
</fail>
<fail message="Not found: ${shaded.jackson}/databind/JsonSerializer.class">
<condition>
<not>
<resourceexists>
<zipentry zipfile="${shuffle.jar}"
name="${shaded.jackson}/databind/JsonSerializer.class"/>
</resourceexists>
</not>
</condition>
</fail>
<echo>Verified shading of Jackson ${fasterxml.jackson.version}</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>