Repository navigation
Closed
Milestone
Description
Issue
If a worker don't have a package installed, then doFuture may produce an obscure error message such as:
Error: length(results) == nbr_of_elements is not TRUE
or in the develop version as:
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)
A real example based on workers running in bare-bone R Docker containers (e.g. futureverse/future#220 (comment)) will end up with these errors. Enabling options(doFuture.debug = TRUE) will reveal the actual problem:
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"
[...]
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)
[...]
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)Actions
- Implement a doFuture package test that reproduce the above scenario where workers don't have doFuture installed. I just added a similar package test in future - see https://github.com/HenrikBengtsson/future/blob/develop/tests/cluster-missing-future-pkg.R for the gist how to hide a package from workers.
- Detect these errors and improve the error message.
- Make sure the above errors do not pass through by luck, i.e. when the expected number of output elements happen to match the input (can that happen?)
Related
The future.apply package probably gives equally obscure error message right now.
Metadata
Metadata
Assignees
Labels
No labels
Activity
TESTS: Reproduce errors occurring when doFuture is not available on w…
TESTS: Emulate clusters that lack the 'future' package and / or the '…
More information with a few examples of the unexpected results in doF…
BUG FIX: If the 'doFuture' package is missing on a worker, an error on