[core] Check all chunks' execution mode to determine if a node is external

Prior to this commit, a node was considered external if its first chunk's
execution mode was EXTERN. In some cases, a node can be submitted
externally but have its first chunk's execution mode as LOCAL.

This can occur if computations are started locally then stopped and
resumed externally. If any chunk completed its computations locally,
then its execution mode will remain LOCAL, even if the node is submitted
externally later on.

A node is now considered external if at least one of its chunks'
execution mode is external.
This commit is contained in:
Candice Bentéjac 2023-01-05 17:13:20 +01:00
parent 45d3f202fc
commit 9a956df4d4

View file

@ -764,7 +764,14 @@ class BaseNode(BaseObject):
return [ch for ch in self._chunks if ch.isAlreadySubmitted()]
def isExtern(self):
return self._chunks.at(0).isExtern()
""" Return True if at least one chunk of this Node has an external execution mode, False otherwise.
It is not enough to check whether the first chunk's execution mode is external, because computations
may have been started locally, interrupted, and restarted externally. In that case, if the first
chunk has completed locally before the computations were interrupted, its execution mode will always
be local, even if computations resume externally.
"""
return any(chunk.isExtern() for chunk in self._chunks)
@Slot()
def clearSubmittedChunks(self):