Skip to content

Commit

Permalink
BUG FIX: makeClusterPSOCK() could produce an error on "getOptionOrEnv…
Browse files Browse the repository at this point in the history
…Var" not found [#23]
  • Loading branch information
HenrikBengtsson committed Oct 22, 2020
1 parent eb1f426 commit bb4cf63
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Version: 1.20.0-9000 [2020-10-21]

BUG FIXES:

* makeClusterPSOCK() would produce an error on 'one node produced an error:
could not find function "getOptionOrEnvVar"' if 'parallelly' is not
available on the worker.

* The error message on using an invalid 'rscript_envs' argument for
makeClusterPSOCK() reported on the value of 'rscript_libs' (sic!).

Expand Down
3 changes: 2 additions & 1 deletion R/makeClusterPSOCK.R
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,8 @@ add_cluster_session_info <- function(cl) {
## Session information already collected?
if (!is.null(node$session_info)) next

node$session_info <- clusterCall(cl[ii], fun = session_info)[[1]]
pkgs <- getOptionOrEnvVar("future.makeNodePSOCK.sessionInfo.pkgs", FALSE)
node$session_info <- clusterCall(cl[ii], fun = session_info, pkgs = pkgs)[[1]]

## Sanity check, iff possible
if (inherits(node, "SOCK0node") || inherits(node, "SOCKnode")) {
Expand Down
10 changes: 10 additions & 0 deletions tests/makeClusterPSOCK.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ print(cl)
parallel::stopCluster(cl)


message("- makeClusterPSOCK() - w/out 'parallelly' on worker")

ovalue <- Sys.getenv("R_LIBS_USER")
Sys.setenv(R_LIBS_USER = tempdir())
cl <- makeClusterPSOCK(1L, outfile = "")
print(cl)
parallel::stopCluster(cl)
Sys.setenv(R_LIBS_USER = ovalue)


message("- makeClusterPSOCK() - exceptions")

res <- tryCatch({
Expand Down

0 comments on commit bb4cf63

Please sign in to comment.