Skip to content

Commit e3fd6a6

Browse files
committed
Merge branch 'master' into takeSample
2 parents 7cab53a + 9a5d482 commit e3fd6a6

File tree

62 files changed

+3412
-2035
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3412
-2035
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
sbt/*.jar
88
.settings
99
.cache
10-
.mima-excludes
10+
.generated-mima-excludes
1111
/build/
1212
work/
1313
out/

.rat-excludes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ target
33
.project
44
.classpath
55
.mima-excludes
6+
.generated-mima-excludes
67
.rat-excludes
78
.*md
89
derby.log

core/pom.xml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -263,35 +263,6 @@
263263
<outputDirectory>target/scala-${scala.binary.version}/classes</outputDirectory>
264264
<testOutputDirectory>target/scala-${scala.binary.version}/test-classes</testOutputDirectory>
265265
<plugins>
266-
<plugin>
267-
<groupId>org.apache.maven.plugins</groupId>
268-
<artifactId>maven-antrun-plugin</artifactId>
269-
<executions>
270-
<execution>
271-
<phase>test</phase>
272-
<goals>
273-
<goal>run</goal>
274-
</goals>
275-
<configuration>
276-
<exportAntProperties>true</exportAntProperties>
277-
<target>
278-
<property name="spark.classpath" refid="maven.test.classpath" />
279-
<property environment="env" />
280-
<fail message="Please set the SCALA_HOME (or SCALA_LIBRARY_PATH if scala is on the path) environment variables and retry.">
281-
<condition>
282-
<not>
283-
<or>
284-
<isset property="env.SCALA_HOME" />
285-
<isset property="env.SCALA_LIBRARY_PATH" />
286-
</or>
287-
</not>
288-
</condition>
289-
</fail>
290-
</target>
291-
</configuration>
292-
</execution>
293-
</executions>
294-
</plugin>
295266
<plugin>
296267
<groupId>org.scalatest</groupId>
297268
<artifactId>scalatest-maven-plugin</artifactId>

core/src/main/scala/org/apache/spark/SparkContext.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ class SparkContext(config: SparkConf) extends Logging {
7676
* :: DeveloperApi ::
7777
* Alternative constructor for setting preferred locations where Spark will create executors.
7878
*
79-
* @param preferredNodeLocationData used in YARN mode to select nodes to launch containers on. Ca
80-
* be generated using [[org.apache.spark.scheduler.InputFormatInfo.computePreferredLocations]]
79+
* @param preferredNodeLocationData used in YARN mode to select nodes to launch containers on.
80+
* Can be generated using [[org.apache.spark.scheduler.InputFormatInfo.computePreferredLocations]]
8181
* from a list of input files or InputFormats for the application.
8282
*/
8383
@DeveloperApi

core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,26 @@ private object SpecialLengths {
269269
private[spark] object PythonRDD {
270270
val UTF8 = Charset.forName("UTF-8")
271271

272+
/**
273+
* Adapter for calling SparkContext#runJob from Python.
274+
*
275+
* This method will return an iterator of an array that contains all elements in the RDD
276+
* (effectively a collect()), but allows you to run on a certain subset of partitions,
277+
* or to enable local execution.
278+
*/
279+
def runJob(
280+
sc: SparkContext,
281+
rdd: JavaRDD[Array[Byte]],
282+
partitions: JArrayList[Int],
283+
allowLocal: Boolean): Iterator[Array[Byte]] = {
284+
type ByteArray = Array[Byte]
285+
type UnrolledPartition = Array[ByteArray]
286+
val allPartitions: Array[UnrolledPartition] =
287+
sc.runJob(rdd, (x: Iterator[ByteArray]) => x.toArray, partitions, allowLocal)
288+
val flattenedPartition: UnrolledPartition = Array.concat(allPartitions: _*)
289+
flattenedPartition.iterator
290+
}
291+
272292
def readRDDFromFile(sc: JavaSparkContext, filename: String, parallelism: Int):
273293
JavaRDD[Array[Byte]] = {
274294
val file = new DataInputStream(new FileInputStream(filename))

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,16 +381,19 @@ private[spark] class SparkSubmitArguments(args: Seq[String]) {
381381
object SparkSubmitArguments {
382382
/** Load properties present in the given file. */
383383
def getPropertiesFromFile(file: File): Seq[(String, String)] = {
384-
require(file.exists(), s"Properties file ${file.getName} does not exist")
384+
require(file.exists(), s"Properties file $file does not exist")
385+
require(file.isFile(), s"Properties file $file is not a normal file")
385386
val inputStream = new FileInputStream(file)
386-
val properties = new Properties()
387387
try {
388+
val properties = new Properties()
388389
properties.load(inputStream)
390+
properties.stringPropertyNames().toSeq.map(k => (k, properties(k).trim))
389391
} catch {
390392
case e: IOException =>
391-
val message = s"Failed when loading Spark properties file ${file.getName}"
393+
val message = s"Failed when loading Spark properties file $file"
392394
throw new SparkException(message, e)
395+
} finally {
396+
inputStream.close()
393397
}
394-
properties.stringPropertyNames().toSeq.map(k => (k, properties(k).trim))
395398
}
396399
}

core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,23 @@ private[spark] class ExecutorRunner(
6161
// Shutdown hook that kills actors on shutdown.
6262
shutdownHook = new Thread() {
6363
override def run() {
64-
killProcess()
64+
killProcess(Some("Worker shutting down"))
6565
}
6666
}
6767
Runtime.getRuntime.addShutdownHook(shutdownHook)
6868
}
6969

70-
private def killProcess() {
70+
/**
71+
* kill executor process, wait for exit and notify worker to update resource status
72+
*
73+
* @param message the exception message which caused the executor's death
74+
*/
75+
private def killProcess(message: Option[String]) {
7176
if (process != null) {
7277
logInfo("Killing process!")
7378
process.destroy()
74-
process.waitFor()
79+
val exitCode = process.waitFor()
80+
worker ! ExecutorStateChanged(appId, execId, state, message, Some(exitCode))
7581
}
7682
}
7783

@@ -82,7 +88,6 @@ private[spark] class ExecutorRunner(
8288
workerThread.interrupt()
8389
workerThread = null
8490
state = ExecutorState.KILLED
85-
worker ! ExecutorStateChanged(appId, execId, state, None, None)
8691
Runtime.getRuntime.removeShutdownHook(shutdownHook)
8792
}
8893
}
@@ -148,14 +153,13 @@ private[spark] class ExecutorRunner(
148153
} catch {
149154
case interrupted: InterruptedException => {
150155
logInfo("Runner thread for executor " + fullId + " interrupted")
151-
killProcess()
156+
state = ExecutorState.KILLED
157+
killProcess(None)
152158
}
153159
case e: Exception => {
154160
logError("Error running executor", e)
155-
killProcess()
156161
state = ExecutorState.FAILED
157-
val message = e.getClass + ": " + e.getMessage
158-
worker ! ExecutorStateChanged(appId, execId, state, Some(message), None)
162+
killProcess(Some(e.toString))
159163
}
160164
}
161165
}

dev/mima

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more
5+
# contributor license agreements. See the NOTICE file distributed with
6+
# this work for additional information regarding copyright ownership.
7+
# The ASF licenses this file to You under the Apache License, Version 2.0
8+
# (the "License"); you may not use this file except in compliance with
9+
# the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
20+
set -o pipefail
21+
22+
# Go to the Spark project root directory
23+
FWDIR="$(cd `dirname $0`/..; pwd)"
24+
cd $FWDIR
25+
26+
./bin/spark-class org.apache.spark.tools.GenerateMIMAIgnore
27+
echo -e "q\n" | sbt/sbt mima-report-binary-issues | grep -v -e "info.*Resolving"
28+
ret_val=$?
29+
30+
if [ $ret_val != 0 ]; then
31+
echo "NOTE: Exceptions to binary compatibility can be added in project/MimaExcludes.scala"
32+
fi
33+
34+
exit $ret_val

dev/run-tests

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,4 @@ fi
8181
echo "========================================================================="
8282
echo "Detecting binary incompatibilites with MiMa"
8383
echo "========================================================================="
84-
./bin/spark-class org.apache.spark.tools.GenerateMIMAIgnore
85-
echo -e "q\n" | sbt/sbt mima-report-binary-issues | grep -v -e "info.*Resolving"
84+
dev/mima

docs/_layouts/global.html

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
<title>{{ page.title }} - Spark {{site.SPARK_VERSION_SHORT}} Documentation</title>
1010
<meta name="description" content="">
1111

12+
{% if page.redirect %}
13+
<meta http-equiv="refresh" content="0; url={{page.redirect}}">
14+
<link rel="canonical" href="{{page.redirect}}" />
15+
{% endif %}
16+
1217
<link rel="stylesheet" href="css/bootstrap.min.css">
1318
<style>
1419
body {
@@ -61,15 +66,13 @@
6166
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Programming Guides<b class="caret"></b></a>
6267
<ul class="dropdown-menu">
6368
<li><a href="quick-start.html">Quick Start</a></li>
64-
<li><a href="scala-programming-guide.html">Spark in Scala</a></li>
65-
<li><a href="java-programming-guide.html">Spark in Java</a></li>
66-
<li><a href="python-programming-guide.html">Spark in Python</a></li>
69+
<li><a href="programming-guide.html">Spark Programming Guide</a></li>
6770
<li class="divider"></li>
6871
<li><a href="streaming-programming-guide.html">Spark Streaming</a></li>
6972
<li><a href="sql-programming-guide.html">Spark SQL</a></li>
7073
<li><a href="mllib-guide.html">MLlib (Machine Learning)</a></li>
71-
<li><a href="bagel-programming-guide.html">Bagel (Pregel on Spark)</a></li>
7274
<li><a href="graphx-programming-guide.html">GraphX (Graph Processing)</a></li>
75+
<li><a href="bagel-programming-guide.html">Bagel (Pregel on Spark)</a></li>
7376
</ul>
7477
</li>
7578

@@ -86,6 +89,8 @@
8689
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Deploying<b class="caret"></b></a>
8790
<ul class="dropdown-menu">
8891
<li><a href="cluster-overview.html">Overview</a></li>
92+
<li><a href="submitting-applications.html">Submitting Applications</a></li>
93+
<li class="divider"></li>
8994
<li><a href="ec2-scripts.html">Amazon EC2</a></li>
9095
<li><a href="spark-standalone.html">Standalone Mode</a></li>
9196
<li><a href="running-on-mesos.html">Mesos</a></li>
@@ -99,9 +104,10 @@
99104
<li><a href="configuration.html">Configuration</a></li>
100105
<li><a href="monitoring.html">Monitoring</a></li>
101106
<li><a href="tuning.html">Tuning Guide</a></li>
102-
<li><a href="hadoop-third-party-distributions.html">Running with CDH/HDP</a></li>
103-
<li><a href="hardware-provisioning.html">Hardware Provisioning</a></li>
104107
<li><a href="job-scheduling.html">Job Scheduling</a></li>
108+
<li><a href="security.html">Security</a></li>
109+
<li><a href="hardware-provisioning.html">Hardware Provisioning</a></li>
110+
<li><a href="hadoop-third-party-distributions.html">3<sup>rd</sup>-Party Hadoop Distros</a></li>
105111
<li class="divider"></li>
106112
<li><a href="building-with-maven.html">Building Spark with Maven</a></li>
107113
<li><a href="https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark">Contributing to Spark</a></li>

0 commit comments

Comments
 (0)