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:
|
try:
|
||||||
self.node.nodeDesc.processChunk(self)
|
self.node.nodeDesc.processChunk(self)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
self._status.elapsedTime = time.time() - startTime
|
||||||
if self._status.status != Status.STOPPED:
|
if self._status.status != Status.STOPPED:
|
||||||
self._status.elapsedTime = time.time() - startTime
|
|
||||||
self.upgradeStatusTo(Status.ERROR)
|
self.upgradeStatusTo(Status.ERROR)
|
||||||
raise
|
raise
|
||||||
except (KeyboardInterrupt, SystemError, GeneratorExit) as e:
|
except (KeyboardInterrupt, SystemError, GeneratorExit) as e:
|
||||||
|
self._status.elapsedTime = time.time() - startTime
|
||||||
self.upgradeStatusTo(Status.STOPPED)
|
self.upgradeStatusTo(Status.STOPPED)
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
|
@ -806,6 +807,14 @@ class BaseNode(BaseObject):
|
||||||
shutil.rmtree(self.internalFolder)
|
shutil.rmtree(self.internalFolder)
|
||||||
self.updateStatusFromCache()
|
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):
|
def isAlreadySubmitted(self):
|
||||||
for chunk in self._chunks:
|
for chunk in self._chunks:
|
||||||
if chunk.isAlreadySubmitted():
|
if chunk.isAlreadySubmitted():
|
||||||
|
@ -828,13 +837,10 @@ class BaseNode(BaseObject):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@Slot(result=str)
|
@Slot(result=bool)
|
||||||
def getFirstChunkRunning(self):
|
def isRunning(self):
|
||||||
""" Return the date (str) of the first running chunk """
|
""" Return True if at least one chunk of this Node is running, False otherwise. """
|
||||||
if not self.isAlreadySubmittedOrFinished() or len(self._chunks) == 0:
|
return any(chunk.isRunning() for chunk in self._chunks)
|
||||||
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)
|
@Slot(result=bool)
|
||||||
def isFinishedOrRunning(self):
|
def isFinishedOrRunning(self):
|
||||||
|
|
|
@ -27,7 +27,7 @@ Panel {
|
||||||
|
|
||||||
onNodeChanged: {
|
onNodeChanged: {
|
||||||
nodeStartDateTime = ""
|
nodeStartDateTime = ""
|
||||||
if (node !== null && node.isSubmittedOrRunning()) {
|
if (node !== null && node.isRunning()) {
|
||||||
timer.start()
|
timer.start()
|
||||||
}
|
}
|
||||||
else if (node !== null && (node.isFinishedOrRunning() || node.globalStatus=="ERROR")) {
|
else if (node !== null && (node.isFinishedOrRunning() || node.globalStatus=="ERROR")) {
|
||||||
|
@ -46,23 +46,25 @@ Panel {
|
||||||
interval: 2500
|
interval: 2500
|
||||||
triggeredOnStart: true
|
triggeredOnStart: true
|
||||||
repeat: true
|
repeat: true
|
||||||
running: node !== null && node.isSubmittedOrRunning()
|
running: node !== null && node.isRunning()
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (nodeStartDateTime === "") {
|
if (nodeStartDateTime === "") {
|
||||||
nodeStartDateTime = new Date(node.getFirstChunkRunning()).getTime()
|
nodeStartDateTime = new Date(node.getStartDateTime()).getTime()
|
||||||
}
|
}
|
||||||
var now = new Date().getTime()
|
var now = new Date().getTime()
|
||||||
parent.text=Format.getTimeStr((now-nodeStartDateTime)/1000)
|
var runningTime=Format.getTimeStr((now-nodeStartDateTime)/1000)
|
||||||
|
|
||||||
var chunkCompletion=0
|
var chunksCompleted = 0
|
||||||
if (node.chunks.count>1) {
|
var chunkCompletion = ""
|
||||||
|
if (node.chunks.count>0) {
|
||||||
for (var i = 0; i < node.chunks.count; i++) {
|
for (var i = 0; i < node.chunks.count; i++) {
|
||||||
if (node.chunks.at(i).statusName == "SUCCESS") {
|
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