Skip to content

Commit 8747190

Browse files
committed
merge master
2 parents 706d3f7 + 96aa013 commit 8747190

File tree

458 files changed

+10895
-4573
lines changed

Some content is hidden

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

458 files changed

+10895
-4573
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ scalastyle-output.xml
6666
R-unit-tests.log
6767
R/unit-tests.out
6868
python/lib/pyspark.zip
69+
lint-r-report.log
6970

7071
# For Hive
7172
metastore_db/

.rat-excludes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ spark-env.sh
2828
spark-env.cmd
2929
spark-env.sh.template
3030
log4j-defaults.properties
31+
log4j-defaults-repl.properties
3132
bootstrap-tooltip.js
3233
jquery-1.11.1.min.js
3334
d3.min.js
@@ -85,3 +86,4 @@ local-1430917381535_2
8586
DESCRIPTION
8687
NAMESPACE
8788
test_support/*
89+
.lintr

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,3 +950,4 @@ The following components are provided under the MIT License. See project link fo
950950
(MIT License) scopt (com.github.scopt:scopt_2.10:3.2.0 - https://github.com/scopt/scopt)
951951
(The MIT License) Mockito (org.mockito:mockito-all:1.8.5 - http://www.mockito.org)
952952
(MIT License) jquery (https://jquery.org/license/)
953+
(MIT License) AnchorJS (https://github.com/bryanbraun/anchorjs)

R/log4j.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
log4j.rootCategory=INFO, file
2020
log4j.appender.file=org.apache.log4j.FileAppender
2121
log4j.appender.file.append=true
22-
log4j.appender.file.file=R-unit-tests.log
22+
log4j.appender.file.file=R/target/unit-tests.log
2323
log4j.appender.file.layout=org.apache.log4j.PatternLayout
2424
log4j.appender.file.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss.SSS} %t %p %c{1}: %m%n
2525

R/pkg/.lintr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
linters: with_defaults(line_length_linter(100), camel_case_linter = NULL, open_curly_linter(allow_single_line = TRUE), closed_curly_linter(allow_single_line = TRUE))
2+
exclusions: list("inst/profile/general.R" = 1, "inst/profile/shell.R")

R/pkg/NAMESPACE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ export("sparkR.init")
1010
export("sparkR.stop")
1111
export("print.jobj")
1212

13+
# Job group lifecycle management methods
14+
export("setJobGroup",
15+
"clearJobGroup",
16+
"cancelJobGroup")
17+
1318
exportClasses("DataFrame")
1419

1520
exportMethods("arrange",

R/pkg/R/sparkR.R

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,47 @@ sparkRHive.init <- function(jsc = NULL) {
278278
assign(".sparkRHivesc", hiveCtx, envir = .sparkREnv)
279279
hiveCtx
280280
}
281+
282+
#' Assigns a group ID to all the jobs started by this thread until the group ID is set to a
283+
#' different value or cleared.
284+
#'
285+
#' @param sc existing spark context
286+
#' @param groupid the ID to be assigned to job groups
287+
#' @param description description for the the job group ID
288+
#' @param interruptOnCancel flag to indicate if the job is interrupted on job cancellation
289+
#' @examples
290+
#'\dontrun{
291+
#' sc <- sparkR.init()
292+
#' setJobGroup(sc, "myJobGroup", "My job group description", TRUE)
293+
#'}
294+
295+
setJobGroup <- function(sc, groupId, description, interruptOnCancel) {
296+
callJMethod(sc, "setJobGroup", groupId, description, interruptOnCancel)
297+
}
298+
299+
#' Clear current job group ID and its description
300+
#'
301+
#' @param sc existing spark context
302+
#' @examples
303+
#'\dontrun{
304+
#' sc <- sparkR.init()
305+
#' clearJobGroup(sc)
306+
#'}
307+
308+
clearJobGroup <- function(sc) {
309+
callJMethod(sc, "clearJobGroup")
310+
}
311+
312+
#' Cancel active jobs for the specified group
313+
#'
314+
#' @param sc existing spark context
315+
#' @param groupId the ID of job group to be cancelled
316+
#' @examples
317+
#'\dontrun{
318+
#' sc <- sparkR.init()
319+
#' cancelJobGroup(sc, "myJobGroup")
320+
#'}
321+
322+
cancelJobGroup <- function(sc, groupId) {
323+
callJMethod(sc, "cancelJobGroup", groupId)
324+
}

R/pkg/inst/tests/test_context.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,10 @@ test_that("rdd GC across sparkR.stop", {
4848
count(rdd3)
4949
count(rdd4)
5050
})
51+
52+
test_that("job group functions can be called", {
53+
sc <- sparkR.init()
54+
setJobGroup(sc, "groupId", "job description", TRUE)
55+
cancelJobGroup(sc, "groupId")
56+
clearJobGroup(sc)
57+
})

build/mvn

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,14 @@ install_app() {
6969

7070
# Install maven under the build/ folder
7171
install_mvn() {
72+
local MVN_VERSION="3.3.3"
73+
7274
install_app \
73-
"http://archive.apache.org/dist/maven/maven-3/3.2.5/binaries" \
74-
"apache-maven-3.2.5-bin.tar.gz" \
75-
"apache-maven-3.2.5/bin/mvn"
76-
MVN_BIN="${_DIR}/apache-maven-3.2.5/bin/mvn"
75+
"http://archive.apache.org/dist/maven/maven-3/${MVN_VERSION}/binaries" \
76+
"apache-maven-${MVN_VERSION}-bin.tar.gz" \
77+
"apache-maven-${MVN_VERSION}/bin/mvn"
78+
79+
MVN_BIN="${_DIR}/apache-maven-${MVN_VERSION}/bin/mvn"
7780
}
7881

7982
# Install zinc under the build/ folder
@@ -105,28 +108,16 @@ install_scala() {
105108
SCALA_LIBRARY="$(cd "$(dirname ${scala_bin})/../lib" && pwd)/scala-library.jar"
106109
}
107110

108-
# Determines if a given application is already installed. If not, will attempt
109-
# to install
110-
## Arg1 - application name
111-
## Arg2 - Alternate path to local install under build/ dir
112-
check_and_install_app() {
113-
# create the local environment variable in uppercase
114-
local app_bin="`echo $1 | awk '{print toupper(\$0)}'`_BIN"
115-
# some black magic to set the generated app variable (i.e. MVN_BIN) into the
116-
# environment
117-
eval "${app_bin}=`which $1 2>/dev/null`"
118-
119-
if [ -z "`which $1 2>/dev/null`" ]; then
120-
install_$1
121-
fi
122-
}
123-
124111
# Setup healthy defaults for the Zinc port if none were provided from
125112
# the environment
126113
ZINC_PORT=${ZINC_PORT:-"3030"}
127114

128-
# Check and install all applications necessary to build Spark
129-
check_and_install_app "mvn"
115+
# Install Maven if necessary
116+
MVN_BIN="$(command -v mvn)"
117+
118+
if [ ! "$MVN_BIN" ]; then
119+
install_mvn
120+
fi
130121

131122
# Install the proper version of Scala and Zinc for the build
132123
install_zinc
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Set everything to be logged to the console
2+
log4j.rootCategory=WARN, console
3+
log4j.appender.console=org.apache.log4j.ConsoleAppender
4+
log4j.appender.console.target=System.err
5+
log4j.appender.console.layout=org.apache.log4j.PatternLayout
6+
log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n
7+
8+
# Settings to quiet third party logs that are too verbose
9+
log4j.logger.org.spark-project.jetty=WARN
10+
log4j.logger.org.spark-project.jetty.util.component.AbstractLifeCycle=ERROR
11+
log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=INFO
12+
log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=INFO

0 commit comments

Comments
 (0)