8.1.1.10. dispatch

Dispatcher.dispatch(inputs=None, outputs=None, cutoff=None, inputs_dist=None, wildcard=False, no_call=False, shrink=False, rm_unused_nds=False, select_output_kw=None, _wait_in=None, stopper=None, executor=False, sol_name=())[source]

Evaluates the minimum workflow and data outputs of the dispatcher model from given inputs.

Parameters:
  • inputs (dict[str, T], list[str], iterable, optional) – Input data values.
  • 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.
  • wildcard (bool, optional) – If True, when the data node is used as input and target in the ArciDispatch algorithm, the input value will be used as input for the connected functions, but not as output.
  • no_call (bool, optional) – If True data node estimation function is not used and the input values are not used.
  • shrink (bool, optional) –

    If True the dispatcher is shrink before the dispatch.

    See also

    shrink_dsp()

  • rm_unused_nds (bool, optional) – If True unused function and sub-dispatcher nodes are removed from workflow.
  • select_output_kw (dict, optional) – Kwargs of selector function to select specific outputs.
  • _wait_in (dict, optional) – Override wait inputs.
  • stopper (multiprocess.Event, optional) – A semaphore to abort the dispatching.
  • executor (str, optional) – A pool executor id to dispatch asynchronously or in parallel.
  • sol_name (tuple[str], optional) – Solution name.
Returns:

Dictionary of estimated data node outputs.

Return type:

schedula.utils.sol.Solution

——————————————————————–

Example:

A dispatcher with a function \(log(b - a)\) and two data a and b with default values:

digraph dmap { graph [ratio=1] node [style=filled] label = <dmap> splines = ortho style = filled 36 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">a</TD></TR><TR><TD align="RIGHT" border="1">default</TD><TD align="LEFT" border="1">0</TD></TR></TABLE>> fillcolor=cyan id=0 shape=box style="rounded,filled" tooltip="\"a\""] 37 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">b</TD></TR><TR><TD align="RIGHT" border="1">default</TD><TD align="LEFT" border="1">5</TD></TR></TABLE>> fillcolor=cyan id=1 shape=box style="rounded,filled" tooltip="\"b\""] 38 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">c</TD></TR></TABLE>> fillcolor=cyan id=4 shape=box style="rounded,filled" tooltip="\"c\""] 39 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">d</TD></TR><TR><TD align="RIGHT" border="1">default</TD><TD align="LEFT" border="1">1</TD></TR></TABLE>> fillcolor=cyan id=2 shape=box style="rounded,filled" tooltip="\"d\""] 40 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">e</TD></TR></TABLE>> fillcolor=cyan id=5 shape=box style="rounded,filled" tooltip="\"e\""] 41 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-06637883e1316589b4cfff34f47076cecf01bede/my_log.html">log(b - a)</TD></TR><TR><TD align="RIGHT" border="1">input_domain</TD><TD align="LEFT" border="1" href="./dispatcher-06637883e1316589b4cfff34f47076cecf01bede/my_domain.html">my_domain</TD></TR></TABLE>> fillcolor=springgreen id=3 shape=box tooltip="\"log(b - a)\""] 42 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-06637883e1316589b4cfff34f47076cecf01bede/min.html">min</TD></TR></TABLE>> fillcolor=springgreen id=6 shape=box tooltip="\"min(iterable, *[, default=obj, key=func]) -> value\""] 36 -> 42 37 -> 42 39 -> 41 41 -> 40 38 -> 41 42 -> 38 }

Dispatch without inputs. The default values are used as inputs:

>>> outputs = dsp.dispatch()
>>> outputs
Solution([('a', 0), ('b', 5), ('d', 1), ('c', 0), ('e', 0.0)])

digraph workflow { graph [ratio=1] node [style=filled] label = <workflow> splines = ortho style = filled 49 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6ea807859bca8ce973dbccc4797dbb0541cd6b6d/a-output.html">a</TD></TR><TR><TD align="RIGHT" border="1">default</TD><TD align="LEFT" border="1">0</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">0.0</TD></TR></TABLE>> fillcolor=cyan id=0 shape=box style="rounded,filled" tooltip="\"a\""] 50 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6ea807859bca8ce973dbccc4797dbb0541cd6b6d/b-output.html">b</TD></TR><TR><TD align="RIGHT" border="1">default</TD><TD align="LEFT" border="1">5</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">0.0</TD></TR></TABLE>> fillcolor=cyan id=1 shape=box style="rounded,filled" tooltip="\"b\""] 51 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6ea807859bca8ce973dbccc4797dbb0541cd6b6d/c-output.html">c</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">2.0</TD></TR></TABLE>> fillcolor=cyan id=4 shape=box style="rounded,filled" tooltip="\"c\""] 52 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6ea807859bca8ce973dbccc4797dbb0541cd6b6d/d-output.html">d</TD></TR><TR><TD align="RIGHT" border="1">default</TD><TD align="LEFT" border="1">1</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">0.0</TD></TR></TABLE>> fillcolor=cyan id=2 shape=box style="rounded,filled" tooltip="\"d\""] 53 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6ea807859bca8ce973dbccc4797dbb0541cd6b6d/e-output.html">e</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">4.0</TD></TR></TABLE>> fillcolor=cyan id=5 shape=box style="rounded,filled" tooltip="\"e\""] 54 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6ea807859bca8ce973dbccc4797dbb0541cd6b6d/my_log.html">log(b - a)</TD></TR><TR><TD align="RIGHT" border="1">solution_domain</TD><TD align="LEFT" border="1" href="./dispatcher-6ea807859bca8ce973dbccc4797dbb0541cd6b6d/log(b_-_a)-solution_domain.html">log(b - a)-solution_domain</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">3.0</TD></TR><TR><TD align="RIGHT" border="1">started</TD><TD align="LEFT" border="1">2019-12-06T17:54:53.433070</TD></TR><TR><TD align="RIGHT" border="1">duration</TD><TD align="LEFT" border="1">0:00:00.000019</TD></TR></TABLE>> fillcolor=springgreen id=3 shape=box tooltip="\"log(b - a)\""] 55 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6ea807859bca8ce973dbccc4797dbb0541cd6b6d/min.html">min</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">1.0</TD></TR><TR><TD align="RIGHT" border="1">started</TD><TD align="LEFT" border="1">2019-12-06T17:54:53.432970</TD></TR><TR><TD align="RIGHT" border="1">duration</TD><TD align="LEFT" border="1">0:00:00.000028</TD></TR></TABLE>> fillcolor=springgreen id=6 shape=box tooltip="\"min(iterable, *[, default=obj, key=func]) -> value\""] 56 [label=start fillcolor=red id=start shape=egg] 56 -> 49 56 -> 50 56 -> 52 49 -> 55 50 -> 55 52 -> 54 55 -> 51 54 -> 53 51 -> 54 }

Dispatch until data node c is estimated:

>>> outputs = dsp.dispatch(outputs=['c'])
>>> outputs
Solution([('a', 0), ('b', 5), ('c', 0)])

digraph workflow { graph [ratio=1] node [style=filled] label = <workflow> splines = ortho style = filled 66 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-90d5378eb02f1f60ab17022f11fef399feec45c4/a-output.html">a</TD></TR><TR><TD align="RIGHT" border="1">default</TD><TD align="LEFT" border="1">0</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">0.0</TD></TR></TABLE>> fillcolor=cyan id=0 shape=box style="rounded,filled" tooltip="\"a\""] 67 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-90d5378eb02f1f60ab17022f11fef399feec45c4/b-output.html">b</TD></TR><TR><TD align="RIGHT" border="1">default</TD><TD align="LEFT" border="1">5</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">0.0</TD></TR></TABLE>> fillcolor=cyan id=1 shape=box style="rounded,filled" tooltip="\"b\""] 68 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-90d5378eb02f1f60ab17022f11fef399feec45c4/c-output.html">c</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">2.0</TD></TR></TABLE>> fillcolor=cyan id=4 shape=box style="rounded,filled" tooltip="\"c\""] 69 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-90d5378eb02f1f60ab17022f11fef399feec45c4/min.html">min</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">1.0</TD></TR><TR><TD align="RIGHT" border="1">started</TD><TD align="LEFT" border="1">2019-12-06T17:54:53.477559</TD></TR><TR><TD align="RIGHT" border="1">duration</TD><TD align="LEFT" border="1">0:00:00.000017</TD></TR></TABLE>> fillcolor=springgreen id=6 shape=box tooltip="\"min(iterable, *[, default=obj, key=func]) -> value\""] 70 [label=start fillcolor=red id=start shape=egg] 70 -> 66 70 -> 67 66 -> 69 67 -> 69 69 -> 68 }

Dispatch with one inputs. The default value of a is not used as inputs:

>>> outputs = dsp.dispatch(inputs={'a': 3})
>>> outputs
Solution([('a', 3), ('b', 5), ('d', 1), ('c', 3)])

digraph workflow { graph [ratio=1] node [style=filled] label = <workflow> splines = ortho style = filled 76 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6d53f88a9af006bea028f77358c77ba75feb32f0/a-output.html">a</TD></TR><TR><TD align="RIGHT" border="1">default</TD><TD align="LEFT" border="1">0</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">0.0</TD></TR></TABLE>> fillcolor=cyan id=0 shape=box style="rounded,filled" tooltip="\"a\""] 77 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6d53f88a9af006bea028f77358c77ba75feb32f0/b-output.html">b</TD></TR><TR><TD align="RIGHT" border="1">default</TD><TD align="LEFT" border="1">5</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">0.0</TD></TR></TABLE>> fillcolor=cyan id=1 shape=box style="rounded,filled" tooltip="\"b\""] 78 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6d53f88a9af006bea028f77358c77ba75feb32f0/c-output.html">c</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">2.0</TD></TR></TABLE>> fillcolor=cyan id=4 shape=box style="rounded,filled" tooltip="\"c\""] 79 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6d53f88a9af006bea028f77358c77ba75feb32f0/d-output.html">d</TD></TR><TR><TD align="RIGHT" border="1">default</TD><TD align="LEFT" border="1">1</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">0.0</TD></TR></TABLE>> fillcolor=cyan id=2 shape=box style="rounded,filled" tooltip="\"d\""] 80 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6d53f88a9af006bea028f77358c77ba75feb32f0/my_log.html">log(b - a)</TD></TR><TR><TD align="RIGHT" border="1">solution_domain</TD><TD align="LEFT" border="1" href="./dispatcher-6d53f88a9af006bea028f77358c77ba75feb32f0/log(b_-_a)-solution_domain.html">log(b - a)-solution_domain</TD></TR><TR><TD align="RIGHT" border="1">M_outputs</TD><TD align="LEFT" border="1">(&#x27;e&#x27;,)</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">3.0</TD></TR></TABLE>> fillcolor=orange id=3 shape=box tooltip="\"log(b - a)\""] 81 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6d53f88a9af006bea028f77358c77ba75feb32f0/min.html">min</TD></TR><TR><TD align="RIGHT" border="1">distance</TD><TD align="LEFT" border="1">1.0</TD></TR><TR><TD align="RIGHT" border="1">started</TD><TD align="LEFT" border="1">2019-12-06T17:54:53.502571</TD></TR><TR><TD align="RIGHT" border="1">duration</TD><TD align="LEFT" border="1">0:00:00.000017</TD></TR></TABLE>> fillcolor=springgreen id=6 shape=box tooltip="\"min(iterable, *[, default=obj, key=func]) -> value\""] 82 [label=start fillcolor=red id=start shape=egg] 82 -> 76 82 -> 77 82 -> 79 76 -> 81 77 -> 81 79 -> 80 81 -> 78 78 -> 80 }