Open stephenashton-dhsc opened 2 years ago
Please note MYDOMAIN
is covering over the domain containing my user profile and the server location.
Having done some further testing, I believe this is to do with the future::multicore
strategy.
It also fails when using future::sequential
but succeeds using future::multisession
I suspect this means that the error is actually present in future::sequential
, and my session on the HPC is defaulting to this, rather than using the future::multicore
strategy as intended (although future::supportsMulticore()
returns TRUE
on the HPC environment)
I can also confirm that this behaviour is present on my Windows laptop - the code fails when using future::sequential
, but succeeds using future::multisession
. It also fails when using future::multicore
, but I assume this is due to it defaulting the future::sequential
where future::supportsMulticore()
is FALSE
.
Hi, I can reproduce this. I was surprised that it worked for multisession, but not sequential and multicore; normally it's the other way around. However, it turns out, this is most likely related to the recent https://github.com/HenrikBengtsson/future/issues/608 bug. The workaround is the same: set (hidden) option future.globals.keepWhere
to TRUE as is:
library(future)
library(methods)
options(future.globals.keepWhere = TRUE)
setGeneric("my_custom_method", function(x) {
standardGeneric("my_custom_method")
})
setMethod("my_custom_method", methods::signature(x = "numeric"), function(x) {
x^2
})
plan(sequential) ## works with future.globals.keepWhere = TRUE
# plan(multicore, workers = 2L) ## works with future.globals.keepWhere = TRUE
# plan(multisession, workers = 2L)
f <- future({ my_custom_method(2) })
v <- value(f)
print(v)
stopifnot(v == my_custom_method(2))
Describe the bug
I can run a future containing a custom method on a Windows laptop within RStudio without issue, but when I launch this onto a HPC node, it fails.
Reproduce example
Return:
Expected behaviour
Session information
Please share your session information after the error has occurred so that we also see which packages and versions are involved;