Skip to content

Commit e8c5372

Browse files
committed
[core] node: Use explicit keys for chunks' blockSize, fullSize and nbBlocks in status files
1 parent bc6ef4a commit e8c5372

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

meshroom/core/node.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ class ExecMode(Enum):
6565
NodeChunkSetup = namedtuple("NodeChunks", ["blockSize", "fullSize", "nbBlocks"])
6666

6767
class NodeStatusData(BaseObject):
68-
__slots__ = ("nodeName", "nodeType", "status", "execMode", "packageName",
69-
"mrNodeType", "submitterSessionUid", "chunks", "jobInfo")
68+
__slots__ = ("nodeName", "nodeType", "status", "execMode", "packageName", "mrNodeType",
69+
"submitterSessionUid", "chunksBlockSize", "chunksFullSize", "chunksNbBlocks", "jobInfo")
7070

7171
def __init__(self, nodeName='', nodeType='', packageName='',
7272
mrNodeType: MrNodeType = MrNodeType.NONE, parent: BaseObject = None):
@@ -143,24 +143,25 @@ def initLocalSubmit(self):
143143

144144
def toDict(self):
145145
keys = list(self.__slots__) or []
146-
d = {key:getattr(self, key) for key in keys}
146+
d = {key:getattr(self, key, "") for key in keys}
147147
for _k, _v in d.items():
148148
if isinstance(_v, Enum):
149149
d[_k] = _v.name
150-
chunks = None
151150
if self.chunks:
152-
chunks = list(self.chunks)
153-
d["chunks"] = chunks
151+
d["chunksBlockSize"] = self.chunks.blockSize
152+
d["chunksFullSize"] = self.chunks.fullSize
153+
d["chunksNbBlocks"] = self.chunks.nbBlocks
154154
return d
155155

156156
def fromDict(self, d):
157157
self.reset()
158158
if "mrNodeType" in d:
159159
self.mrNodeType = MrNodeType[d.pop("mrNodeType")]
160-
if "chunks" in d:
161-
chunks = d.pop("chunks")
162-
if chunks:
163-
self.chunks = NodeChunkSetup(*chunks)
160+
if "chunksBlockSize" in d and "chunksFullSize" in d and "chunksNbBlocks" in d:
161+
blockSize = int(d.pop("chunksBlockSize") or 0)
162+
fullSize = int(d.pop("chunksFullSize") or 0)
163+
nbBlocks = int(d.pop("chunksNbBlocks") or 0)
164+
self.chunks = NodeChunkSetup(blockSize, fullSize, nbBlocks)
164165
if "status" in d:
165166
self.status: Status = Status[d.pop("status")]
166167
if "execMode" in d:

0 commit comments

Comments
 (0)