-
Notifications
You must be signed in to change notification settings - Fork 292
Open
Description
Using a crated function in purrr in a non-interactive session when mirai is not installed or not at a high enough version results in a unexpected failure, as purrr assumes because we have crated a function we want to run it in parallel, and in a non-interactive session where mirai is not installed it cannot consult the user to install mirai.
In my case I crated a function to support a parallel option but wanted to leave it in control of the user (and run not in parallel on CRAN checks). I was intending to use furrr for parallel rather than purrr+mirai at the moment.
testthat::test_that("crated purrr function does not throw error", {
fn = carrier::crate(function(x) return(paste0("test", x)))
try(pak::pkg_remove("mirai"), silent = TRUE)
purrr::map_chr(1:10, fn)
})
#> ── Error: crated purrr function does not throw error ───────────────────────────
#> <rlib_error_package_not_found/rlang_error/error/condition>
#> Error in `parallel_pkgs_installed()`: The package "mirai" (>= 2.5.1) is required for parallel map.
#> Backtrace:
#> ▆
#> 1. └─purrr::map_chr(1:10, fn)
#> 2. └─purrr:::map_("character", .x, .f, ..., .progress = .progress)
#> 3. └─purrr:::running_in_parallel(.f)
#> 4. └─purrr:::parallel_pkgs_installed()
#> 5. └─rlang::check_installed(...)
#> Error:
#> ! Test failedCreated on 2025-11-06 with reprex v2.1.1
N.b.
packageVersion("purrr")
[1] ‘1.2.0’
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels