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

Environment for future_lapply #70

Open
dipterix opened this issue Nov 28, 2020 · 3 comments
Open

Environment for future_lapply #70

dipterix opened this issue Nov 28, 2020 · 3 comments

Comments

@dipterix
Copy link

In future, we can set environment where to search for globals, but in future_lapply, this option seems to be removed.

Is it possible to do this:

(original code)

future_lapply <- function(X, FUN, ..., future.envir2 = parent.frame()){
  ...
  values <- future_xapply(
    ...,
    future.envir2 = future.envir2
  )
}

In this way, future_xapply will be able to receive environment in case other Future classes need to process the environment.

https://github.com/HenrikBengtsson/future.apply/blob/fcec8077a4eb8da0b4e60dd67a20fca33715942f/R/future_xapply.R#L186-L195

We only need to change line 188 to

fs[[ii]] <- future(
      ...
      envir = future.envir2,
      ...
)
@HenrikBengtsson
Copy link
Collaborator

Yes, this is a known issue and on the road map (for way too long), e.g. Issue #62 and #64 (comment). I just need some deep focus to get this correct; passing down envir = parent.frame() as-is will result in some revdep complaints related to globals and ... that need to be understood and sorted out.

@HenrikBengtsson
Copy link
Collaborator

Also, I was hoping to have gotten around and created https://github.com/HenrikBengtsson/future.mapreduce by now so it can just implemented it there and then future.apply, doFuture, and furrr could depend on that.

@dipterix
Copy link
Author

Sounds good!

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

No branches or pull requests

2 participants