Commit a6a20f55 authored by eric pellegrini's avatar eric pellegrini
Browse files

The number of steps is not compulsory for status derived objects

parent 9eb349e2
...@@ -4,8 +4,6 @@ import datetime ...@@ -4,8 +4,6 @@ import datetime
import numpy import numpy
from MDANSE.Externals.pubsub import pub as Publisher
def total_seconds(td): def total_seconds(td):
return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10.0**6 return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10.0**6
...@@ -127,9 +125,6 @@ class Status(object): ...@@ -127,9 +125,6 @@ class Status(object):
def update(self,force=False): def update(self,force=False):
if self._nSteps is None:
return
if self._updateStep == 0: if self._updateStep == 0:
return return
...@@ -143,10 +138,11 @@ class Status(object): ...@@ -143,10 +138,11 @@ class Status(object):
self._lastRefresh = lastUpdate self._lastRefresh = lastUpdate
self._elapsedTime = '%02dd:%02dh:%02dm:%02ds' % convert_duration(total_seconds(datetime.datetime.today() - self._startTime)) if self._nSteps is not None:
duration = [total_seconds(self._deltas[i+1]-self._deltas[i]) for i in range(self._currentStep)] self._elapsedTime = '%02dd:%02dh:%02dm:%02ds' % convert_duration(total_seconds(datetime.datetime.today() - self._startTime))
duration = numpy.median(duration)*(self._nSteps-self._currentStep) duration = [total_seconds(self._deltas[i+1]-self._deltas[i]) for i in range(self._currentStep)]
duration = datetime.timedelta(seconds=round(duration)) duration = numpy.median(duration)*(self._nSteps-self._currentStep)
duration = convert_duration(total_seconds(duration)) duration = datetime.timedelta(seconds=round(duration))
self._eta = '%02dd:%02dh:%02dm:%02ds' % duration duration = convert_duration(total_seconds(duration))
self._eta = '%02dd:%02dh:%02dm:%02ds' % duration
self.update_status() self.update_status()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment