-
Notifications
You must be signed in to change notification settings - Fork 17
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
Single future.control argument rather than multiple, individual future.* arguments #27
Comments
I don't see a problem with future::future.control = function(globals = FALSE) {
list(globals = globals)
}
future.apply::future.apply.control = function(..., scheduling = 1, chunk.size = NULL) {
c(future::future.control(...), list(scheduling = scheduling, chunk.size = chunk.size))
} This way, you could update |
I was actually thinking of taking an easier approach to avoid to introducing a yet-another function to the Future API. I was thinking this could be added API above the Future API (e.g. future.apply package). For instance, instead of doing: y <- future_lapply(X, FUN = identity, future.seed = 42, future.scheduling = 2.0) one could do: y <- future_lapply(X, FUN = identity, future.control = list(seed = 42, scheduling = 2.0)) where the control <- .update_control(future.control) can be used internally with: .update_control <- function(...) {
args <- list(...)
control <- list(
globals = TRUE, packages = NULL, lazy = FALSE,
seed = FALSE, scheduling = 1, chunk.size = NULL
)
for (name in names(args)) control[[name]] <- args[[name]]
control
} The current arguments would then correspond to: future.globals <- control$globals
future.packages <- control$packages
future.seed <- control$seed |
Where does |
In future.apply. No plan of introducing control argument in the future package at this point. |
Please clarify how this is intended to be used: The choice of backend can be controlled by modifying the global state via Some options of Other options seem to be relevant for the user, e.g. |
So, I'm not thinking of a global option here, just wrapping up existing |
Hm okay. If I understand you correctly, most options can/should be hardcoded in the package. But what about Sorry if these are dumb question, I should really take more time to RTFM... |
No dumb questions. No, you cannot set those via |
I'm currently working on mlr3 (https://github.com/mlr-org/mlr3), a successor to mlr. The As the user typically has some expectations about the runtime and which iterations or combinations will be expensive (e.g., a random forest is more expensive than a single tree), he could optimize the parallelization by evenly distributing the heavy jobs among available workers. So it would be nice to be able to control the chunking, or at least "shuffle" the jobs (as suggested in other issue). A more general use case for
I'm also not saying that I definitely need this. Especially the manual chunking might unnecessarily blow up the interface. I was just curious if this is possible. |
@mllg wrote:
Yes, I've been having internal (as in lots of inner voices ;)) debates about this and it's been discussed with other in the past. I'm not opposed to it. The main reason I've stayed away from it is that we have to deside exactly how the control elements should be controlled.
You're meaning in the sense that the future.apply package and other similar high-level packages (e.g. furrr) won't have to know about future-specific arguments and can just pass whatever down to the future package? That's a nice side effect I haven't thought of before.
However, not all elements in
future.control
should be passed down to the future package. For instance,scheduling
andchunk.size
are higher level properties. If so, do they belong to afuture.control
argument or should they be separate?So several things to think of. Thanks for bringing this up.
The text was updated successfully, but these errors were encountered: