8.2.8.21.35. __doc__ΒΆ

SubDispatch.__doc__ = "\n    It dispatches a given :class:`~schedula.dispatcher.Dispatcher` like a\n    function.\n\n    This function takes a sequence of dictionaries as input that will be\n    combined before the dispatching.\n\n    :return:\n        A function that executes the dispatch of the given\n        :class:`~schedula.dispatcher.Dispatcher`.\n    :rtype: callable\n\n    .. seealso:: :func:`~schedula.dispatcher.Dispatcher.dispatch`,\n       :func:`combine_dicts`\n\n    Example:\n\n    .. dispatcher:: dsp\n       :opt: graph_attr={'ratio': '1'}, depth=-1\n       :code:\n\n        >>> from schedula import Dispatcher\n        >>> sub_dsp = Dispatcher(name='Sub-dispatcher')\n        ...\n        >>> def fun(a):\n        ...     return a + 1, a - 1\n        ...\n        >>> sub_dsp.add_function('fun', fun, ['a'], ['b', 'c'])\n        'fun'\n        >>> dispatch = SubDispatch(sub_dsp, ['a', 'b', 'c'], output_type='dict')\n        >>> dsp = Dispatcher(name='Dispatcher')\n        >>> dsp.add_function('Sub-dispatch', dispatch, ['d'], ['e'])\n        'Sub-dispatch'\n\n    The Dispatcher output is:\n\n    .. dispatcher:: o\n       :opt: graph_attr={'ratio': '1'}, depth=-1\n       :code:\n\n        >>> o = dsp.dispatch(inputs={'d': {'a': 3}})\n\n    while, the Sub-dispatch is:\n\n    .. dispatcher:: sol\n       :opt: graph_attr={'ratio': '1'}, depth=-1\n       :code:\n\n        >>> sol = o.workflow.nodes['Sub-dispatch']['solution']\n        >>> sol\n        Solution({'a': 3, 'b': 4, 'c': 2})\n        >>> sol == o['e']\n        True\n\n    "