futureverse / futureverse/doFuture

inorder=FALSE does not work

Open
#94 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
83
Forks
7
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Using the `.inorder=FALSE` flag does not stop returning in order, the function still seems to wait to return results in sequential order.

**Reproduce example**

```r
library(doFuture)

plan(multisession, workers = 10)

results <- foreach(
i = seq_len(10),
.combine = function(...) c(...),
.options.future = list(seed = TRUE),
.inorder = FALSE
) %dofuture%
{
a = runif(1, min = 0, max = 5)valuse
Sys.sleep(a)
return(i)
}
print(results)

```

> [1] 1 2 3 4 5 6 7 8 9 10

when a is returned using `return(a)` :

> [1] 9.004456 8.136491 8.708837 4.002061 8.468867 1.739723 6.838177 7.355555 7.404953 9.821443

**Expected behavior**
Return values to the .combine function as they come, returning something like:

> [1] 6 4 7 8 9 2 5 1 10

**Session information**
> R version 4.5.1 (2025-06-13)
> Platform: x86_64-pc-linux-gnu
> Running under: Manjaro Linux
>
> Matrix products: default
> BLAS: /usr/lib/libblas.so.3.12.0
> LAPACK: /usr/lib/liblapack.so.3.12.0 LAPACK version 3.12.0
>
> locale:
> [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=de_DE.UTF-8 LC_COLLATE=en_GB.UTF-8
> [5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=en_GB.UTF-8 LC_PAPER=de_DE.UTF-8 LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
>
> time zone: Europe/Berlin
> tzcode source: system (glibc)
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] doFuture_1.1.3 future_1.68.0 foreach_1.5.2
>
> loaded via a namespace (and not attached):
> [1] compiler_4.5.1 parallelly_1.45.1 parallel_4.5.1 tools_4.5.1 rstudioapi_0.17.1 future.apply_1.20.1
> [7] listenv_0.10.0 codetools_0.2-20 iterators_1.0.14 digest_0.6.39 globals_0.18.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.