Skip to content

WISH: Make registerDoFuture() propagate also via future() / %<-% (as it does with %dopar%) #22

@HenrikBengtsson

Description

@HenrikBengtsson

It would be useful if registerDoFuture() would propagate also via future() / %<-% (as it currently does with %dopar%). Currently, it doesn't:

library("doFuture")
registerDoFuture()
plan(multisession)

print(getDoParName())
# [1] "doFuture"

# registerDoFuture() propagates through %dopar%
> a <- foreach(i = 1L) %dopar% getDoParName()
> a
[[1]]
[1] "doFuture"

# But not through plain futures
b %<-% getDoParName()
> b
# [1] NULL

The workaround is to manual set it inside these futures:

b %<-% {
  registerDoFuture()
  getDoParName()
}
> b
# [1] "doFuture"

which is not ideal.

See also

The background for this feature is in #21

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions