[core] handle unsatisfied node parallelization requirements

* catch error in case the required attribute is not found in preceding nodes
* set an empty list of chunks when this happens
* avoid uncatched exceptions in the middle of an update
This commit is contained in:
Yann Lanthony 2017-11-08 18:41:34 +01:00
parent ccaac43b34
commit 80cad9386a
2 changed files with 17 additions and 7 deletions

View file

@ -785,13 +785,19 @@ class Node(BaseObject):
def updateInternals(self):
if self.isParallelized:
ranges = self.nodeDesc.parallelization.getRanges(self)
if len(ranges) != len(self.chunks):
self._chunks = [NodeChunk(self, range) for range in ranges]
try:
ranges = self.nodeDesc.parallelization.getRanges(self)
if len(ranges) != len(self.chunks):
self._chunks = [NodeChunk(self, range) for range in ranges]
self.chunksChanged.emit()
else:
for chunk, range in zip(self.chunks, ranges):
chunk.range = range
except RuntimeError:
# TODO: set node internal status to error
logging.warning("Invalid Parallelization on node {}".format(self._name))
self._chunks = []
self.chunksChanged.emit()
else:
for chunk, range in zip(self.chunks, ranges):
chunk.range = range
else:
if len(self._chunks) != 1:
self._chunks = [NodeChunk(self, desc.Range())]