From a2c19af62bf7ea259f121aa4ab9ba9971e806f90 Mon Sep 17 00:00:00 2001 From: Hossein Date: Thu, 18 Jun 2015 16:52:40 -0700 Subject: [PATCH] taking spark context as first argument --- R/pkg/R/sparkR.R | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/R/pkg/R/sparkR.R b/R/pkg/R/sparkR.R index bc4d29937ddb4..54fab69277cfc 100644 --- a/R/pkg/R/sparkR.R +++ b/R/pkg/R/sparkR.R @@ -282,34 +282,28 @@ sparkRHive.init <- function(jsc = NULL) { #' Assigns a group ID to all the jobs started by this thread until the group ID is set to a #' different value or cleared. #' -#' @param sc The existing +#' @param sc existing spark context #' @param groupid the ID to be assigned to job groups #' @param description description for the the job group ID #' @param interruptOnCancel flag to indicate if the job is interrupted on job cancellation -setJobGroup <- function(groupId, description, interruptOnCancel) { - if (exists(".sparkRjsc", envir = env)) { - sc <- get(".sparkRjsc", envir = env) - callJMethod(sc, "setJobGroup", groupId, description, interruptOnCancel) - } +setJobGroup <- function(sc, groupId, description, interruptOnCancel) { + callJMethod(sc, "setJobGroup", groupId, description, interruptOnCancel) } #' Clear current job group ID and its description +#' +#' @param sc existing spark context -clearJobGroup <- function() { - if (exists(".sparkRjsc", envir = env)) { - sc <- get(".sparkRjsc", envir = env) - callJMethod(sc, "clearJobGroup") - } +clearJobGroup <- function(sc) { + callJMethod(sc, "clearJobGroup") } #' Cancel active jobs for the specified group #' +#' @param sc existing spark context #' @param groupId the ID of job group to be cancelled -cancelJobGroup <- function(groupId) { - if (exists(".sparkRjsc", envir = env)) { - sc <- get(".sparkRjsc", envir = env) - callJMethod(sc, "cancelJobGroup", groupId) - } +cancelJobGroup <- function(sc, groupId) { + callJMethod(sc, "cancelJobGroup", groupId) }