modelrunner.run.launch module

Base class describing a model

run_function_with_cmd_args(func, args=None, *, name=None)[source]

create model from a function and obtain parameters from command line

Parameters:
  • func (callable) – The function that will be turned into a Model

  • args (list of str) – Command line arguments, typically sys.argv[1:]

  • name (str) – Name of the program, which will be shown in the command line help

Returns:

An instance of a subclass of ModelBase encompassing func

Return type:

ModelBase

run_script(script_path, model_args)[source]

helper function that runs a model script

The function detects models automatically by trying several methods until one yields a unique model to run:

  • A model that have been marked as default by set_default()

  • A function named main

  • A model instance if there is exactly one (throw error if there are many)

  • A model class if there is exactly one (throw error if there are many)

  • A function if there is exactly one (throw error if there are many)

Parameters:
  • script_path (str) – Path to the script that contains the model definition

  • model_args (sequence) – Additional arugments that define how the model is run

Returns:

The result of the run

Return type:

Result