7.1.1.8. 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)[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 (threading.Event, optional) – A semaphore to abort the dispatching.
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 0 [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 shape=box style="rounded,filled" tooltip=a] 1 [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 shape=box style="rounded,filled" tooltip=b] 2 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">c</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=c] 3 [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 shape=box style="rounded,filled" tooltip=d] 4 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">e</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=e] 5 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6f3d4c386651ea551538ec292ef6e138750921c3/my_log.html">log(b - a)</TD></TR><TR><TD align="RIGHT" border="1">input_domain</TD><TD align="LEFT" border="1" href="./dispatcher-6f3d4c386651ea551538ec292ef6e138750921c3/my_domain.html">my_domain</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip="log(b - a)"] 6 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-6f3d4c386651ea551538ec292ef6e138750921c3/min.html">min</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip="min(iterable, *[, default=obj, key=func]) -> value"] 5 -> 4 3 -> 5 0 -> 6 2 -> 5 1 -> 6 6 -> 2 }

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 13 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-c2b2e58cce9c9beffc9faa9a74c41f7ea0093e30/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 shape=box style="rounded,filled" tooltip=a] 14 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-c2b2e58cce9c9beffc9faa9a74c41f7ea0093e30/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 shape=box style="rounded,filled" tooltip=b] 15 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-c2b2e58cce9c9beffc9faa9a74c41f7ea0093e30/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 shape=box style="rounded,filled" tooltip=c] 16 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-c2b2e58cce9c9beffc9faa9a74c41f7ea0093e30/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 shape=box style="rounded,filled" tooltip=d] 17 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-c2b2e58cce9c9beffc9faa9a74c41f7ea0093e30/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 shape=box style="rounded,filled" tooltip=e] 18 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-c2b2e58cce9c9beffc9faa9a74c41f7ea0093e30/my_log.html">log(b - a)</TD></TR><TR><TD align="RIGHT" border="1">solution_domain</TD><TD align="LEFT" border="1" href="./dispatcher-c2b2e58cce9c9beffc9faa9a74c41f7ea0093e30/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">2018-06-05T10:44:14.931788</TD></TR><TR><TD align="RIGHT" border="1">duration</TD><TD align="LEFT" border="1">0:00:00.000017</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip="log(b - a)"] 19 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-c2b2e58cce9c9beffc9faa9a74c41f7ea0093e30/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">2018-06-05T10:44:14.931675</TD></TR><TR><TD align="RIGHT" border="1">duration</TD><TD align="LEFT" border="1">0:00:00.000016</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip="min(iterable, *[, default=obj, key=func]) -> value"] 20 [label=start fillcolor=red shape=egg] 14 -> 19 20 -> 14 18 -> 17 13 -> 19 15 -> 18 16 -> 18 19 -> 15 20 -> 16 20 -> 13 }

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 30 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-459a8c9c07bc15724ed07fe0d76824dad9796cea/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 shape=box style="rounded,filled" tooltip=a] 31 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-459a8c9c07bc15724ed07fe0d76824dad9796cea/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 shape=box style="rounded,filled" tooltip=b] 32 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-459a8c9c07bc15724ed07fe0d76824dad9796cea/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 shape=box style="rounded,filled" tooltip=c] 33 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-459a8c9c07bc15724ed07fe0d76824dad9796cea/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">2018-06-05T10:44:14.981083</TD></TR><TR><TD align="RIGHT" border="1">duration</TD><TD align="LEFT" border="1">0:00:00.000014</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip="min(iterable, *[, default=obj, key=func]) -> value"] 34 [label=start fillcolor=red shape=egg] 31 -> 33 33 -> 32 34 -> 30 34 -> 31 30 -> 33 }

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 40 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-4468933c3db847ff99f6096d6c64652af444fdc5/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 shape=box style="rounded,filled" tooltip=a] 41 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-4468933c3db847ff99f6096d6c64652af444fdc5/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 shape=box style="rounded,filled" tooltip=b] 42 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-4468933c3db847ff99f6096d6c64652af444fdc5/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 shape=box style="rounded,filled" tooltip=c] 43 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-4468933c3db847ff99f6096d6c64652af444fdc5/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 shape=box style="rounded,filled" tooltip=d] 44 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-4468933c3db847ff99f6096d6c64652af444fdc5/my_log.html">log(b - a)</TD></TR><TR><TD align="RIGHT" border="1">input_domain</TD><TD align="LEFT" border="1" href="./dispatcher-4468933c3db847ff99f6096d6c64652af444fdc5/my_domain.html">my_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 shape=box tooltip="log(b - a)"] 45 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-4468933c3db847ff99f6096d6c64652af444fdc5/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">2018-06-05T10:44:15.010914</TD></TR><TR><TD align="RIGHT" border="1">duration</TD><TD align="LEFT" border="1">0:00:00.000015</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip="min(iterable, *[, default=obj, key=func]) -> value"] 46 [label=start fillcolor=red shape=egg] 46 -> 41 43 -> 44 40 -> 45 42 -> 44 41 -> 45 45 -> 42 46 -> 43 46 -> 40 }