Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/21589#discussion_r201913578
--- Diff: R/pkg/R/context.R ---
@@ -435,3 +435,31 @@ setCheckpointDir <- function(directory) {
sc <- getSparkContext()
invisible(callJMethod(sc, "setCheckpointDir",
suppressWarnings(normalizePath(directory))))
}
+
+#' Total number of CPU cores of all executors registered in the cluster at
the moment.
+#'
+#' @rdname spark.numCores
+#' @return current number of cores in the cluster.
+#' @examples
+#'\dontrun{
+#' spark.numCores()
+#'}
+#' @note spark.numCores since 2.4.0
+spark.numCores <- function() {
+ sc <- getSparkContext()
+ invisible(callJMethod(sc, "numCores"))
--- End diff --
`invisible` in other cases are because they return void in java, in these
cases we are returning numbers, and should not use `invisible`
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]