mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-24 06:26:29 +02:00
[core] elapsedTime set only once at the end of the process to avoid repetition of code
This commit is contained in:
parent
606e8e2f03
commit
f3626a83c8
1 changed files with 5 additions and 4 deletions
|
@ -404,6 +404,7 @@ class NodeChunk(BaseObject):
|
||||||
global runningProcesses
|
global runningProcesses
|
||||||
runningProcesses[self.name] = self
|
runningProcesses[self.name] = self
|
||||||
self._status.initStartCompute()
|
self._status.initStartCompute()
|
||||||
|
exceptionStatus = None
|
||||||
startTime = time.time()
|
startTime = time.time()
|
||||||
self.upgradeStatusTo(Status.RUNNING)
|
self.upgradeStatusTo(Status.RUNNING)
|
||||||
self.statThread = stats.StatisticsThread(self)
|
self.statThread = stats.StatisticsThread(self)
|
||||||
|
@ -411,17 +412,17 @@ 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.upgradeStatusTo(Status.ERROR)
|
exceptionStatus = Status.ERROR
|
||||||
raise
|
raise
|
||||||
except (KeyboardInterrupt, SystemError, GeneratorExit) as e:
|
except (KeyboardInterrupt, SystemError, GeneratorExit) as e:
|
||||||
self._status.elapsedTime = time.time() - startTime
|
exceptionStatus = Status.STOPPED
|
||||||
self.upgradeStatusTo(Status.STOPPED)
|
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
self._status.initEndCompute()
|
self._status.initEndCompute()
|
||||||
self._status.elapsedTime = time.time() - startTime
|
self._status.elapsedTime = time.time() - startTime
|
||||||
|
if exceptionStatus is not None:
|
||||||
|
self.upgradeStatusTo(exceptionStatus)
|
||||||
logging.info(' - elapsed time: {}'.format(self._status.elapsedTimeStr))
|
logging.info(' - elapsed time: {}'.format(self._status.elapsedTimeStr))
|
||||||
# ask and wait for the stats thread to stop
|
# ask and wait for the stats thread to stop
|
||||||
self.statThread.stopRequest()
|
self.statThread.stopRequest()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue