8.2.4.4.26. add_dispatcher

BlueDispatcher.add_dispatcher(dsp, inputs=None, outputs=None, dsp_id=None, input_domain=None, weight=None, inp_weight=None, description=None, include_defaults=False, await_domain=None, inputs_prefix='', outputs_prefix='', **kwargs)[source]

Add a single sub-dispatcher node to dispatcher.

Parameters:
  • dsp (BlueDispatcher | Dispatcher | dict[str, list]) – Child dispatcher that is added as sub-dispatcher node to the parent dispatcher.

  • inputs (dict[str, str | list[str]] | tuple[str] | (str, ..., dict[str, str | list[str]])) – Inputs mapping. Data node ids from parent dispatcher to child sub-dispatcher. If None all child dispatcher nodes are used as inputs.

  • outputs (dict[str, str | list[str]] | tuple[str] | (str, ..., dict[str, str | list[str]])) – Outputs mapping. Data node ids from child sub-dispatcher to parent dispatcher. If None all child dispatcher nodes are used as outputs.

  • dsp_id (str, optional) – Sub-dispatcher node id. If None will be assigned as <dsp.name>.

  • input_domain ((dict) -> bool, optional) –

    A function that checks if input values satisfy the function domain. This can be any function that takes the a dictionary with the inputs of the sub-dispatcher node and returns True if input values satisfy the domain, otherwise False.

    Note

    This function is invoked every time that a data node reach the sub-dispatcher node.

  • weight (float, int, optional) – Node weight. It is a weight coefficient that is used by the dispatch algorithm to estimate the minimum workflow.

  • inp_weight (dict[str, int | float], optional) – Edge weights from data nodes to the sub-dispatcher node. It is a dictionary (key=data node id) with the weight coefficients used by the dispatch algorithm to estimate the minimum workflow.

  • description (str, optional) – Sub-dispatcher node’s description.

  • include_defaults (bool, optional) – If True the default values of the sub-dispatcher are added to the current dispatcher.

  • await_domain (bool|int|float, optional) – If True the Dispatcher waits all input results before executing the input_domain function. If a number is defined this is used as timeout for Future.result method [default: True]. Note this is used when asynchronous or parallel execution is enable.

  • inputs_prefix (str) – Add a prefix to parent dispatcher inputs nodes.

  • outputs_prefix (str) – Add a prefix to parent dispatcher outputs nodes.

  • kwargs (keyword arguments, optional) – Set additional node attributes using key=value.

Returns:

Self.

Return type:

BlueDispatcher