Skip to content

run_ensemble_ler() crashes on remote distributed cluster #236

@tekknosol

Description

@tekknosol

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions