Skip to content
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

box::use searches wrong directory inside parallel foreach execution #312

Open
klmr opened this issue Mar 27, 2023 · 0 comments
Open

box::use searches wrong directory inside parallel foreach execution #312

klmr opened this issue Mar 27, 2023 · 0 comments

Comments

@klmr
Copy link
Owner

klmr commented Mar 27, 2023

Error description

MWE:

$ tree mwe
mwe
├── mod.r
└── mwe.r

mwe/mod.r

#' @export
run_sqrt <- function (x) {
  sqrt(x)
}

mwe/mwe.r

box::use(
  parallel,
  dp = doParallel,
  foreach[foreach, `%dopar%`],
)

cl <- parallel$makeCluster(2L)
dp$registerDoParallel(cl)

foreach(i = 1 : 5) %dopar% {
  box::use(./mod[...])
  run_sqrt(i)
}

Run via:

Rscript mwe/mwe.r

Yields the following error:

Error in { :
  task 1 failed - " unable to load module “./mod”; not found in “path/to/PWD”"
Calls: %dopar% -> <Anonymous>

R version

_
platform       x86_64-pc-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          4
minor          2.0
year           2022
month          04
day            22
svn rev        82229
language       R
version.string R version 4.2.0 (2022-04-22)
nickname       Vigorous Calisthenics

‘box’ version

1.1.2.9000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant