-
Notifications
You must be signed in to change notification settings - Fork 85
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
How to use future_lapply's future.lazy? #179
Comments
By design, library("future")
plan(sequential) # easier to show it works
fs <- lapply(1:4, function(i) future({
Sys.sleep(5)
i
}, lazy = TRUE)) Then you can see that these are yet to be resolved: > fs[[3]]
MulticoreFuture:
Label: '<none>'
Expression:
{
Sys.sleep(5)
i
}
Lazy evaluation: TRUE
Asynchronous evaluation: TRUE
Local evaluation: TRUE
Environment: <environment: 0x55c6030>
Globals: <none>
Packages: <none>
L'Ecuyer-CMRG RNG seed: <none>
Resolved: FALSE
Value: <not collected>
Early signalling: FALSE
Owner process: 0cc1763c-9ac5-09c2-f2ea-fce7a62e1948
Class: 'MulticoreFuture', 'MultiprocessFuture', 'Future', 'environment' To resolve one of them, do: > v <- value(fs[[3]]) ## will take 5 sec
> v
[1] 3 or all: > vs <- values(fs) # will take 15 sec (3rd is already done)
> unlist(vs)
[1] 1 2 3 4 Details and future plans (sic!)Now, with the above, is there any use case where one would want to use Having said that, there will probably be a corresponding version of Hope this helps |
So the future.lazy argument currently doesn't work. |
No, it works but it doesn't do what you think it does. This is what I'm trying to stress in my first sentence. |
I must be missing something. So whats the difference if I set future.lazy
to TRUE or FALSE? It always return resolved futures anyway.
…On 30 Nov. 2017 4:26 pm, "Henrik Bengtsson" ***@***.***> wrote:
No, it works but it doesn't do what you think it does. This is what I'm
trying to stress in my first sentence.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#179 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AESfJXX9qlEaVu22oxIgdPq4OyboUd0Zks5s7jyegaJpZM4QvwKf>
.
|
See what I wrote under 'Details and future plans (sic!)'. Maybe it helps me to clarify if you can explain how you'd expect it work. |
I was thinking future_lapply(..., future.lazy) would return a future that will resolve to the list of results of lapply(....). |
Ok, so "Adding support for that goes into the plan of creating a separate future.apply package with a much more powerful set of functions. These plans are outlined in Issue #159 ." |
I've moved this issue/discussion over to futureverse/future.apply#1. |
I am trying to use future_lapply's future.lazy option. As can be seen below. It doesn't seem to be lazily evaluating it and there is no example in the package on how to do this correctly?
The text was updated successfully, but these errors were encountered: