Skip to content

Commit

Permalink
Merge branch 'master' into kafka-0.8.2-test-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
koeninger committed Jun 5, 2015
2 parents 4662828 + 700312e commit 1e89dc8
Show file tree
Hide file tree
Showing 110 changed files with 2,534 additions and 2,338 deletions.
5 changes: 1 addition & 4 deletions R/create-docs.sh
Expand Up @@ -30,10 +30,7 @@ set -e
export FWDIR="$(cd "`dirname "$0"`"; pwd)"
pushd $FWDIR

# Generate Rd file
Rscript -e 'library(devtools); devtools::document(pkg="./pkg", roclets=c("rd"))'

# Install the package
# Install the package (this will also generate the Rd files)
./install-dev.sh

# Now create HTML files
Expand Down
9 changes: 8 additions & 1 deletion R/install-dev.sh
Expand Up @@ -34,5 +34,12 @@ LIB_DIR="$FWDIR/lib"

mkdir -p $LIB_DIR

# Install R
pushd $FWDIR

# Generate Rd files if devtools is installed
Rscript -e ' if("devtools" %in% rownames(installed.packages())) { library(devtools); devtools::document(pkg="./pkg", roclets=c("rd")) }'

# Install SparkR to $LIB_DIR
R CMD INSTALL --library=$LIB_DIR $FWDIR/pkg/

popd
16 changes: 1 addition & 15 deletions bin/pyspark
Expand Up @@ -17,24 +17,10 @@
# limitations under the License.
#

# Figure out where Spark is installed
export SPARK_HOME="$(cd "`dirname "$0"`"/..; pwd)"

source "$SPARK_HOME"/bin/load-spark-env.sh

function usage() {
if [ -n "$1" ]; then
echo $1
fi
echo "Usage: ./bin/pyspark [options]" 1>&2
"$SPARK_HOME"/bin/spark-submit --help 2>&1 | grep -v Usage 1>&2
exit $2
}
export -f usage

if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
usage
fi
export _SPARK_CMD_USAGE="Usage: ./bin/pyspark [options]"

# In Spark <= 1.1, setting IPYTHON=1 would cause the driver to be launched using the `ipython`
# executable, while the worker would still be launched using PYSPARK_PYTHON.
Expand Down
1 change: 1 addition & 0 deletions bin/pyspark2.cmd
Expand Up @@ -21,6 +21,7 @@ rem Figure out where the Spark framework is installed
set SPARK_HOME=%~dp0..

call %SPARK_HOME%\bin\load-spark-env.cmd
set _SPARK_CMD_USAGE=Usage: bin\pyspark.cmd [options]

rem Figure out which Python to use.
if "x%PYSPARK_DRIVER_PYTHON%"=="x" (
Expand Down
13 changes: 1 addition & 12 deletions bin/spark-class
Expand Up @@ -16,18 +16,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -e

# Figure out where Spark is installed
export SPARK_HOME="$(cd "`dirname "$0"`"/..; pwd)"

. "$SPARK_HOME"/bin/load-spark-env.sh

if [ -z "$1" ]; then
echo "Usage: spark-class <class> [<args>]" 1>&2
exit 1
fi

# Find the java binary
if [ -n "${JAVA_HOME}" ]; then
RUNNER="${JAVA_HOME}/bin/java"
Expand Down Expand Up @@ -98,9 +92,4 @@ CMD=()
while IFS= read -d '' -r ARG; do
CMD+=("$ARG")
done < <("$RUNNER" -cp "$LAUNCH_CLASSPATH" org.apache.spark.launcher.Main "$@")

if [ "${CMD[0]}" = "usage" ]; then
"${CMD[@]}"
else
exec "${CMD[@]}"
fi
exec "${CMD[@]}"
15 changes: 1 addition & 14 deletions bin/spark-shell
Expand Up @@ -29,20 +29,7 @@ esac
set -o posix

export FWDIR="$(cd "`dirname "$0"`"/..; pwd)"

usage() {
if [ -n "$1" ]; then
echo "$1"
fi
echo "Usage: ./bin/spark-shell [options]"
"$FWDIR"/bin/spark-submit --help 2>&1 | grep -v Usage 1>&2
exit "$2"
}
export -f usage

if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
usage "" 0
fi
export _SPARK_CMD_USAGE="Usage: ./bin/spark-shell [options]"

# SPARK-4161: scala does not assume use of the java classpath,
# so we need to add the "-Dscala.usejavacp=true" flag manually. We
Expand Down
21 changes: 2 additions & 19 deletions bin/spark-shell2.cmd
Expand Up @@ -18,12 +18,7 @@ rem limitations under the License.
rem

set SPARK_HOME=%~dp0..

echo "%*" | findstr " \<--help\> \<-h\>" >nul
if %ERRORLEVEL% equ 0 (
call :usage
exit /b 0
)
set _SPARK_CMD_USAGE=Usage: .\bin\spark-shell.cmd [options]

rem SPARK-4161: scala does not assume use of the java classpath,
rem so we need to add the "-Dscala.usejavacp=true" flag manually. We
Expand All @@ -37,16 +32,4 @@ if "x%SPARK_SUBMIT_OPTS%"=="x" (
set SPARK_SUBMIT_OPTS="%SPARK_SUBMIT_OPTS% -Dscala.usejavacp=true"

:run_shell
call %SPARK_HOME%\bin\spark-submit2.cmd --class org.apache.spark.repl.Main %*
set SPARK_ERROR_LEVEL=%ERRORLEVEL%
if not "x%SPARK_LAUNCHER_USAGE_ERROR%"=="x" (
call :usage
exit /b 1
)
exit /b %SPARK_ERROR_LEVEL%

:usage
echo %SPARK_LAUNCHER_USAGE_ERROR%
echo "Usage: .\bin\spark-shell.cmd [options]" >&2
call %SPARK_HOME%\bin\spark-submit2.cmd --help 2>&1 | findstr /V "Usage" 1>&2
goto :eof
%SPARK_HOME%\bin\spark-submit2.cmd --class org.apache.spark.repl.Main %*
39 changes: 2 additions & 37 deletions bin/spark-sql
Expand Up @@ -17,41 +17,6 @@
# limitations under the License.
#

#
# Shell script for starting the Spark SQL CLI

# Enter posix mode for bash
set -o posix

# NOTE: This exact class name is matched downstream by SparkSubmit.
# Any changes need to be reflected there.
export CLASS="org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver"

# Figure out where Spark is installed
export FWDIR="$(cd "`dirname "$0"`"/..; pwd)"

function usage {
if [ -n "$1" ]; then
echo "$1"
fi
echo "Usage: ./bin/spark-sql [options] [cli option]"
pattern="usage"
pattern+="\|Spark assembly has been built with Hive"
pattern+="\|NOTE: SPARK_PREPEND_CLASSES is set"
pattern+="\|Spark Command: "
pattern+="\|--help"
pattern+="\|======="

"$FWDIR"/bin/spark-submit --help 2>&1 | grep -v Usage 1>&2
echo
echo "CLI options:"
"$FWDIR"/bin/spark-class "$CLASS" --help 2>&1 | grep -v "$pattern" 1>&2
exit "$2"
}
export -f usage

if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
usage "" 0
fi

exec "$FWDIR"/bin/spark-submit --class "$CLASS" "$@"
export _SPARK_CMD_USAGE="Usage: ./bin/spark-sql [options] [cli option]"
exec "$FWDIR"/bin/spark-submit --class org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver "$@"
12 changes: 0 additions & 12 deletions bin/spark-submit
Expand Up @@ -22,16 +22,4 @@ SPARK_HOME="$(cd "`dirname "$0"`"/..; pwd)"
# disable randomized hash for string in Python 3.3+
export PYTHONHASHSEED=0

# Only define a usage function if an upstream script hasn't done so.
if ! type -t usage >/dev/null 2>&1; then
usage() {
if [ -n "$1" ]; then
echo "$1"
fi
"$SPARK_HOME"/bin/spark-class org.apache.spark.deploy.SparkSubmit --help
exit "$2"
}
export -f usage
fi

exec "$SPARK_HOME"/bin/spark-class org.apache.spark.deploy.SparkSubmit "$@"
13 changes: 1 addition & 12 deletions bin/spark-submit2.cmd
Expand Up @@ -24,15 +24,4 @@ rem disable randomized hash for string in Python 3.3+
set PYTHONHASHSEED=0

set CLASS=org.apache.spark.deploy.SparkSubmit
call %~dp0spark-class2.cmd %CLASS% %*
set SPARK_ERROR_LEVEL=%ERRORLEVEL%
if not "x%SPARK_LAUNCHER_USAGE_ERROR%"=="x" (
call :usage
exit /b 1
)
exit /b %SPARK_ERROR_LEVEL%

:usage
echo %SPARK_LAUNCHER_USAGE_ERROR%
call %SPARK_HOME%\bin\spark-class2.cmd %CLASS% --help
goto :eof
%~dp0spark-class2.cmd %CLASS% %*
18 changes: 1 addition & 17 deletions bin/sparkR
Expand Up @@ -17,23 +17,7 @@
# limitations under the License.
#

# Figure out where Spark is installed
export SPARK_HOME="$(cd "`dirname "$0"`"/..; pwd)"

source "$SPARK_HOME"/bin/load-spark-env.sh

function usage() {
if [ -n "$1" ]; then
echo $1
fi
echo "Usage: ./bin/sparkR [options]" 1>&2
"$SPARK_HOME"/bin/spark-submit --help 2>&1 | grep -v Usage 1>&2
exit $2
}
export -f usage

if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
usage
fi

export _SPARK_CMD_USAGE="Usage: ./bin/sparkR [options]"
exec "$SPARK_HOME"/bin/spark-submit sparkr-shell-main "$@"
11 changes: 9 additions & 2 deletions conf/metrics.properties.template
Expand Up @@ -4,7 +4,7 @@
# divided into instances which correspond to internal components.
# Each instance can be configured to report its metrics to one or more sinks.
# Accepted values for [instance] are "master", "worker", "executor", "driver",
# and "applications". A wild card "*" can be used as an instance name, in
# and "applications". A wildcard "*" can be used as an instance name, in
# which case all instances will inherit the supplied property.
#
# Within an instance, a "source" specifies a particular set of grouped metrics.
Expand Down Expand Up @@ -32,7 +32,7 @@
# name (see examples below).
# 2. Some sinks involve a polling period. The minimum allowed polling period
# is 1 second.
# 3. Wild card properties can be overridden by more specific properties.
# 3. Wildcard properties can be overridden by more specific properties.
# For example, master.sink.console.period takes precedence over
# *.sink.console.period.
# 4. A metrics specific configuration
Expand All @@ -47,6 +47,13 @@
# instance master and applications. MetricsServlet may not be configured by self.
#

## List of available common sources and their properties.

# org.apache.spark.metrics.source.JvmSource
# Note: Currently, JvmSource is the only available common source
# to add additionaly to an instance, to enable this,
# set the "class" option to its fully qulified class name (see examples below)

## List of available sinks and their properties.

# org.apache.spark.metrics.sink.ConsoleSink
Expand Down
23 changes: 0 additions & 23 deletions core/pom.xml
Expand Up @@ -481,29 +481,6 @@
</plugins>
</build>
</profile>
<profile>
<id>sparkr-docs</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>sparkr-pkg-docs</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>..${path.separator}R${path.separator}create-docs${script.extension}</executable>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
10 changes: 5 additions & 5 deletions core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
Expand Up @@ -82,13 +82,13 @@ object SparkSubmit {
private val CLASS_NOT_FOUND_EXIT_STATUS = 101

// Exposed for testing
private[spark] var exitFn: () => Unit = () => System.exit(1)
private[spark] var exitFn: Int => Unit = (exitCode: Int) => System.exit(exitCode)
private[spark] var printStream: PrintStream = System.err
private[spark] def printWarning(str: String): Unit = printStream.println("Warning: " + str)
private[spark] def printErrorAndExit(str: String): Unit = {
printStream.println("Error: " + str)
printStream.println("Run with --help for usage help or --verbose for debug output")
exitFn()
exitFn(1)
}
private[spark] def printVersionAndExit(): Unit = {
printStream.println("""Welcome to
Expand All @@ -99,7 +99,7 @@ object SparkSubmit {
/_/
""".format(SPARK_VERSION))
printStream.println("Type --help for more information.")
exitFn()
exitFn(0)
}

def main(args: Array[String]): Unit = {
Expand Down Expand Up @@ -160,7 +160,7 @@ object SparkSubmit {
// detect exceptions with empty stack traces here, and treat them differently.
if (e.getStackTrace().length == 0) {
printStream.println(s"ERROR: ${e.getClass().getName()}: ${e.getMessage()}")
exitFn()
exitFn(1)
} else {
throw e
}
Expand Down Expand Up @@ -700,7 +700,7 @@ object SparkSubmit {
/**
* Return whether the given main class represents a sql shell.
*/
private def isSqlShell(mainClass: String): Boolean = {
private[deploy] def isSqlShell(mainClass: String): Boolean = {
mainClass == "org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver"
}

Expand Down

0 comments on commit 1e89dc8

Please sign in to comment.