-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Hi,
I am working on a remote cluster with multiple nodes created by future::plan(cluster). Running LakeEnsemblR 1.0.5 in this environment crashes when calling the model executables.
I figured this is due to the way do.call() is used in the function run_ensemble_ler(). According to the documentation of the future package its advised to specify the function as the object itself and not by name when using do:call().
So instead of the current code used in run_ensemble.R...
model_out <- setNames(
lapply(model, function(mod_name) do.call(paste0(".run_", mod_name),
run_model_args)),
model
)... this problem can be solved by doing something like:
model_out <- setNames(lapply(model, function(mod_name){
if(mod_name == "Simstrat"){
do.call(.run_Simstrat, run_model_args)
}else{if(mod_name == "GLM"){
do.call(.run_GLM, run_model_args)
}}
}), model)Probably this if() cascade is not the most elegant solution and something like e.g. a switch() statement would be better.
Anyway, I am happy to submit a pull request if you provide some thoughts on how you would like to deal with it!