7.2.8.24. run_model

class run_model(func, *args, _init=None, **kwargs)[source]

It is an utility function to execute dynamically generated function/models and - if Dispatcher based - add their workflows to the parent solution.

Returns:

A function that executes the dispatch of the given dsp.

Return type:

callable

Example:

Follows a simple example on how to use the run_model():

Moreover, it can be used also with all SubDispatcher() like objects:

>>> sub_dsp = SubDispatch(dsp_model, outputs=['c'], output_type='list')
>>> sol = dsp({'dsp_model': sub_dsp, 'inputs': {'b': 1, 'a': 2}})
>>> sol['outputs']
[2]
>>> sol.workflow.nodes['execute_dsp']['solution']
Solution([('a', 2), ('b', 1), ('c', 2)])

Methods

__init__

__init__(func, *args, _init=None, **kwargs)[source]