From: Kamoltat (Junior) Sirivadhna Date: Fri, 5 Jul 2019 20:32:50 +0000 (-0400) Subject: mgr/progress: added the time an event has been in progress X-Git-Tag: v15.1.0~2193^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0e0ca9d95f18349df4f85ae7b389cb46d9902984;p=ceph.git mgr/progress: added the time an event has been in progress In ceph -s and out/mgr.x.log now can see how long event has been in progress for when osd is marked in and out. Signed-off-by: Kamoltat (Junior) Sirivadhna --- diff --git a/src/pybind/mgr/progress/module.py b/src/pybind/mgr/progress/module.py index 46ab9e7d0391..07bffec2d321 100644 --- a/src/pybind/mgr/progress/module.py +++ b/src/pybind/mgr/progress/module.py @@ -215,13 +215,25 @@ class PgRecoveryEvent(Event): # as half done. ratio = 0.5 complete_accumulate += ratio + + # Update duration of event in seconds/minutes/hours + duration = (datetime.datetime.utcnow() - self.started_at) + duration_sec = duration.seconds + duration_min = duration_sec //60 + duration_hr = duration_min // 60 self._pgs = list(set(self._pgs) ^ complete) completed_pgs = self._original_pg_count - len(self._pgs) self._progress = (completed_pgs + complete_accumulate)\ / self._original_pg_count - self._refresh() + # Because the spacing of 'in' and 'out' characters are different + if self._message[31] == "i": + self._message = self._message[:34] + "(since {0}h {1}m {2}s)".format(duration_hr, duration_min, duration_sec) + else: + self._message = self._message[:34] + " (since {0}h {1}m {2}s)".format(duration_hr, duration_min, duration_sec) + self._refresh() + log.info("Updated progress to {0} ({1})".format( self._progress, self._message ))