Skip to content

[WIP] [SPARK-1698]: Improve spark integration #598

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
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
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
57 changes: 9 additions & 48 deletions assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.spark</groupId>
Expand Down Expand Up @@ -80,51 +81,21 @@

<build>
<plugins>
<!-- Use the shade plugin to create a big JAR with all the dependencies -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<outputFile>${spark.jar}</outputFile>
<artifactSet>
<includes>
<include>*:*</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>org.datanucleus:*</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>dist</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
<goal>single</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/org.apache.hadoop.fs.FileSystem</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
<resource>log4j.properties</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/>
</transformers>
<finalName>${project.artifactId}-${project.version}</finalName>
<descriptors>
<descriptor>src/main/assembly/spark-dist.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -153,16 +124,6 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>hive</id>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_${scala.binary.version}</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spark-ganglia-lgpl</id>
<dependencies>
Expand Down
97 changes: 97 additions & 0 deletions assembly/src/main/assembly/spark-dist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<assembly>
<id>spark-dist</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>

<fileSets>
<fileSet>
<includes>
<include>README</include>
</includes>
</fileSet>
<fileSet>
<directory>
${project.parent.basedir}/sbin/
</directory>
<outputDirectory>/sbin</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>
${project.parent.basedir}/ec2/
</directory>
<outputDirectory>/ec2</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>
${project.parent.basedir}/bin/
</directory>
<outputDirectory>/bin</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>
${project.parent.basedir}/conf/
</directory>
<outputDirectory>/conf</outputDirectory>
<includes>
<include>**/*.template</include>
<include>**/slaves</include>
</includes>
</fileSet>
<fileSet>
<directory>
${project.parent.basedir}/python/
</directory>
<outputDirectory>/python</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
</fileSets>

<dependencySets>
<dependencySet>
<outputDirectory>/share/spark/core</outputDirectory>
<includes>
<include>org.apache.spark:*:jar</include>
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>/share/spark/core/lib</outputDirectory>
<useTransitiveDependencies>true</useTransitiveDependencies>
<unpack>false</unpack>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<excludes>
<exclude>org.apache.spark:*:jar</exclude>
</excludes>
</dependencySet>
</dependencySets>

</assembly>
48 changes: 48 additions & 0 deletions assembly/src/main/assembly/spark-examples-dist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<assembly>
<id>spark-examples-dist</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>

<dependencySets>
<dependencySet>
<outputDirectory>/share/spark/examples</outputDirectory>
<includes>
<include>org.apache.spark:spark-examples*:jar</include>
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>/share/spark/examples/lib</outputDirectory>
<useTransitiveDependencies>true</useTransitiveDependencies>
<unpack>false</unpack>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<excludes>
<exclude>org.apache.spark:*:jar</exclude>
<exclude>org.apache.hadoop:*:jar</exclude>
<exclude>org.slf4j:slf4j-api</exclude>
<exclude>org.slf4j:slf4j-log4j12</exclude>
<exclude>log4j:log4j</exclude>
<exclude>org.scala-lang:*:jar</exclude>
</excludes>
</dependencySet>
</dependencySets>

</assembly>
46 changes: 46 additions & 0 deletions assembly/src/main/assembly/spark-hive-dist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<assembly>
<id>spark-hive-dist</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/share/spark/hive</outputDirectory>
<includes>
<include>org.apache.spark:spark-hive*:jar</include>
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>/share/spark/hive/lib</outputDirectory>
<useTransitiveDependencies>true</useTransitiveDependencies>
<unpack>false</unpack>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<excludes>
<exclude>org.apache.spark:*:jar</exclude>
<exclude>org.apache.hadoop:*:jar</exclude>
<exclude>org.slf4j:slf4j-api</exclude>
<exclude>org.slf4j:slf4j-log4j12</exclude>
<exclude>log4j:log4j</exclude>
<exclude>org.scala-lang:*:jar</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
22 changes: 19 additions & 3 deletions bin/compute-classpath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,27 @@ if [ -f "$ASSEMBLY_DIR"/spark-assembly*hadoop*-deps.jar ]; then

ASSEMBLY_JAR=$(ls "$ASSEMBLY_DIR"/spark-assembly*hadoop*-deps.jar 2>/dev/null)
else
# Else use spark-assembly jar from either RELEASE or assembly directory
if [ -f "$FWDIR/RELEASE" ]; then
ASSEMBLY_JAR=$(ls "$FWDIR"/lib/spark-assembly*hadoop*.jar 2>/dev/null)
CLASSPATH="$CLASSPATH:$FWDIR/share/spark/core/*:$FWDIR/share/spark/core/lib/*"
if [ -d "$FWDIR/share/spark/hive" ]; then
CLASSPATH="$CLASSPATH:$FWDIR/share/spark/hive/*:$FWDIR/share/spark/hive/lib/*"
fi
if [ -d "$FWDIR/share/spark/examples" ]; then
CLASSPATH="$CLASSPATH:$FWDIR/share/spark/examples/*:$FWDIR/share/spark/examples/lib/*"
fi
else
ASSEMBLY_JAR=$(ls "$ASSEMBLY_DIR"/spark-assembly*hadoop*.jar 2>/dev/null)
SPARK_DIST=`echo "$FWDIR"/assembly/target/*spark-dist`
if [ -d "$SPARK_DIST" ]; then
CLASSPATH="$CLASSPATH:$SPARK_DIST/share/spark/core/*:$SPARK_DIST/share/spark/core/lib/*"
fi
if [ -d "$FWDIR"/sql/hive/target/*spark-hive-dist/ ]; then
HVIE_DIST=`echo "$FWDIR"/sql/hive/target/*spark-hive-dist`
CLASSPATH="$CLASSPATH:$HVIE_DIST/share/spark/hive/*:$HVIE_DIST/share/spark/hive/lib/*"
fi
ASSEMBLY_JAR=`echo "$ASSEMBLY_DIR"/spark-assembly*hadoop*.jar`
if [ -f "$ASSEMBLY_JAR" ]; then
CLASSPATH="$CLASSPATH:$ASSEMBLY_JAR"
fi
fi
fi

Expand Down
26 changes: 14 additions & 12 deletions bin/spark-class
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,20 @@ export JAVA_OPTS

if [ ! -f "$FWDIR/RELEASE" ]; then
# Exit if the user hasn't compiled Spark
num_jars=$(ls "$FWDIR"/assembly/target/scala-$SCALA_VERSION/ | grep "spark-assembly.*hadoop.*.jar" | wc -l)
jars_list=$(ls "$FWDIR"/assembly/target/scala-$SCALA_VERSION/ | grep "spark-assembly.*hadoop.*.jar")
if [ "$num_jars" -eq "0" ]; then
echo "Failed to find Spark assembly in $FWDIR/assembly/target/scala-$SCALA_VERSION/" >&2
echo "You need to build Spark before running this program." >&2
exit 1
fi
if [ "$num_jars" -gt "1" ]; then
echo "Found multiple Spark assembly jars in $FWDIR/assembly/target/scala-$SCALA_VERSION:" >&2
echo "$jars_list"
echo "Please remove all but one jar."
exit 1
if [ ! -d "$FWDIR"/assembly/target/*spark-dist/ ]; then
num_jars=$(ls "$FWDIR"/assembly/target/scala-$SCALA_VERSION/ | grep "spark-assembly.*hadoop.*.jar" | wc -l)
jars_list=$(ls "$FWDIR"/assembly/target/scala-$SCALA_VERSION/ | grep "spark-assembly.*hadoop.*.jar")
if [ "$num_jars" -eq "0" ]; then
echo "Failed to find Spark assembly in $FWDIR/assembly/target/" >&2
echo "You need to build Spark with './make-distribution.sh' before running this program." >&2
exit 1
fi
if [ "$num_jars" -gt "1" ]; then
echo "Found multiple Spark assembly jars in $FWDIR/assembly/target/scala-$SCALA_VERSION:" >&2
echo "$jars_list"
echo "Please remove all but one jar."
exit 1
fi
fi
fi

Expand Down
Loading