7.2.6.21. SubDispatchPipe¶
-
class
SubDispatchPipe
(dsp, function_id, inputs, outputs=None, cutoff=None, inputs_dist=None, no_domain=True, wildcard=True)[source]¶ It converts a
Dispatcher()
into a function.This function takes a sequence of arguments as input of the dispatch.
Returns: A function that executes the pipe of the given dsp. Return type: callable See also
dispatch()
,shrink_dsp()
Example:
A dispatcher with two functions max and min and an unresolved cycle (i.e., a –> max –> c –> min –> a):
Extract a static function node, i.e. the inputs a and b and the output a are fixed:
>>> fun = SubDispatchPipe(dsp, 'myF', ['a', 'b'], ['a']) >>> fun.__name__ 'myF' >>> fun(2, 1) 1
The created function raises a ValueError if un-valid inputs are provided:
>>> fun(1, 0) 0
Methods
__init__
Initializes the Sub-dispatch Function. copy
get_node
Returns a sub node of a dispatcher. parse_inputs
plot
Plots the Dispatcher with a graph in the DOT language with Graphviz. search_node_description
web
Creates a dispatcher Flask app. -
__init__
(dsp, function_id, inputs, outputs=None, cutoff=None, inputs_dist=None, no_domain=True, wildcard=True)[source]¶ Initializes the Sub-dispatch Function.
Parameters: - dsp (schedula.Dispatcher) – A dispatcher that identifies the model adopted.
- function_id (str) – Function name.
- inputs (list[str], iterable) – Input data nodes.
- outputs (list[str], iterable, optional) – Ending data nodes.
- cutoff (float, int, optional) – Depth to stop the search.
- inputs_dist (dict[str, int | float], optional) – Initial distances of input data nodes.
-