7.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:

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'])

Get sub-dispatcher from a workflow output c:

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