8.2.15.1. Solution¶
- class Solution(*args, **kwargs)[source]¶
Solution class for dispatch result.
Methods
__class_getitem__See PEP 585
__contains__True if the dictionary has the specified key, else False.
__delattr__Implement delattr(self, name).
__delitem__Delete self[key].
__dir__Default dir() implementation.
__eq__Return self==value.
__format__Default object formatter.
__ge__Return self>=value.
__getattribute__Return getattr(self, name).
__getitem__x.__getitem__(y) <==> x[y]
__getstate__Helper for pickle.
__gt__Return self>value.
Return hash(self).
__init_subclass__This method is called when a class is subclassed.
__ior__Return self|=value.
__iter__Implement iter(self).
__le__Return self<=value.
__len__Return len(self).
__lt__Return self<value.
__ne__Return self!=value.
__new____or__Return self|value.
__reduce__Return state information for pickling
__reduce_ex__Helper for pickle.
Return repr(self).
__reversed__od.__reversed__() <==> reversed(od)
__ror__Return value|self.
__setattr__Implement setattr(self, name, value).
__setitem__Set self[key] to value.
__sizeof__Size of object in memory, in bytes.
__str__Return str(self).
__subclasshook__Abstract classes can override this to customize issubclass().
Add initial values updating workflow, seen, and fringe.
Returns the data nodes estimations and wait_inputs flag.
Initialize the dispatcher as sub-dispatcher and update the fringe.
Removes unused function and sub-dispatcher nodes.
See a node, updating seen and fringe.
See data remote links of the node (set output to remote links).
Set the data node output from node estimations.
Set the function node output from node inputs.
Set the node outputs from node inputs.
Initializes the sub-dispatcher and set its inputs.
Update wildcards set with the input data nodes that are also outputs.
Visits a node, updating workflow, seen, and fringe..
Handles the error messages.
Terminates ArciDispatch algorithm when all targets have been visited.
Stops the search of the investigated node of the ArciDispatch algorithm, until all inputs are satisfied.
clearod.clear() -> None.
copyod.copy() -> a shallow copy of od
formCreates a dispatcher Form Flask app.
fromkeysCreate a new ordered dictionary with keys from iterable and values set to value.
getReturn the value for key if key is in the dictionary, else default.
get_nodeReturns a sub node of a dispatcher.
Returns the sub-dispatcher induced by the workflow from sources.
itemsD.items() -> a set-like object providing a view on D's items
keysD.keys() -> a set-like object providing a view on D's keys
move_to_endMove an existing element to the end (or beginning if last is false).
plotPlots the Dispatcher with a graph in the DOT language with Graphviz.
popod.pop(key[,default]) -> v, remove specified key and return the corresponding value.
popitemRemove and return a (key, value) pair from the dictionary.
Set all asynchronous results.
setdefaultInsert key with a value of default if key is not in the dictionary.
updateD.update([E, ]**F) -> None.
valuesD.values() -> an object providing a view on D's values
webCreates a dispatcher Flask app.
- __init__(dsp=None, inputs=None, outputs=None, wildcard=False, inputs_dist=None, no_call=False, rm_unused_nds=False, wait_in=None, no_domain=False, _empty=False, index=(-1,), full_name=(), verbose=False, excluded_defaults=())[source]¶
Attributes
__dict____weakref__list of weak references to the object
Returns the full pipe of a dispatch run.
- __init__(dsp=None, inputs=None, outputs=None, wildcard=False, inputs_dist=None, no_call=False, rm_unused_nds=False, wait_in=None, no_domain=False, _empty=False, index=(-1,), full_name=(), verbose=False, excluded_defaults=())[source]¶
- _set_wildcards(wildcard, inputs=None, outputs=None)[source]¶
Update wildcards set with the input data nodes that are also outputs.
- Parameters:
wildcard (bool, int) – 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. If it is equal to 2, the the data node that cannot be calculated are excluded by the wildcard condition.
outputs (list[str], iterable, optional) – Ending data nodes.
- check_wait_in(wait_in, n_id)[source]¶
Stops the search of the investigated node of the ArciDispatch algorithm, until all inputs are satisfied.
- get_sub_dsp_from_workflow(sources, reverse=False, add_missing=False, check_inputs=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.
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.
- Returns:
A sub-dispatcher.
- Return type:
- property pipe¶
Returns the full pipe of a dispatch run.
- check_targets(node_id)[source]¶
Terminates ArciDispatch algorithm when all targets have been visited.
- _get_node_estimations(node_attr, node_id)[source]¶
Returns the data nodes estimations and wait_inputs flag.
- _set_node_output(node_id, no_call, next_nds=None, **kw)[source]¶
Set the node outputs from node inputs.
- _set_data_node_output(node_id, node_attr, no_call, next_nds=None, **kw)[source]¶
Set the data node output from node estimations.
- _set_function_node_output(node_id, node_attr, no_call, next_nds=None, **kw)[source]¶
Set the function node output from node inputs.
- _add_initial_value(data_id, value, initial_dist=0.0, fringe=None, no_call=None)[source]¶
Add initial values updating workflow, seen, and fringe.
- Parameters:
fringe (list[(float | int, bool, (str, Dispatcher)]) – Heapq of closest available nodes.
no_call (bool) – If True data node estimation function is not used.
data_id (str) – Data node id.
value (dict[str, T]) – Data node value e.g., {‘value’: val}.
initial_dist (float, int, optional) – Data node initial distance in the ArciDispatch algorithm.
- Returns:
True if the data has been visited, otherwise false.
- Return type:
- _visit_nodes(node_id, dist, fringe, no_call=False, **kw)[source]¶
Visits a node, updating workflow, seen, and fringe..
- Parameters:
- Returns:
False if all dispatcher targets have been reached, otherwise True.
- Return type:
- _see_node(node_id, fringe, dist, w_wait_in=0)[source]¶
See a node, updating seen and fringe.
- Parameters:
- Returns:
True if the node is visible, otherwise False.
- Return type:
- _init_sub_dsp(dsp, fringe, outputs, no_call, initial_dist, index, full_name, excluded_defaults)[source]¶
Initialize the dispatcher as sub-dispatcher and update the fringe.
- _see_remote_link_node(node_id, fringe=None, dist=None, check_dsp=<function Solution.<lambda>>)[source]¶
See data remote links of the node (set output to remote links).
- Parameters:
node_id (str) – Node id.
fringe (list[(float | int, bool, (str, Dispatcher)]) – Heapq of closest available nodes.
check_dsp ((Dispatcher) -> bool) – A function to check if the remote dispatcher is ok.
- _set_sub_dsp_node_input(node_id, dsp_id, fringe, no_call, initial_dist)[source]¶
Initializes the sub-dispatcher and set its inputs.
- Parameters:
node_id (str) – Input node to set.
dsp_id (str) – Sub-dispatcher node id.
fringe (list[(float | int, bool, (str, Dispatcher)]) – Heapq of closest available nodes.
no_call (bool) – If True data node estimation function is not used.
initial_dist (int, float) – Distance to reach the sub-dispatcher node.
- Returns:
If the input have been set.
- Return type:
- _warning(msg, node_id, ex, *args, **kwargs)[source]¶
Handles the error messages.
Note
If self.raises is True the dispatcher interrupt the dispatch when an error occur, otherwise if raises != ‘’ it logs a warning.
- __annotations__ = {}¶
- __doc__ = 'Solution class for dispatch result.'¶
- __module__ = 'schedula.utils.sol'¶