Skip to content

Commit

Permalink
BUG FIX: availableCores(methods = "_R_CHECK_LIMIT_CORES_") would give…
Browse files Browse the repository at this point in the history
… an error if not running R CMD check.
  • Loading branch information
HenrikBengtsson committed Jan 5, 2017
1 parent 41584a1 commit 6782d2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: future
===============

Version: 1.2.0-9000 [2016-12-30]
Version: 1.2.0-9000 [2017-01-05]
o Added support for controlling whether a future is resolved eagerly
or lazily when creating the future, e.g. future(..., lazy = TRUE)
futureAssign(..., lazy = TRUE), and x %<-% { ... } %lazy% TRUE.
Expand All @@ -17,7 +17,9 @@ o PRIVACY: Lookup of public / external IP number is now querying
doesn't log usage. Note that the external IP number is only
queried when using plan(remote, workers) and explicitly using
revtunnel = FALSE (the default is revtunnel = TRUE).

o BUG FIX: availableCores(methods = "_R_CHECK_LIMIT_CORES_") would
give an error if not running R CMD check.


Version: 1.2.0 [2016-11-12]
o Added makeClusterPSOCK() - a version of parallel::makePSOCKcluster()
Expand Down
8 changes: 6 additions & 2 deletions R/availableCores.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@
#' For instance, on systems where multicore processing is not supported
#' (i.e. Windows), using \code{constrains="multicore"} will force a
#' single core to be reported.
#'
#' @param methods A character vector specifying how to infer the number
#' of available cores.
#'
#' @param na.rm If TRUE, only non-missing settings are considered/returned.
#'
#' @param default The default number of cores to return if no non-missing
#' settings are available.
#'
#' @param which A character specifying which settings to return.
#' If \code{"min"}, the minimum value is returned.
#' If \code{"max"}, the maximum value is returned (be careful!)
#' If \code{"all"}, all values are returned.
#' If \code{"all"}, all values are returned.#'
#'
#' @return Return a positive (>=1) integer.
#' If \code{which="all"}, then more than one value may be returned.
Expand Down Expand Up @@ -117,7 +121,7 @@ availableCores <- function(constraints=NULL, methods=getOption("future.available
## misleading to the reader.
chk <- tolower(Sys.getenv("_R_CHECK_LIMIT_CORES_", ""))
chk <- (nzchar(chk) && (chk != "false"))
if (chk) n <- 3L ## = 2+1
n <- if (chk) 3L else NA_integer_ ## = 2+1
} else if (method == "system") {
## Number of cores available according to parallel::detectCores()
n <- detectCores()
Expand Down

0 comments on commit 6782d2b

Please sign in to comment.