You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently stumbled across the following rather weird behavior:
If a custom function named eval is present in my .GlobalEnv, testing jobs with external = TRUE and potentially also submitting will fail:
library(batchtools) # 0.9.15
library(data.table)
reg= makeExperimentRegistry(file.dir=NA, seed=1)
addProblem(name="test", fun=function(...) list(...), seed=2)
eval_=function(data, job, instance, ...) {
xs=list(...)
1+xs$x1
}
eval=function(...) list(...)
addAlgorithm(name="eval_", fun=eval_)
pdes=list(test= data.table())
ades=list(eval_= data.table(x1= c(1, 2)))
addExperiments(pdes, ades, repls=1)
testJob(1)
#### [bt]: Generating problem instance for problem 'test' ...#### [bt]: Applying algorithm 'eval_' on problem 'test' for job 1 (seed = 2) ...#[1] 2
testJob(1, external=TRUE)
# Error: testJob() failed for job with id=1. To properly debug, re-run with external=FALSE
rm(eval)
testJob(1, external=TRUE)
### [bt]: Generating problem instance for problem 'test' ...### [bt]: Applying algorithm 'eval_' on problem 'test' for job 1 (seed = 2) ...
[1] 2
Initially, the algorithm was named eval and I thought this caused the problem, however, it seems like it suffices to have a custom function eval present in the .GlobalEnv. My initial guess would be that this interferes with properly scoping base::eval at some later stages (not sure why though).
The text was updated successfully, but these errors were encountered:
I recently stumbled across the following rather weird behavior:
If a custom function named
eval
is present in my.GlobalEnv
, testing jobs withexternal = TRUE
and potentially also submitting will fail:Initially, the algorithm was named
eval
and I thought this caused the problem, however, it seems like it suffices to have a custom functioneval
present in the.GlobalEnv
. My initial guess would be that this interferes with properly scopingbase::eval
at some later stages (not sure why though).The text was updated successfully, but these errors were encountered: