diff options
Diffstat (limited to 'R/pkg')
-rw-r--r-- | R/pkg/NAMESPACE | 3 | ||||
-rw-r--r-- | R/pkg/R/context.R | 17 | ||||
-rw-r--r-- | R/pkg/inst/tests/testthat/test_context.R | 5 |
3 files changed, 25 insertions, 0 deletions
diff --git a/R/pkg/NAMESPACE b/R/pkg/NAMESPACE index 667fff7192..b3aff10b7d 100644 --- a/R/pkg/NAMESPACE +++ b/R/pkg/NAMESPACE @@ -24,6 +24,9 @@ export("setJobGroup", "clearJobGroup", "cancelJobGroup") +# Export Utility methods +export("setLogLevel") + exportClasses("DataFrame") exportMethods("arrange", diff --git a/R/pkg/R/context.R b/R/pkg/R/context.R index b0e67c8ad2..4105a6e5c8 100644 --- a/R/pkg/R/context.R +++ b/R/pkg/R/context.R @@ -225,3 +225,20 @@ broadcast <- function(sc, object) { setCheckpointDir <- function(sc, dirName) { invisible(callJMethod(sc, "setCheckpointDir", suppressWarnings(normalizePath(dirName)))) } + +#' Set new log level +#' +#' Set new log level: "ALL", "DEBUG", "ERROR", "FATAL", "INFO", "OFF", "TRACE", "WARN" +#' +#' @rdname setLogLevel +#' @param sc Spark Context to use +#' @param level New log level +#' @export +#' @examples +#'\dontrun{ +#' setLogLevel(sc, "ERROR") +#'} + +setLogLevel <- function(sc, level) { + callJMethod(sc, "setLogLevel", level) +} diff --git a/R/pkg/inst/tests/testthat/test_context.R b/R/pkg/inst/tests/testthat/test_context.R index 9f51161230..ffa067eb5e 100644 --- a/R/pkg/inst/tests/testthat/test_context.R +++ b/R/pkg/inst/tests/testthat/test_context.R @@ -90,6 +90,11 @@ test_that("job group functions can be called", { clearJobGroup(sc) }) +test_that("utility function can be called", { + sc <- sparkR.init() + setLogLevel(sc, "ERROR") +}) + test_that("getClientModeSparkSubmitOpts() returns spark-submit args from whitelist", { e <- new.env() e[["spark.driver.memory"]] <- "512m" |