[Feature request] function that tells what is the current strategy
@HenrikBengtsson ci sta già lavorando.
Dal 1/6/2022.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Let define a simplified function in a package that looks like that:
pkg_fun <- function(fun, x) {
f <- vector("list", length(x))
for (i in seq_along(x)) {
f[[i]] <- future::future({ fun(x) })
}
# some code to handle resolution and get values of futures...
}
Users can use it like that
library(pkg)
library(future)
plan(multisession)
pkg_fun(myfunction, mydata)
There is no way for the developer to know what is the plan used by the user. It is sequential? multicore on a single machine? multiple remote machine? I do agree that most of the time the developer do no need to know. But I'm personally facing multiple cases were I need to know to handle stuff internally or to throw informative warning or error. For examples:
myfunctionmay already be parallelized in C++ with OpenMP. Testing the strategy allows to enable or disable OpenMP and avoid nested parallelismmydatacan contain non serializable objects and the code subsequently fails with no informative error for parallel strategies (but works withplan(sequential)). Being able to catch those cases early would allow to handle them nicely.myfunctioncan return non serializable objects. Same issue than 2.
So far I'm using a custom parser than analyses the ouptut of future::plan() but I think it would be a useful addition to add easy to parse functions for developpers in future. Something like that maybe
future::is_parallel_strategy()
future::get_strategy_workers()
future::is_remote_stragety()
future::is_nested_strategy()
# ...
Thanks
- Lingua principale
- R
- Stelle
- 1k
- Fork
- 93
- Merge medio
- 2g 4h
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di futureverse/future
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
futureverse/future#852 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 35/100
futureverse/future#849 ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
futureverse/future#833 ·
-
feature/resources RNG
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
futureverse/future#832 ·
-
RNG
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
futureverse/future#831 · 1 commento ·
Tutte le issue di futureverse/future
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
nf-core/provenancereport#75 ·
-
Typo in Exercise 5.22?Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
garner-code/PsyR#80 ·