mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-10 23:56:54 +02:00
[ui] change SubmittedOrRunning function to only Running, string computation, function naming
This commit is contained in:
parent
a29061efd5
commit
a5de8b86dc
2 changed files with 25 additions and 17 deletions
|
@ -411,11 +411,12 @@ class NodeChunk(BaseObject):
|
|||
try:
|
||||
self.node.nodeDesc.processChunk(self)
|
||||
except Exception as e:
|
||||
self._status.elapsedTime = time.time() - startTime
|
||||
if self._status.status != Status.STOPPED:
|
||||
self._status.elapsedTime = time.time() - startTime
|
||||
self.upgradeStatusTo(Status.ERROR)
|
||||
raise
|
||||
except (KeyboardInterrupt, SystemError, GeneratorExit) as e:
|
||||
self._status.elapsedTime = time.time() - startTime
|
||||
self.upgradeStatusTo(Status.STOPPED)
|
||||
raise
|
||||
finally:
|
||||
|
@ -806,6 +807,14 @@ class BaseNode(BaseObject):
|
|||
shutil.rmtree(self.internalFolder)
|
||||
self.updateStatusFromCache()
|
||||
|
||||
@Slot(result=str)
|
||||
def getStartDateTime(self):
|
||||
""" Return the date (str) of the first running chunk """
|
||||
if not self.isAlreadySubmittedOrFinished() or len(self._chunks) == 0:
|
||||
return ""
|
||||
dateTime = [chunk._status.startDateTime for chunk in self._chunks if chunk._status.startDateTime != ""]
|
||||
return min(dateTime) if len(dateTime) != 0 else ""
|
||||
|
||||
def isAlreadySubmitted(self):
|
||||
for chunk in self._chunks:
|
||||
if chunk.isAlreadySubmitted():
|
||||
|
@ -828,13 +837,10 @@ class BaseNode(BaseObject):
|
|||
return True
|
||||
return False
|
||||
|
||||
@Slot(result=str)
|
||||
def getFirstChunkRunning(self):
|
||||
""" Return the date (str) of the first running chunk """
|
||||
if not self.isAlreadySubmittedOrFinished() or len(self._chunks) == 0:
|
||||
return ""
|
||||
dateTime = [chunk._status.startDateTime for chunk in self._chunks if chunk._status.startDateTime != ""]
|
||||
return min(dateTime) if len(dateTime) != 0 else ""
|
||||
@Slot(result=bool)
|
||||
def isRunning(self):
|
||||
""" Return True if at least one chunk of this Node is running, False otherwise. """
|
||||
return any(chunk.isRunning() for chunk in self._chunks)
|
||||
|
||||
@Slot(result=bool)
|
||||
def isFinishedOrRunning(self):
|
||||
|
|
|
@ -27,7 +27,7 @@ Panel {
|
|||
|
||||
onNodeChanged: {
|
||||
nodeStartDateTime = ""
|
||||
if (node !== null && node.isSubmittedOrRunning()) {
|
||||
if (node !== null && node.isRunning()) {
|
||||
timer.start()
|
||||
}
|
||||
else if (node !== null && (node.isFinishedOrRunning() || node.globalStatus=="ERROR")) {
|
||||
|
@ -46,23 +46,25 @@ Panel {
|
|||
interval: 2500
|
||||
triggeredOnStart: true
|
||||
repeat: true
|
||||
running: node !== null && node.isSubmittedOrRunning()
|
||||
running: node !== null && node.isRunning()
|
||||
onTriggered: {
|
||||
if (nodeStartDateTime === "") {
|
||||
nodeStartDateTime = new Date(node.getFirstChunkRunning()).getTime()
|
||||
}
|
||||
nodeStartDateTime = new Date(node.getStartDateTime()).getTime()
|
||||
}
|
||||
var now = new Date().getTime()
|
||||
parent.text=Format.getTimeStr((now-nodeStartDateTime)/1000)
|
||||
var runningTime=Format.getTimeStr((now-nodeStartDateTime)/1000)
|
||||
|
||||
var chunkCompletion=0
|
||||
if (node.chunks.count>1) {
|
||||
var chunksCompleted = 0
|
||||
var chunkCompletion = ""
|
||||
if (node.chunks.count>0) {
|
||||
for (var i = 0; i < node.chunks.count; i++) {
|
||||
if (node.chunks.at(i).statusName == "SUCCESS") {
|
||||
chunkCompletion++
|
||||
chunksCompleted++
|
||||
}
|
||||
}
|
||||
parent.text+= " | "+ chunkCompletion + "/" + node.chunks.count + " chunks"
|
||||
chunkCompletion = " | "+ chunksCompleted + "/" + node.chunks.count + " chunk" + (node.chunks.count == 1 ? "" : "s")
|
||||
}
|
||||
parent.text = runningTime + chunkCompletion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue