Objects used within R6 methods not properly exported to multisession workers
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- r
- Ambito
- distributed-systems
Direzione di ricerca
Inizia eseguendo la riproduzione fornita con R6, future.apply, dplyr e multisession, confrontandola con sequential e multicore. Traccia come vengono identificati i globals e le dipendenze dei pacchetti per il callback future_lapply all’interno del metodo R6, quindi aggiungi una coverage che mostri che multisession restituisce l’elenco atteso di cinque risultati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
When using R6, future doesn't seem the objects to export within R6 methods.
Reproduce example
library(R6)
library(future)
library(future.apply)
library(dplyr)
test_class <- R6::R6Class(
public = list(
df = data.frame(a = 1),
simulate = function() {
self$df %>% mutate(result = a * rnorm(nrow(self$df)))
},
run_many_times = function(times=10) {
results <- future_lapply(1:times, function(i) {
self$simulate()
}, future.seed = T)
return(results)
}
))
instance <- test_class$new()
plan(sequential)
instance$run_many_times(2)
plan(multicore)
instance$run_many_times(5)
plan(multisession)
instance$run_many_times(5)
The sequential and multicore runs work fine, but the multisession fails with:
Error in self$df %>% mutate(result = a * rnorm(nrow(self$df))) :
could not find function "%>%"
Expected behavior
Running the instance$run_many_times returns a list of 5 elements, whether using the default backend, multicore, or multisession.
Session information
Please share your session information after the error has occurred so that we also see which packages and versions are involved;
> sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.7.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
Random number generation:
RNG: L'Ecuyer-CMRG
Normal: Inversion
Sample: Rejection
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/New_York
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_1.1.4 future.apply_1.11.2 future_1.58.0 R6_2.5.1
loaded via a namespace (and not attached):
[1] digest_0.6.37 codetools_0.2-20 tidyselect_1.2.1 magrittr_2.0.3 glue_1.7.0
[6] tibble_3.3.0 parallel_4.4.0 pkgconfig_2.0.3 generics_0.1.4 lifecycle_1.0.4
[11] cli_3.6.4 parallelly_1.45.1 vctrs_0.6.5 compiler_4.4.0 globals_0.18.0
[16] tools_4.4.0 listenv_0.9.1 pillar_1.10.2 rlang_1.1.5 jsonlite_1.9.1
> future::futureSessionInfo()
*** Package versions
future 1.58.0, parallelly 1.45.1, parallel 4.4.0, globals 0.18.0, listenv 0.9.1
*** Allocations
availableCores():
system /proc/self/status
10 10
availableWorkers():
$system
[1] "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost"
[9] "localhost" "localhost"
*** Settings
- future.plan=<not set>
- future.fork.multithreading.enable=<not set>
- future.globals.maxSize=<not set>
- future.globals.onReference=<not set>
- future.resolve.recursive=<not set>
- future.rng.onMisuse=<not set>
- future.wait.timeout=<not set>
- future.wait.interval=<not set>
- future.wait.alpha=<not set>
- future.startup.script=FALSE
*** Backends
Number of workers: 1
List of future strategies:
1. sequential:
- args: function (..., gc = FALSE, earlySignal = FALSE, envir = parent.frame(), workers = "<NULL>")
- tweaked: FALSE
- call: plan(sequential)
*** Basic tests
Main R session details:
pid r sysname release
1 2480 4.4.0 Darwin 23.6.0
version
1 Darwin Kernel Version 23.6.0: Thu Apr 24 20:29:18 PDT 2025; root:xnu-10063.141.1.705.2~1/RELEASE_ARM64_T6000
nodename machine login user effective_user
1 host001 arm64 user002 user001 user001
Worker R session details:
worker pid r sysname release
1 1 2480 4.4.0 Darwin 23.6.0
version
1 Darwin Kernel Version 23.6.0: Thu Apr 24 20:29:18 PDT 2025; root:xnu-10063.141.1.705.2~1/RELEASE_ARM64_T6000
nodename machine login user effective_user
1 host001 arm64 user002 user001 user001
Number of unique worker PIDs: 1 (as expected)
- 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 ·