Skip to content

Commit 109d65a

Browse files
Add option 'future.cache.path' complementing env var 'R_FUTURE_CACHE_PATH' [#30]
1 parent 1a547d9 commit 109d65a

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ NEW FEATURES:
3333
'compress'. For example, to turn of file compression, use
3434
plan(batchtools_nnn, registry = list(compress = FALSE)).
3535

36+
* The default location of the '.future' folder can be controlled by R option
37+
'future.cache.path' or environment variable 'R_FUTURE_CACHE_PATH'.
38+
3639
DOCUMENTATION:
3740

3841
* Add help("future.batchtools.options") which descriptions R options and

R/future_cache_path.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ future_cache_path <- local({
33
## The subfolder used for this session
44
dir <- NULL
55

6-
function(root_path = Sys.getenv("R_FUTURE_CACHE_PATH", ".future"), absolute = TRUE, create = TRUE) {
6+
function(root_path = getOption("future.cache.path", Sys.getenv("R_FUTURE_CACHE_PATH", ".future")), absolute = TRUE, create = TRUE) {
77
if (is.null(dir)) {
88
id <- basename(tempdir())
99
id <- gsub("Rtmp", "", id, fixed = TRUE)

R/options.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@
2828
#' This option controls how many lines are displayed.
2929
#' (Default: `48L`)}
3030
#'
31-
#' \item{\env{R_FUTURE_CACHE_PATH}}{(character string)
31+
#' \item{\option{future.cache.path} / \env{R_FUTURE_CACHE_PATH}}{
32+
#' (character string)
3233
#' An absolute or relative path specifying the root folder in which
3334
#' \pkg{batchtools} registry folders are stored.
3435
#' (Default: `.future`)}
3536
#' }
3637
#'
3738
#' @aliases
38-
#' future.cmdargs
39+
#' future.cache.path
3940
#' future.batchtools.expiration.tail
4041
#' future.batchtools.output
4142
#' future.batchtools.workers

R/zzz.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.onLoad <- function(libname, pkgname) {
22
inRCmdCheck <- import_future("inRCmdCheck")
33
if (inRCmdCheck()) {
4+
## Don't write to current working directory when running R CMD check.
45
path <- Sys.getenv("R_FUTURE_CACHE_PATH", file.path(tempdir(), ".future"))
56
Sys.setenv("R_FUTURE_CACHE_PATH" = path)
67
}

man/future.batchtools.options.Rd

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)