Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
HenrikBengtsson opened this issue Feb 1, 2018 · 1 comment

Comments

@HenrikBengtsson
Copy link
Owner

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

@HenrikBengtsson
Copy link
Owner Author

This is only needed when using %dopar%; by definition, this is a non-issue when using %dofuture% .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant