mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-29 18:27:23 +02:00
[core] Implementation of InputNode that doesn't need computation
This commit is contained in:
parent
7f2c65dbd1
commit
82dc3fb294
2 changed files with 17 additions and 1 deletions
|
@ -598,6 +598,13 @@ class Node(object):
|
||||||
def processChunk(self, chunk):
|
def processChunk(self, chunk):
|
||||||
raise NotImplementedError('No processChunk implementation on node: "{}"'.format(chunk.node.name))
|
raise NotImplementedError('No processChunk implementation on node: "{}"'.format(chunk.node.name))
|
||||||
|
|
||||||
|
class InputNode(Node):
|
||||||
|
"""
|
||||||
|
Node that does not need to be processed, it is just a placeholder for inputs.
|
||||||
|
"""
|
||||||
|
def processChunk(self, chunk):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CommandLineNode(Node):
|
class CommandLineNode(Node):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -50,6 +50,7 @@ class Status(Enum):
|
||||||
STOPPED = 4
|
STOPPED = 4
|
||||||
KILLED = 5
|
KILLED = 5
|
||||||
SUCCESS = 6
|
SUCCESS = 6
|
||||||
|
INPUT = 7
|
||||||
|
|
||||||
|
|
||||||
class ExecMode(Enum):
|
class ExecMode(Enum):
|
||||||
|
@ -784,7 +785,7 @@ class BaseNode(BaseObject):
|
||||||
|
|
||||||
def hasStatus(self, status):
|
def hasStatus(self, status):
|
||||||
if not self._chunks:
|
if not self._chunks:
|
||||||
return False
|
return (status == Status.INPUT)
|
||||||
for chunk in self._chunks:
|
for chunk in self._chunks:
|
||||||
if chunk.status.status != status:
|
if chunk.status.status != status:
|
||||||
return False
|
return False
|
||||||
|
@ -793,6 +794,9 @@ class BaseNode(BaseObject):
|
||||||
def _isComputed(self):
|
def _isComputed(self):
|
||||||
return self.hasStatus(Status.SUCCESS)
|
return self.hasStatus(Status.SUCCESS)
|
||||||
|
|
||||||
|
def _isComputable(self):
|
||||||
|
return self.getGlobalStatus() != Status.INPUT
|
||||||
|
|
||||||
def clearData(self):
|
def clearData(self):
|
||||||
""" Delete this Node internal folder.
|
""" Delete this Node internal folder.
|
||||||
Status will be reset to Status.NONE
|
Status will be reset to Status.NONE
|
||||||
|
@ -987,6 +991,8 @@ class BaseNode(BaseObject):
|
||||||
Returns:
|
Returns:
|
||||||
Status: the node global status
|
Status: the node global status
|
||||||
"""
|
"""
|
||||||
|
if isinstance(self.nodeDesc, desc.InputNode):
|
||||||
|
return Status.INPUT
|
||||||
chunksStatus = [chunk.status.status for chunk in self._chunks]
|
chunksStatus = [chunk.status.status for chunk in self._chunks]
|
||||||
|
|
||||||
anyOf = (Status.ERROR, Status.STOPPED, Status.KILLED,
|
anyOf = (Status.ERROR, Status.STOPPED, Status.KILLED,
|
||||||
|
@ -1223,6 +1229,7 @@ class BaseNode(BaseObject):
|
||||||
globalExecMode = Property(str, globalExecMode.fget, notify=globalExecModeChanged)
|
globalExecMode = Property(str, globalExecMode.fget, notify=globalExecModeChanged)
|
||||||
isExternal = Property(bool, isExtern, notify=globalExecModeChanged)
|
isExternal = Property(bool, isExtern, notify=globalExecModeChanged)
|
||||||
isComputed = Property(bool, _isComputed, notify=globalStatusChanged)
|
isComputed = Property(bool, _isComputed, notify=globalStatusChanged)
|
||||||
|
isComputable = Property(bool, _isComputable, notify=globalStatusChanged)
|
||||||
aliveChanged = Signal()
|
aliveChanged = Signal()
|
||||||
alive = Property(bool, alive.fget, alive.fset, notify=aliveChanged)
|
alive = Property(bool, alive.fget, alive.fset, notify=aliveChanged)
|
||||||
lockedChanged = Signal()
|
lockedChanged = Signal()
|
||||||
|
@ -1348,6 +1355,8 @@ class Node(BaseNode):
|
||||||
|
|
||||||
def _updateChunks(self):
|
def _updateChunks(self):
|
||||||
""" Update Node's computation task splitting into NodeChunks based on its description """
|
""" Update Node's computation task splitting into NodeChunks based on its description """
|
||||||
|
if isinstance(self.nodeDesc, desc.InputNode):
|
||||||
|
return
|
||||||
self.setSize(self.nodeDesc.size.computeSize(self))
|
self.setSize(self.nodeDesc.size.computeSize(self))
|
||||||
if self.isParallelized:
|
if self.isParallelized:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Reference in a new issue