-
Notifications
You must be signed in to change notification settings - Fork 16
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
What is future.lapply(..., future.lazy = TRUE) supposed to do? #1
Comments
I started to use this option now (on sge), expecting it to run the jobs and free up the console for other things. is there a way to do that in future.*apply? couldnt the whole list be the promise in this case? |
You're looking for a feature making To make a non-blocking plan(list(multiprocess, batchtools_sge))
y %<-% future_lapply(X, FUN = my_fun) This will cause the first layer of futures (y As soon as you "touch" (e.g. print) |
thank you for the quick response. some clarification for me (sorry if this is basic stuff) the jobs wont get sent until i touch the object. then the console will be blocked on the master while they are running? or do you mean that if i touch y and the process is still running i will need to wait? |
it also looks like the template gets lost in the mix
|
No, all futures (both layers) will use "eager" evaluation by default (in contrast to "lazy"). This means, that they will start processing immediately. OTH, if you'd ask the first layer to be resolved lazily as in: plan(list(multiprocess, batchtools_sge))
y %<-% { future_lapply(X, FUN = my_fun) } %lazy% TRUE then the first layer of futures - the one can evaluates plan(list(multiprocess, batchtools_sge))
fy <- future({ future_lapply(X, FUN = my_fun) }, lazy = TRUE) and here it's more clear that it's basically just creating a future y <- value(fy) Hope this clarifies it. |
i'll keep plugging away with the example you gave. thank you! |
You want to use the library(future)
plan(list(
multiprocess,
tweak(future.batchtools::batchtools_sge, template = 'batchtools.sge-new.tmpl')
)) That's works as if you'd created your own custom future plan. You can also write the above as: my_sge <- tweak(future.batchtools::batchtools_sge, template = 'batchtools.sge-new.tmpl')
plan(list(multiprocess, my_sge)) |
works! thanks :). small last questions that are eluding me... can i route the output from /.future to an exposed location and how do I pass job.name into thanks again! |
Nothing yet, but hopefully soon;
Issue futureverse/future#232
Issue #15 |
thank you |
Hi Henrik - This is an old discussion but I have a quick question along the same lines. As you indicated, like the the older implementation future::future_lapply, future.apply::future_lapply is also blocking. But I have noticed say with a cluster of servers controlled by a main server with future::plan strategy = cluster (earlySignal by default seems to be FALSE), and run a job spread across each of the individual servers in the cluster, when the job is initiated across all the servers in the cluster with the future.future_lapply call, it starts out blocking as expected. But when one of the servers in the cluster is terminated (called away by the cloud provider) and hence the worker dies unexpectedly, future.apply::future_lapply returns. The individual jobs on the other servers are still running but since the function returns because future_lapply returns in this case the downstream script starts processing when it should wait till the entire job spanning across the cluster of servers is complete. base-r - 4.0.1 (main server and all workers) Is this expected? Much thanks, |
I've decided to remove this argument, cf. #94. Closing this one. |
This issue is based on the question/discussion in futureverse/future#179.
When first implementing
future_lapply()
I addedfuture.nnn
arguments to expose the correspondingnnn
arguments of thefuture()
function, e.g.future.globals
. In part of this process, I also addedfuture.lazy
to controlfuture(..., lazy = future.lazy)
. However, give thatfuture_lapply()
returns values (not futures), it is not obvious/clear what purpose this argument has. In other words, is there a difference between the default:and
Are there use cases where it matters/is needed? Can/should the
future.lazy
argument be dropped?PS. The overhead of having this argument is zero.
The text was updated successfully, but these errors were encountered: