Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
681b36f
Fix for SPARK-1758: failing test org.apache.spark.JavaAPISuite.wholeT…
nishkamravi2 May 8, 2014
5108700
Fix in Spark for the Concurrent thread modification issue (SPARK-1097…
nishkamravi2 Jun 3, 2014
6b840f0
Undo the fix for SPARK-1758 (the problem is fixed)
nishkamravi2 Jun 3, 2014
df2aeb1
Improved fix for ConcurrentModificationIssue (Spark-1097, Hadoop-10456)
nishkamravi2 Jun 9, 2014
eb663ca
Merge branch 'master' of https://github.com/apache/spark
nishkamravi2 Jun 9, 2014
5423a03
Merge branch 'master' of https://github.com/apache/spark
nishkamravi2 Jun 10, 2014
3bf8fad
Merge branch 'master' of https://github.com/apache/spark
nishkamravi2 Jun 16, 2014
2b630f9
Accept memory input as "30g", "512M" instead of an int value, to be c…
nishkamravi2 Jun 16, 2014
efd688a
Merge branch 'master' of https://github.com/apache/spark
nishkamravi2 Jul 13, 2014
2e69f11
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Sep 21, 2014
ebcde10
Modify default YARN memory_overhead-- from an additive constant to a …
nishkamravi2 Sep 22, 2014
1cf2d1e
Update YarnAllocator.scala
nishkamravi2 Sep 22, 2014
f00fa31
Improving logging for AM memoryOverhead
nishkamravi2 Sep 22, 2014
c726bd9
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Sep 25, 2014
362da5e
Additional changes for yarn memory overhead
nishkamravi2 Sep 25, 2014
42c2c3d
Additional changes for yarn memory overhead issue
nishkamravi2 Sep 25, 2014
dac1047
Additional documentation for yarn memory overhead issue
nishkamravi2 Sep 25, 2014
5ac2ec1
Remove out
nishkamravi2 Sep 25, 2014
35daa64
Slight change in the doc for yarn memory overhead
nishkamravi2 Sep 25, 2014
8f76c8b
Doc change for yarn memory overhead
nishkamravi2 Sep 25, 2014
636a9ff
Update YarnAllocator.scala
nishkamravi2 Sep 30, 2014
5f8f9ed
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Nov 19, 2014
9f6583e
Changes to maxResultSize code (improve error message and add conditio…
nishkamravi2 Nov 19, 2014
3e1b616
Modify test for maxResultSize
nishkamravi2 Nov 19, 2014
535295a
Update TaskSetManager.scala
nishkamravi2 Nov 19, 2014
5c9a4cb
Update TaskSetManagerSuite.scala
nishkamravi2 Nov 19, 2014
b446edc
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Nov 19, 2014
79ea8b4
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Feb 19, 2015
f0d12de
Workaround for IllegalStateException caused by recent changes to Bloc…
nishkamravi2 Feb 19, 2015
3c5ddba
Update DiskBlockManager.scala
nishkamravi2 Feb 19, 2015
494d8c0
Update DiskBlockManager.scala
nishkamravi2 Feb 19, 2015
71d0e17
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Feb 20, 2015
ba1eb8b
Try-catch block around the two occurrences of removeShutDownHook. Del…
nishkamravi2 Feb 20, 2015
f7e33c2
Merge branch 'master_nravi' of https://github.com/nishkamravi2/spark …
nishkamravi2 Feb 20, 2015
0ce2c32
Update HadoopRDD.scala
nishkamravi2 Feb 20, 2015
6f41a1d
Update NewHadoopRDD.scala
nishkamravi2 Feb 20, 2015
d453197
Update NewHadoopRDD.scala
nishkamravi2 Feb 20, 2015
ee902fa
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Mar 18, 2015
bfe96e0
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Mar 19, 2015
746f35b
"hadoop" string in the assembly name should not be mandatory (everywh…
nishkamravi2 Mar 19, 2015
4bd4489
Update AbstractCommandBuilder.java
nishkamravi2 Mar 19, 2015
32c3ab3
Update AbstractCommandBuilder.java
nishkamravi2 Mar 19, 2015
35af990
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Mar 20, 2015
06bfeb0
Update spark-class
nishkamravi2 Mar 20, 2015
ac58975
spark-class changes
nishkamravi2 Mar 20, 2015
345206a
spark-class merge
nishkamravi2 Mar 20, 2015
3faa7a4
Launcher library changes (SPARK-6406)
nishkamravi2 Mar 23, 2015
ccdc334
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Mar 23, 2015
d9658d6
Changes for SPARK-6406
nishkamravi2 Mar 24, 2015
458af39
Locate the jar using getLocation, obviates the need to pass assembly …
nishkamravi2 Mar 24, 2015
4a45d6a
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Mar 24, 2015
b7f4ae7
Merge branch 'master' of https://github.com/apache/spark into master_…
nishkamravi2 Mar 27, 2015
36a6f87
Minor changes and bug fixes
nishkamravi2 Mar 27, 2015
bad4349
Update Main.java
nishkamravi2 Mar 27, 2015
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: 36 additions & 25 deletions bin/spark-class
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,46 @@ else
fi
fi

# Look for the launcher. In non-release mode, add the compiled classes directly to the classpath
# instead of looking for a jar file.
SPARK_LAUNCHER_CP=
if [ -f $SPARK_HOME/RELEASE ]; then
LAUNCHER_DIR="$SPARK_HOME/lib"
num_jars="$(ls -1 "$LAUNCHER_DIR" | grep "^spark-launcher.*\.jar$" | wc -l)"
if [ "$num_jars" -eq "0" -a -z "$SPARK_LAUNCHER_CP" ]; then
echo "Failed to find Spark launcher in $LAUNCHER_DIR." 1>&2
echo "You need to build Spark before running this program." 1>&2
exit 1
fi
# Find assembly jar
SPARK_ASSEMBLY_JAR=
if [ -f "$SPARK_HOME/RELEASE" ]; then
ASSEMBLY_DIR="$SPARK_HOME/lib"
else
ASSEMBLY_DIR="$SPARK_HOME/assembly/target/scala-$SPARK_SCALA_VERSION"
fi

LAUNCHER_JARS="$(ls -1 "$LAUNCHER_DIR" | grep "^spark-launcher.*\.jar$" || true)"
if [ "$num_jars" -gt "1" ]; then
echo "Found multiple Spark launcher jars in $LAUNCHER_DIR:" 1>&2
echo "$LAUNCHER_JARS" 1>&2
echo "Please remove all but one jar." 1>&2
exit 1
fi
num_jars="$(ls -1 "$ASSEMBLY_DIR" | grep "^spark-assembly.*hadoop.*\.jar$" | wc -l)"
if [ "$num_jars" -eq "0" -a -z "$SPARK_ASSEMBLY_JAR" ]; then
echo "Failed to find Spark assembly in $ASSEMBLY_DIR." 1>&2
echo "You need to build Spark before running this program." 1>&2
exit 1
fi
ASSEMBLY_JARS="$(ls -1 "$ASSEMBLY_DIR" | grep "^spark-assembly.*hadoop.*\.jar$" || true)"
if [ "$num_jars" -gt "1" ]; then
echo "Found multiple Spark assembly jars in $ASSEMBLY_DIR:" 1>&2
echo "$ASSEMBLY_JARS" 1>&2
echo "Please remove all but one jar." 1>&2
exit 1
fi

SPARK_LAUNCHER_CP="${LAUNCHER_DIR}/${LAUNCHER_JARS}"
SPARK_ASSEMBLY_JAR="${ASSEMBLY_DIR}/${ASSEMBLY_JARS}"

# Verify that versions of java used to build the jars and run Spark are compatible
if [ -n "$JAVA_HOME" ]; then
JAR_CMD="$JAVA_HOME/bin/jar"
else
LAUNCHER_DIR="$SPARK_HOME/launcher/target/scala-$SPARK_SCALA_VERSION"
if [ ! -d "$LAUNCHER_DIR/classes" ]; then
echo "Failed to find Spark launcher classes in $LAUNCHER_DIR." 1>&2
echo "You need to build Spark before running this program." 1>&2
JAR_CMD="jar"
fi

if [ $(command -v "$JAR_CMD") ] ; then
jar_error_check=$("$JAR_CMD" -tf "$SPARK_ASSEMBLY_JAR" nonexistent/class/path 2>&1)
if [[ "$jar_error_check" =~ "invalid CEN header" ]]; then
echo "Loading Spark jar with '$JAR_CMD' failed. " 1>&2
echo "This is likely because Spark was compiled with Java 7 and run " 1>&2
echo "with Java 6. (see SPARK-1703). Please use Java 7 to run Spark " 1>&2
echo "or build Spark with Java 6." 1>&2
exit 1
fi
SPARK_LAUNCHER_CP="$LAUNCHER_DIR/classes"
fi

# The launcher library will print arguments separated by a NULL character, to allow arguments with
Expand All @@ -77,7 +88,7 @@ fi
CMD=()
while IFS= read -d '' -r ARG; do
CMD+=("$ARG")
done < <("$RUNNER" -cp "$SPARK_LAUNCHER_CP" org.apache.spark.launcher.Main "$@")
done < <("$RUNNER" -cp "$SPARK_ASSEMBLY_JAR" org.apache.spark.launcher.Main "$@")

if [ "${CMD[0]}" = "usage" ]; then
"${CMD[@]}"
Expand Down
33 changes: 11 additions & 22 deletions bin/spark-class2.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,20 @@ if "x%1"=="x" (
exit /b 1
)

set LAUNCHER_CP=0
if exist %SPARK_HOME%\RELEASE goto find_release_launcher
rem Find assembly jar
set SPARK_ASSEMBLY_JAR=0

rem Look for the Spark launcher in both Scala build directories. The launcher doesn't use Scala so
rem it doesn't really matter which one is picked up. Add the compiled classes directly to the
rem classpath instead of looking for a jar file, since it's very common for people using sbt to use
rem the "assembly" target instead of "package".
set LAUNCHER_CLASSES=%SPARK_HOME%\launcher\target\scala-2.10\classes
if exist %LAUNCHER_CLASSES% (
set LAUNCHER_CP=%LAUNCHER_CLASSES%
if exist "%SPARK_HOME%\RELEASE" (
set ASSEMBLY_DIR=%SPARK_HOME%\lib
) else (
set ASSEMBLY_DIR=%SPARK_HOME%\assembly\target\scala-%SPARK_SCALA_VERSION%
)
set LAUNCHER_CLASSES=%SPARK_HOME%\launcher\target\scala-2.11\classes
if exist %LAUNCHER_CLASSES% (
set LAUNCHER_CP=%LAUNCHER_CLASSES%
)
goto check_launcher

:find_release_launcher
for %%d in (%SPARK_HOME%\lib\spark-launcher*.jar) do (
set LAUNCHER_CP=%%d
for %%d in (%ASSEMBLY_DIR%\spark-assembly*hadoop*.jar) do (
set SPARK_ASSEMBLY_JAR=%%d
)

:check_launcher
if "%LAUNCHER_CP%"=="0" (
echo Failed to find Spark launcher JAR.
if "%SPARK_ASSEMBLY_JAR%"=="0" (
echo Failed to find Spark assembly JAR.
echo You need to build Spark before running this program.
exit /b 1
)
Expand All @@ -64,7 +53,7 @@ if not "x%JAVA_HOME%"=="x" set RUNNER=%JAVA_HOME%\bin\java

rem The launcher library prints the command to be executed in a single line suitable for being
rem executed by the batch interpreter. So read all the output of the launcher into a variable.
for /f "tokens=*" %%i in ('cmd /C ""%RUNNER%" -cp %LAUNCHER_CP% org.apache.spark.launcher.Main %*"') do (
for /f "tokens=*" %%i in ('cmd /C ""%RUNNER%" -cp %SPARK_ASSEMBLY_JAR% org.apache.spark.launcher.Main %*"') do (
set SPARK_CMD=%%i
)
%SPARK_CMD%
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,14 @@ public AbstractCommandBuilder() {
*/
List<String> buildJavaCommand(String extraClassPath) throws IOException {
List<String> cmd = new ArrayList<String>();
if (javaHome == null) {
cmd.add(join(File.separator, System.getProperty("java.home"), "bin", "java"));
} else {
String envJavaHome;

if (javaHome != null) {
cmd.add(join(File.separator, javaHome, "bin", "java"));
} else if ((envJavaHome = System.getenv("JAVA_HOME")) != null) {
cmd.add(join(File.separator, envJavaHome, "bin", "java"));
} else {
cmd.add(join(File.separator, System.getProperty("java.home"), "bin", "java"));
}

// Load extra JAVA_OPTS from conf/java-opts, if it exists.
Expand Down Expand Up @@ -182,59 +186,25 @@ List<String> buildClassPath(String appClassPath) throws IOException {
addToClassPath(cp, String.format("%s/core/target/jars/*", sparkHome));
}

String assembly = findAssembly();
final String assembly = AbstractCommandBuilder.class.getProtectionDomain().getCodeSource().
getLocation().getPath();
addToClassPath(cp, assembly);

// When Hive support is needed, Datanucleus jars must be included on the classpath. Datanucleus
// jars do not work if only included in the uber jar as plugin.xml metadata is lost. Both sbt
// and maven will populate "lib_managed/jars/" with the datanucleus jars when Spark is built
// with Hive, so first check if the datanucleus jars exist, and then ensure the current Spark
// assembly is built for Hive, before actually populating the CLASSPATH with the jars.
//
// This block also serves as a check for SPARK-1703, when the assembly jar is built with
// Java 7 and ends up with too many files, causing issues with other JDK versions.
boolean needsDataNucleus = false;
JarFile assemblyJar = null;
try {
assemblyJar = new JarFile(assembly);
needsDataNucleus = assemblyJar.getEntry("org/apache/hadoop/hive/ql/exec/") != null;
} catch (IOException ioe) {
if (ioe.getMessage().indexOf("invalid CEN header") >= 0) {
System.err.println(
"Loading Spark jar failed.\n" +
"This is likely because Spark was compiled with Java 7 and run\n" +
"with Java 6 (see SPARK-1703). Please use Java 7 to run Spark\n" +
"or build Spark with Java 6.");
System.exit(1);
} else {
throw ioe;
}
} finally {
if (assemblyJar != null) {
try {
assemblyJar.close();
} catch (IOException e) {
// Ignore.
}
}
// Datanucleus jars must be included on the classpath. Datanucleus jars do not work if only
// included in the uber jar as plugin.xml metadata is lost. Both sbt and maven will populate
// "lib_managed/jars/" with the datanucleus jars when Spark is built with Hive
File libdir;
if (new File(sparkHome, "RELEASE").isFile()) {
libdir = new File(sparkHome, "lib");
} else {
libdir = new File(sparkHome, "lib_managed/jars");
}

if (needsDataNucleus) {
System.err.println("Spark assembly has been built with Hive, including Datanucleus jars " +
"in classpath.");
File libdir;
if (new File(sparkHome, "RELEASE").isFile()) {
libdir = new File(sparkHome, "lib");
} else {
libdir = new File(sparkHome, "lib_managed/jars");
}

checkState(libdir.isDirectory(), "Library directory '%s' does not exist.",
libdir.getAbsolutePath());
for (File jar : libdir.listFiles()) {
if (jar.getName().startsWith("datanucleus-")) {
addToClassPath(cp, jar.getAbsolutePath());
}
checkState(libdir.isDirectory(), "Library directory '%s' does not exist.",
libdir.getAbsolutePath());
for (File jar : libdir.listFiles()) {
if (jar.getName().startsWith("datanucleus-")) {
addToClassPath(cp, jar.getAbsolutePath());
}
}

Expand Down Expand Up @@ -270,7 +240,6 @@ String getScalaVersion() {
if (scala != null) {
return scala;
}

String sparkHome = getSparkHome();
File scala210 = new File(sparkHome, "assembly/target/scala-2.10");
File scala211 = new File(sparkHome, "assembly/target/scala-2.11");
Expand Down Expand Up @@ -330,30 +299,6 @@ String getenv(String key) {
return firstNonEmpty(childEnv.get(key), System.getenv(key));
}

private String findAssembly() {
String sparkHome = getSparkHome();
File libdir;
if (new File(sparkHome, "RELEASE").isFile()) {
libdir = new File(sparkHome, "lib");
checkState(libdir.isDirectory(), "Library directory '%s' does not exist.",
libdir.getAbsolutePath());
} else {
libdir = new File(sparkHome, String.format("assembly/target/scala-%s", getScalaVersion()));
}

final Pattern re = Pattern.compile("spark-assembly.*hadoop.*\\.jar");
FileFilter filter = new FileFilter() {
@Override
public boolean accept(File file) {
return file.isFile() && re.matcher(file.getName()).matches();
}
};
File[] assemblies = libdir.listFiles(filter);
checkState(assemblies != null && assemblies.length > 0, "No assemblies found in '%s'.", libdir);
checkState(assemblies.length == 1, "Multiple assemblies found in '%s'.", libdir);
return assemblies[0].getAbsolutePath();
}

private String getConfDir() {
String confDir = getenv("SPARK_CONF_DIR");
return confDir != null ? confDir : join(File.separator, getSparkHome(), "conf");
Expand Down
1 change: 0 additions & 1 deletion make-distribution.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ echo "Build flags: $@" >> "$DISTDIR/RELEASE"
# Copy jars
cp "$SPARK_HOME"/assembly/target/scala*/*assembly*hadoop*.jar "$DISTDIR/lib/"
cp "$SPARK_HOME"/examples/target/scala*/spark-examples*.jar "$DISTDIR/lib/"
cp "$SPARK_HOME"/launcher/target/spark-launcher_$SCALA_VERSION-$VERSION.jar "$DISTDIR/lib/"
# This will fail if the -Pyarn profile is not provided
# In this case, silence the error and ignore the return code of this command
cp "$SPARK_HOME"/network/yarn/target/scala*/spark-*-yarn-shuffle.jar "$DISTDIR/lib/" &> /dev/null || :
Expand Down