You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
doFuture: Error: length(results) == nbr_of_elements is not TRUE #220
I'm trying to do this with a sample of seven vms in a cluster (what I could get with the free trial). I keep getting the error Error: length(results) == nbr_of_elements is not TRUE
The cluster seems to be working fine since I can accomplish the same task with future_lapply just fine. It's when I try to do a future foreach loop that I get the error.
###After doing authentication etc.
vms <- lapply(vm_names, gce_vm,
predefined_type = "f1-micro",
template = "r-base")
vms <- lapply(vms, gce_ssh_setup)
###Go Rockies, Go Broncos
gce_ssh(vms[[1]], "echo GO ROCKIES, GO BRONCOS!")
###set the cluster
plan(cluster, workers = as.cluster(vms))
###sample function
run <- function(...) {
cd4.rg <- function(data, mle) MASS::mvrnorm(nrow(data), mle$m, mle$v)
cd4.mle <- list(m = colMeans(cd4), v = var(cd4))
boot(cd4, corr, R = 5000, sim = "parametric", ran.gen = cd4.rg, mle = cd4.mle)
}
###Works fine
t3 <- system.time(boot0 <- future_lapply(1:100, FUN = run, future.seed = 0xBEEF))
###Doesn't work
registerDoFuture()
system.time(
r <- foreach(i=1:trials, .packages="boot") %dopar% {
ind <- run()
})
What am I doing wrong here? Thanks in advance and cheers on the really cool package!
I believe that error occurs after the doFuture adapter has collected the data from the workers, so I doubt it has to do with your GCE setup. Does it work if you play the same game on your local machine?
Weird, to rule out that there's some clash with all those other package, make sure to also try in a clean R session. I guess something like (maybe there is more loaded when you actually set up the GCE workers):
Thank you so much for your help Henrik! I still get the same error :(
Ok from a completely clean rsession only loading doFuture and googleComputeEngine (and dependencies), and from a freshly regenerated cluster in the new session:
Code I ran in the fresh session to generate the cluster:
library(doFuture)
Sys.setenv(GCE_AUTH_FILE= account_key,
GCE_DEFAULT_PROJECT_ID= project,
GCE_DEFAULT_ZONE= zone)
library(googleComputeEngineR)
gce_global_project(project)
gce_global_zone(zone)
default_project <- gce_get_project(project)
vm_names <- paste0("vm",1:7)
vms <- lapply(vm_names, gce_vm,
predefined_type = "f1-micro",
template = "r-base")
vms <- lapply(vms, gce_ssh_setup)
###Test if the first VM responds to a ping
gce_ssh(vms[[1]], "echo GO ROCKIES, GO BRONCOS!")
run <- function(...) {
cd4.rg <- function(data, mle) MASS::mvrnorm(nrow(data), mle$m, mle$v)
cd4.mle <- list(m = colMeans(cd4), v = var(cd4))
boot(cd4, corr, R = 5000, sim = "parametric", ran.gen = cd4.rg, mle = cd4.mle)
}
Ok, I'll look into this. As a starter I'll try to make that assertion error message more informative. These updates will be done to the doFuture package, but I'll let you know here we there's something new you can try out.
PS. The assertion message is making sure that the collected results from the workers are of the proper length after being turned into a list - in your case it's not, which could be because there's one or more iterations that somehow return something out of the ordinary. This is what I need to figure out.
changed the title [-]Error: length(results) == nbr_of_elements is not TRUE[/-][+]doFuture: Error: length(results) == nbr_of_elements is not TRUE[/+]on Apr 28, 2018
Instead of the not-so-informative assertion error:
Error: length(results) == nbr_of_elements is not TRUE
you should now get something like:
Unexpected error in doFuture(): After gathering and merging the results from 4 chunks in
to a list, the total number of elements (= 99) does not match the number of input elements
in 'X' (= 100). There were in total 4 chunks and 4 elements (1 chunks with 24 elements,
3 chunks with 25 elements)
Hopefully this will help narrow in on what's happening to your GCE processing.
> y <- foreach(i=1:100, .packages="boot") %dopar% {
+ ind <- run()
+ }
Error: Unexpected error in doFuture(): After gathering and merging the results from 7 chunks in to a list, the total number of elements (= 14) does not match the number of input elements in 'X' (= 100). There were in total 7 chunks and 7 elements (7 chunks with 2 elements)
This looks similar to your error above, but I'm struggling to understand what it means.
you should should be able to see the str() output of the 7 chunks and then the generated list of 14 elements. That should tell us what those 7 chunks are actually containing.
> y <- foreach(i=1:100, .packages="boot") %dopar% {
+ ind <- run()
+ }
doFuture() ...
- dummy globals (as locals): [1] ‘i’
- R expression:
{
doFuture::registerDoFuture(globalsAs = "*")
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
i <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
ind <- run()
}, error = identity)
})
}
- identifying globals and packages ...
List of 2
$ ...future.x_ii: NULL
$ run :function (...)
..- attr(*, "srcref")=Class 'srcref' atomic [1:8] 1 8 5 1 8 1 1 5
.. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x10d012ae8>
- attr(*, "where")=List of 2
..$ ...future.x_ii:<environment: 0x10ccb0ea8>
..$ run :<environment: R_GlobalEnv>
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 10856
- R expression:
{
doFuture::registerDoFuture(globalsAs = "*")
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
i <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
ind <- run()
}, error = identity)
})
}
- globals: [2] ‘...future.x_ii’, ‘run’
List of 2
$ ...future.x_ii: NULL
$ run :function (...)
..- attr(*, "srcref")=Class 'srcref' atomic [1:8] 1 8 5 1 8 1 1 5
.. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x10d012ae8>
- attr(*, "where")=List of 2
..$ ...future.x_ii:<environment: 0x10ccb0ea8>
..$ run :<environment: R_GlobalEnv>
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 10856
- packages: [2] ‘boot’, ‘stats’
- identifying globals and packages ... DONE
Number of chunks: 7
Number of futures (= number of chunks): 7
Launching 7 futures (chunks) ...
Chunk #1 of 7 ...
Chunk #1 of 7 ... DONE
Chunk #2 of 7 ...
Chunk #2 of 7 ... DONE
Chunk #3 of 7 ...
Chunk #3 of 7 ... DONE
Chunk #4 of 7 ...
Chunk #4 of 7 ... DONE
Chunk #5 of 7 ...
Chunk #5 of 7 ... DONE
Chunk #6 of 7 ...
Chunk #6 of 7 ... DONE
Chunk #7 of 7 ...
Chunk #7 of 7 ... DONE
Launching 7 futures (chunks) ... DONE
- resolving future
- collecting values of future
Unexpected error in doFuture(): After gathering and merging the results from 7 chunks in to a list, the total number of elements (= 14) does not match the number of input elements in 'X' (= 100). There were in total 7 chunks and 7 elements (7 chunks with 2 elements)
chunk_sizes
2
7
Results before merge chunks:
List of 7
$ :List of 2
..$ message: chr "there is no package called ‘doFuture’"
..$ call : language loadNamespace(name)
..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
$ :List of 2
..$ message: chr "there is no package called ‘doFuture’"
..$ call : language loadNamespace(name)
..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
$ :List of 2
..$ message: chr "there is no package called ‘doFuture’"
..$ call : language loadNamespace(name)
..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
$ :List of 2
..$ message: chr "there is no package called ‘doFuture’"
..$ call : language loadNamespace(name)
..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
$ :List of 2
..$ message: chr "there is no package called ‘doFuture’"
..$ call : language loadNamespace(name)
..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
$ :List of 2
..$ message: chr "there is no package called ‘doFuture’"
..$ call : language loadNamespace(name)
..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
$ :List of 2
..$ message: chr "there is no package called ‘doFuture’"
..$ call : language loadNamespace(name)
..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
Results after merge chunks:
List of 14
$ message: chr "there is no package called ‘doFuture’"
$ call : language loadNamespace(name)
$ message: chr "there is no package called ‘doFuture’"
$ call : language loadNamespace(name)
$ message: chr "there is no package called ‘doFuture’"
$ call : language loadNamespace(name)
$ message: chr "there is no package called ‘doFuture’"
$ call : language loadNamespace(name)
$ message: chr "there is no package called ‘doFuture’"
$ call : language loadNamespace(name)
$ message: chr "there is no package called ‘doFuture’"
$ call : language loadNamespace(name)
$ message: chr "there is no package called ‘doFuture’"
$ call : language loadNamespace(name)
Error: Unexpected error in doFuture(): After gathering and merging the results from 7 chunks in to a list, the total number of elements (= 14) does not match the number of input elements in 'X' (= 100). There were in total 7 chunks and 7 elements (7 chunks with 2 elements)
I'm just getting familiar with futures and doparallel (I have a ton of foreach experience less running it parallel) but it looked like it could be an issue with the .packages() so I changed it to .packages=c("boot","doFuture") and got a different error:
Number of chunks: 7
Number of futures (= number of chunks): 7
Launching 7 futures (chunks) ...
Chunk #1 of 7 ...
Chunk #1 of 7 ... DONE
Chunk #2 of 7 ...
Chunk #2 of 7 ... DONE
Chunk #3 of 7 ...
Chunk #3 of 7 ... DONE
Chunk #4 of 7 ...
Chunk #4 of 7 ... DONE
Chunk #5 of 7 ...
Chunk #5 of 7 ... DONE
Chunk #6 of 7 ...
Chunk #6 of 7 ... DONE
Chunk #7 of 7 ...
Chunk #7 of 7 ... DONE
Launching 7 futures (chunks) ... DONE
- resolving future
- collecting values of future
Error: Internal error: Unexpected result retrieved for ClusterFuture future (‘<none>’): ‘{; doFuture::registerDoFuture(globalsAs = "*"); lapply(seq_along(...future.x_ii), FUN = function(jj) {; ...future.x_jj <- ...future.x_ii[[jj]]; i <- NULL; ...future.env <- environment(); ...; }, error = identity); }); }’
This was a good example of how error handling should be improved in doFuture (and future.apply). I'll make sure to improve upon this. It's probably also related to recent attempts to improve what type of results can be used in future (>= 1.8.0). So, thanks for reporting on this.
No worries; this should go smoothly and when it doesn't the error message should be clear. Things needs to be improved on my end.
Having said this, do not use your .packages approach. The doFuture package plays a special role here and needs to be available on the worker before that comes in play in the internal code. It's different from other packages that needs to be "exported".
Instead, follow my instruction in #220 (comment) to pre-install doFuture early on before you even bring in foreach.
... or did you say you did install doFuture according to my instructions and you're still getting that error? If that's the case, drop "doFuture" from .packages.
PS. I haven't reproduced your problem myself, but I'm planning to do it when I find the time (futureverse/doFuture#25).
Yes I still get the error after installing doFuture across the cluster in the method 1 of the #220 comment you referred to above, without the docker image.
I'm trying to create the vm's using the docker image now, but when I try to cluster 7 together the as.cluster function times out:
Do you know how to set the timeout limit higher?
Status: Downloaded newer image for henrikbengtsson/r-base-future:latest
Error in socketConnection("localhost", port = port, server = TRUE, blocking = TRUE, :
reached elapsed time limit
Ok, I'll probably have to make I sure I can reproduce a few things myself locally before I can give some more concrete instructions. The one thing I can say is that in order for the foreach() call to work you need to make sure doFuture is available on all the workers. One way to check that is do make sure you get all TRUE:s from call:
clusterEvalQ(cl, requireNamespace("doFuture"))
If there are any FALSE returns, then doFuture was not successfully installed on that worker.
Have you had a chance to retry? I'm going to submit a future 1.8.1 release to CRAN soon, so I'd like to know if there's anything else I should tweak in error message from the future package that could help here.
I'm still getting the same error, despite that doFuture is installed on the cluster nodes:
> clusterEvalQ(cl, requireNamespace("doFuture"))
[[1]]
[1] TRUE
[[2]]
[1] TRUE
[[3]]
[1] TRUE
plan(cluster, workers=cl)
> registerDoFuture()
> y <- foreach(i=1:100) %dopar% {
+ ind <- run()
+ }
Error: Unexpected error in doFuture(): After gathering and merging the results from 3 chunks in to a list, the total number of elements (= 6) does not match the number of input elements in 'X' (= 100). There were in total 3 chunks and 3 elements (3 chunks with 2 elements)
With verbose:
> options(doFuture.debug = TRUE)
> plan(cluster, workers=cl)
> registerDoFuture()
> y <- foreach(i=1:100) %dopar% {
+ ind <- run()
+ }
doFuture() ...
- dummy globals (as locals): [1] ‘i’
- R expression:
{
doFuture::registerDoFuture(globalsAs = "*")
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
i <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
ind <- run()
}, error = identity)
})
}
- identifying globals and packages ...
List of 2
$ ...future.x_ii: NULL
$ run :function (...)
..- attr(*, "srcref")=Class 'srcref' atomic [1:8] 1 8 5 1 8 1 1 5
.. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x1101f96d8>
- attr(*, "where")=List of 2
..$ ...future.x_ii:<environment: 0x10a1f4640>
..$ run :<environment: R_GlobalEnv>
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 10856
- R expression:
{
doFuture::registerDoFuture(globalsAs = "*")
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
i <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
ind <- run()
}, error = identity)
})
}
- globals: [2] ‘...future.x_ii’, ‘run’
List of 2
$ ...future.x_ii: NULL
$ run :function (...)
..- attr(*, "srcref")=Class 'srcref' atomic [1:8] 1 8 5 1 8 1 1 5
.. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x1101f96d8>
- attr(*, "where")=List of 2
..$ ...future.x_ii:<environment: 0x10a1f4640>
..$ run :<environment: R_GlobalEnv>
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 10856
- packages: [2] ‘boot’, ‘stats’
- identifying globals and packages ... DONE
Number of chunks: 3
Number of futures (= number of chunks): 3
Launching 3 futures (chunks) ...
Chunk #1 of 3 ...
Chunk #1 of 3 ... DONE
Chunk #2 of 3 ...
Chunk #2 of 3 ... DONE
Chunk #3 of 3 ...
Chunk #3 of 3 ... DONE
Launching 3 futures (chunks) ... DONE
- resolving future
- collecting values of future
Unexpected error in doFuture(): After gathering and merging the results from 3 chunks in to a list, the total number of elements (= 6) does not match the number of input elements in 'X' (= 100). There were in total 3 chunks and 3 elements (3 chunks with 2 elements)
chunk_sizes
2
3
Results before merge chunks:
List of 3
$ :List of 2
..$ message: chr "unused argument (globalsAs = \"*\")"
..$ call : language doFuture::registerDoFuture(globalsAs = "*")
..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
$ :List of 2
..$ message: chr "unused argument (globalsAs = \"*\")"
..$ call : language doFuture::registerDoFuture(globalsAs = "*")
..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
$ :List of 2
..$ message: chr "unused argument (globalsAs = \"*\")"
..$ call : language doFuture::registerDoFuture(globalsAs = "*")
..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
Results after merge chunks:
List of 6
$ message: chr "unused argument (globalsAs = \"*\")"
$ call : language doFuture::registerDoFuture(globalsAs = "*")
$ message: chr "unused argument (globalsAs = \"*\")"
$ call : language doFuture::registerDoFuture(globalsAs = "*")
$ message: chr "unused argument (globalsAs = \"*\")"
$ call : language doFuture::registerDoFuture(globalsAs = "*")
Error: Unexpected error in doFuture(): After gathering and merging the results from 3 chunks in to a list, the total number of elements (= 6) does not match the number of input elements in 'X' (= 100). There were in total 3 chunks and 3 elements (3 chunks with 2 elements)
I get the following error even after updating all packages.
`Error: Unexpected result (of class ‘snow-try-error’ != ‘FutureResult’) retrieved for ClusterFuture future (label = ‘’, expression = ‘{; doFuture::registerDoFuture(); lapply(seq_along(...future.x_ii), FUN = function(jj) {; ...future.x_jj <- ...future.x_ii[[jj]]; i <- NULL; ...future.env <- environment(); ...; }, error = identity); }); }’): there is no package called ‘doFuture’. This suggests that the communication with ClusterFuture worker (‘SOCKnode’ #1) is out of sync.
Traceback:
@brickyyyy, that looks like a different error from what's reported in this issue. Please post a new issue with full details what you are doing including code and sessionInfo(). Also, make sure you can get things working with a very simple example first.
Activity
HenrikBengtsson commentedon Apr 27, 2018
In case that R-blogger page is not up-to-date, let's use the example at https://www.jottr.org/2017/03/18/dofuture/.
I believe that error occurs after the doFuture adapter has collected the data from the workers, so I doubt it has to do with your GCE setup. Does it work if you play the same game on your local machine?
Also, what's your
sessionInfo()?HenrikBengtsson commentedon Apr 27, 2018
...and what does
traceback()output immediately after you get that error.nbarsch commentedon Apr 27, 2018
Works fine if I do it off my own local cores with your code above.
Session info below:
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.3
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] future.apply_0.1.0 googleComputeEngineR_0.2.0.9000
[3] boot_1.3-20 doParallel_1.0.11
[5] dplyr_0.7.4 doFuture_0.6.0
[7] iterators_1.0.9 foreach_1.4.4
[9] future_1.8.0 bigrquery_1.0.0.9000
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 pillar_1.1.0 compiler_3.4.3
[4] googleAuthR_0.6.2.9000 bindr_0.1 tools_3.4.3
[7] testthat_2.0.0 digest_0.6.15 jsonlite_1.5
[10] memoise_1.1.0 tibble_1.4.2 pkgconfig_2.0.1
[13] rlang_0.2.0 DBI_0.8 curl_3.2
[16] yaml_2.1.18 bindrcpp_0.2 withr_2.1.1
[19] httr_1.3.1 stringr_1.3.0 globals_0.11.0
[22] devtools_1.13.4 glue_1.2.0 listenv_0.7.0
[25] R6_2.2.2 magrittr_1.5 codetools_0.2-15
[28] MASS_7.3-47 assertthat_0.2.0 stringi_1.1.7
[31] openssl_0.9.9
HenrikBengtsson commentedon Apr 27, 2018
Weird, to rule out that there's some clash with all those other package, make sure to also try in a clean R session. I guess something like (maybe there is more loaded when you actually set up the GCE workers):
nbarsch commentedon Apr 27, 2018
Sorry for delay in getting you traceback(). . . I had destroyed the cluster so had to regenerate it.
I"m working on the clean session now, running tests and will get back.
nbarsch commentedon Apr 27, 2018
Thank you so much for your help Henrik! I still get the same error :(
Ok from a completely clean rsession only loading doFuture and googleComputeEngine (and dependencies), and from a freshly regenerated cluster in the new session:
Code I ran in the fresh session to generate the cluster:
Does not work:
HOWEVER THIS WORKS JUST FINE:
Rsession info:
HenrikBengtsson commentedon Apr 28, 2018
Ok, I'll look into this. As a starter I'll try to make that assertion error message more informative. These updates will be done to the doFuture package, but I'll let you know here we there's something new you can try out.
PS. The assertion message is making sure that the collected results from the workers are of the proper length after being turned into a list - in your case it's not, which could be because there's one or more iterations that somehow return something out of the ordinary. This is what I need to figure out.
[-]Error: length(results) == nbr_of_elements is not TRUE[/-][+]doFuture: Error: length(results) == nbr_of_elements is not TRUE[/+]HenrikBengtsson commentedon Apr 28, 2018
Please retry with the develop version of doFuture:
Instead of the not-so-informative assertion error:
you should now get something like:
Hopefully this will help narrow in on what's happening to your GCE processing.
nbarsch commentedon Apr 28, 2018
Ok trying this now.
nbarsch commentedon Apr 28, 2018
Error: Unexpected error in doFuture(): After gathering and merging the results from 7 chunks in to a list, the total number of elements (= 14) does not match the number of input elements in 'X' (= 100). There were in total 7 chunks and 7 elements (7 chunks with 2 elements)
This looks similar to your error above, but I'm struggling to understand what it means.
HenrikBengtsson commentedon Apr 28, 2018
Got it. If you rerun with:
you should should be able to see the
str()output of the 7 chunks and then the generated list of 14 elements. That should tell us what those 7 chunks are actually containing.nbarsch commentedon Apr 28, 2018
nbarsch commentedon Apr 28, 2018
I'm just getting familiar with futures and doparallel (I have a ton of foreach experience less running it parallel) but it looked like it could be an issue with the .packages() so I changed it to .packages=c("boot","doFuture") and got a different error:
HenrikBengtsson commentedon Apr 28, 2018
Ok, so installing
doFutureon your GCE workers should solve/workaround this. If you use:I'd expect that the
foreach()call would work after that.Alternatively, use my https://hub.docker.com/r/henrikbengtsson/r-base-future/ Docker file. This is actually what's used in the https://www.jottr.org/2017/03/18/dofuture/ example;
This was a good example of how error handling should be improved in doFuture (and future.apply). I'll make sure to improve upon this. It's probably also related to recent attempts to improve what type of results can be used in future (>= 1.8.0). So, thanks for reporting on this.
1 remaining item
HenrikBengtsson commentedon Apr 29, 2018
No worries; this should go smoothly and when it doesn't the error message should be clear. Things needs to be improved on my end.
Having said this, do not use your
.packagesapproach. The doFuture package plays a special role here and needs to be available on the worker before that comes in play in the internal code. It's different from other packages that needs to be "exported".Instead, follow my instruction in #220 (comment) to pre-install doFuture early on before you even bring in foreach.
HenrikBengtsson commentedon Apr 29, 2018
... or did you say you did install doFuture according to my instructions and you're still getting that error? If that's the case, drop
"doFuture"from.packages.PS. I haven't reproduced your problem myself, but I'm planning to do it when I find the time (futureverse/doFuture#25).
nbarsch commentedon Apr 29, 2018
Yes I still get the error after installing doFuture across the cluster in the method 1 of the #220 comment you referred to above, without the docker image.
I'm trying to create the vm's using the docker image now, but when I try to cluster 7 together the as.cluster function times out:
Do you know how to set the timeout limit higher?
Thanks again for all your help!
HenrikBengtsson commentedon Apr 29, 2018
Ok, I'll probably have to make I sure I can reproduce a few things myself locally before I can give some more concrete instructions. The one thing I can say is that in order for the
foreach()call to work you need to make sure doFuture is available on all the workers. One way to check that is do make sure you get allTRUE:s from call:If there are any
FALSEreturns, then doFuture was not successfully installed on that worker.HenrikBengtsson commentedon Apr 29, 2018
Ok, so I've setup up some doFuture package tests that emulate when the doFuture package is not available on a worker. Reinstall doFuture 0.6.0-9001;
and also the develop version of future 1.8.0-9000;
Then you will get the following error message whenever you use
foreach()and the doFuture package is missing on the worker:HenrikBengtsson commentedon May 1, 2018
Have you had a chance to retry? I'm going to submit a future 1.8.1 release to CRAN soon, so I'd like to know if there's anything else I should tweak in error message from the future package that could help here.
nbarsch commentedon May 4, 2018
Ooof sorry bout the slow response Henrik! I'm gonna test this now, I got caught on another project for a couple days!
nbarsch commentedon May 4, 2018
I'm still getting the same error, despite that doFuture is installed on the cluster nodes:
With verbose:
HenrikBengtsson commentedon May 4, 2018
Have you updated to future 1.8.1, which was release on CRAN yesterday?
HenrikBengtsson commentedon May 4, 2018
And I'm sure if you update doFuture too on master those "unused argument" errors also go away, because I fixed that when I posted #220 (comment)
HenrikBengtsson commentedon May 11, 2018
Any news? Can I close?
HenrikBengtsson commentedon Jun 13, 2018
I think I've solved this one - if you still observe issues, please feel free to reopen.
brickyyyy commentedon Mar 11, 2019
I get the following error even after updating all packages.
`Error: Unexpected result (of class ‘snow-try-error’ != ‘FutureResult’) retrieved for ClusterFuture future (label = ‘’, expression = ‘{; doFuture::registerDoFuture(); lapply(seq_along(...future.x_ii), FUN = function(jj) {; ...future.x_jj <- ...future.x_ii[[jj]]; i <- NULL; ...future.env <- environment(); ...; }, error = identity); }); }’): there is no package called ‘doFuture’. This suggests that the communication with ClusterFuture worker (‘SOCKnode’ #1) is out of sync.
Traceback:
. try({
. calculate_distance(dataset, i)
. })
. }
Any suggestions would be appreciated!
HenrikBengtsson commentedon Mar 11, 2019
@brickyyyy, that looks like a different error from what's reported in this issue. Please post a new issue with full details what you are doing including code and
sessionInfo(). Also, make sure you can get things working with a very simple example first.