8.1.1.14. get_sub_dsp_from_workflow

Dispatcher.get_sub_dsp_from_workflow(sources, graph=None, reverse=False, add_missing=False, check_inputs=True, blockers=None, wildcard=False, _update_links=True)[source]

Returns the sub-dispatcher induced by the workflow from sources.

The induced sub-dispatcher of the dsp contains the reachable nodes and edges evaluated with breadth-first-search on the workflow graph from source nodes.

Parameters:
  • sources (list[str], iterable) – Source nodes for the breadth-first-search. A container of nodes which will be iterated through once.
  • graph (networkx.DiGraph, optional) – A directed graph where evaluate the breadth-first-search.
  • reverse (bool, optional) – If True the workflow graph is assumed as reversed.
  • add_missing (bool, optional) – If True, missing function’ inputs are added to the sub-dispatcher.
  • check_inputs (bool, optional) – If True the missing function’ inputs are not checked.
  • blockers (set[str], iterable, optional) – Nodes to not be added to the queue.
  • 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.
  • _update_links (bool, optional) – If True, it updates remote links of the extracted dispatcher.
Returns:

A sub-dispatcher.

Return type:

Dispatcher

See also

get_sub_dsp()

Note

The sub-dispatcher edge or node attributes just point to the original dispatcher. So changes to the node or edge structure will not be reflected in the original dispatcher map while changes to the attributes will.

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

Example:

A dispatcher with a function fun and a node a with a default value:

digraph dmap { graph [ratio=1] node [style=filled] label = <dmap> splines = ortho style = filled 151 [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">1</TD></TR></TABLE>> fillcolor=cyan id=0 shape=box style="rounded,filled" tooltip="\"a\""] 152 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">b</TD></TR></TABLE>> fillcolor=cyan id=2 shape=box style="rounded,filled" tooltip="\"b\""] 153 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">c</TD></TR></TABLE>> fillcolor=cyan id=3 shape=box style="rounded,filled" tooltip="\"c\""] 154 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">d</TD></TR></TABLE>> fillcolor=cyan id=4 shape=box style="rounded,filled" tooltip="\"d\""] 155 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">e</TD></TR></TABLE>> fillcolor=cyan id=6 shape=box style="rounded,filled" tooltip="\"e\""] 156 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-c055d82022328dc73c189c636534208cf7453442/fun1-function.html">fun1</TD></TR></TABLE>> fillcolor=springgreen id=1 shape=box tooltip="\"fun1\""] 157 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-c055d82022328dc73c189c636534208cf7453442/fun2-function.html">fun2</TD></TR></TABLE>> fillcolor=springgreen id=5 shape=box tooltip="\"fun2\""] 151 -> 156 156 -> 153 156 -> 154 152 -> 156 157 -> 153 155 -> 157 }

Dispatch with no calls in order to have a workflow:

>>> o = dsp.dispatch(inputs=['a', 'b'], no_call=True)

Get sub-dispatcher from workflow inputs a and b:

>>> sub_dsp = dsp.get_sub_dsp_from_workflow(['a', 'b'])

digraph dmap { graph [ratio=1] node [style=filled] label = <dmap> splines = ortho style = filled 164 [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">1</TD></TR></TABLE>> fillcolor=cyan id=0 shape=box style="rounded,filled" tooltip="\"a\""] 165 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">b</TD></TR></TABLE>> fillcolor=cyan id=2 shape=box style="rounded,filled" tooltip="\"b\""] 166 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">c</TD></TR></TABLE>> fillcolor=cyan id=3 shape=box style="rounded,filled" tooltip="\"c\""] 167 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">d</TD></TR></TABLE>> fillcolor=cyan id=4 shape=box style="rounded,filled" tooltip="\"d\""] 168 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-d42f3378acc8c2a7d5c0c3f1fd642b952ee7c88b/fun1-function.html">fun1</TD></TR></TABLE>> fillcolor=springgreen id=1 shape=box tooltip="\"fun1\""] 164 -> 168 165 -> 168 168 -> 166 168 -> 167 }

Get sub-dispatcher from a workflow output c:

>>> sub_dsp = dsp.get_sub_dsp_from_workflow(['c'], reverse=True)

digraph dmap { graph [ratio=1] node [style=filled] label = <dmap> splines = ortho style = filled 173 [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">1</TD></TR></TABLE>> fillcolor=cyan id=0 shape=box style="rounded,filled" tooltip="\"a\""] 174 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">b</TD></TR></TABLE>> fillcolor=cyan id=2 shape=box style="rounded,filled" tooltip="\"b\""] 175 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">c</TD></TR></TABLE>> fillcolor=cyan id=3 shape=box style="rounded,filled" tooltip="\"c\""] 176 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-d83b85222e364e120178f090ff400a4dfa67f859/fun1-function.html">fun1</TD></TR><TR><TD align="RIGHT" border="1">M_outputs</TD><TD align="LEFT" border="1">(&#x27;d&#x27;,)</TD></TR></TABLE>> fillcolor=orange id=1 shape=box tooltip="\"fun1\""] 176 -> 175 173 -> 176 174 -> 176 }