Closed asiripanich closed 4 years ago
Hi, thanks for reporting the issue!
I don't see a reason for this behaviour and it shouldn't be that way. Can you give a minimal example so I can degug it?
I guess it was because I was trying to debug inside furrr::future_map
.
library(modules)
m <- modules::module({
modules::export("add_one")
add_one = function(x) {
browser()
x + 1
}
})
# can print x in console while in debugging mode
m$add_one(x = 1)
library(future)
library(furrr)
future::plan(future::sequential)
# cannot print x in console while in debugging mode
furrr::future_map(.x = 1,
.f = ~ m$add_one(.x))
Session info:
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.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/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] purrr_0.3.3 furrr_0.1.0 future_1.16.0
[4] modules_0.8.0 usethis_1.5.1.9000 colorout_1.2-2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 codetools_0.2-16 listenv_0.8.0 digest_0.6.24
[5] magrittr_1.5 rlang_0.4.4 fs_1.3.1 tools_3.6.1
[9] glue_1.3.1 parallel_3.6.1 compiler_3.6.1 globals_0.12.5
@asiripanich Thanks for the example. I can reproduce the behavior. However it may be related to furrr::future_map
and not to modules. I tested the following:
modules::depend("future")
modules::depend("furrr")
future::plan(future::sequential)
add_one <- function(x) {
browser()
x + 1
}
# cannot print x in console while in debugging mode
furrr::future_map(
.x = 1,
.f = ~ add_one(.x)
)
and observe the same. Can you verify? Printing from the function is no problem,regardless of whether it is in a module, it is only in debug.
I only have experience with the parallel
package and must say, that with parallel and asynchronous execution it's good to have a debugger at all ;) With parallel
I would have to go into lapply
for debugging.
@wahani I tried the above and can confirm the same behaviour. I guess I should seek help from other places. Maybe furrr
? :) Thanks again for helping me to investigate this. Great package by the way!
Hi @wahani, first of all thank you for making this great package.
Could you point out to why printing variables such has a data.frame or a list is not possible when I'm debugging inside a script imported with
modules
. I haven't done a lot of digging on this but hoping you can give me an answer to why this is not a default behaviour ofmodules
.Cheers.