def compute(self, name, raise_exceptions=False):
"""
Compute a node and all necessary predecessors
Following the computation, if successful, the target node, and all necessary ancestors that were not already UPTODATE will have been calculated and set to UPTODATE. Any node that did not need to be calculated will not have been recalculated.
If any nodes raises an exception, then the state of that node will be set to ERROR, and its value set to an object containing the exception object, as well as a traceback. This will not halt the computation, which will proceed as far as it can, until no more nodes that would be required to calculate the target are COMPUTABLE.
:param name: Name of the node to compute
:param raise_exceptions: Whether to pass exceptions raised by node computations back to the caller
:type raise_exceptions: Boolean, default False
"""
if isinstance(name, (types.GeneratorType, list)):
calc_nodes = set()
for name0 in name:
for n in self._get_calc_nodes(name0):
calc_nodes.add(n)
else:
calc_nodes = self._get_calc_nodes(name)
self._compute_nodes(calc_nodes, raise_exceptions=raise_exceptions)
评论列表
文章目录