launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00899
[Merge] lp:~lifeless/launchpad/oops into lp:launchpad/devel
Robert Collins has proposed merging lp:~lifeless/launchpad/oops into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#627940 of the blocking calls made only database statements are recorded in OOPS
https://bugs.launchpad.net/bugs/627940
#630612 Complete b0rkage of oops timing info
https://bugs.launchpad.net/bugs/630612
#632022 oops reports show negative total time
https://bugs.launchpad.net/bugs/632022
The use of a large sentinel confuses oops-tools, instead use the time since the action started to report on incomplete actions.
--
https://code.launchpad.net/~lifeless/launchpad/oops/+merge/34709
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lifeless/launchpad/oops into lp:launchpad/devel.
=== modified file 'lib/lp/services/timeline/tests/test_timedaction.py'
--- lib/lp/services/timeline/tests/test_timedaction.py 2010-09-05 05:07:57 +0000
+++ lib/lp/services/timeline/tests/test_timedaction.py 2010-09-06 22:41:10 +0000
@@ -55,9 +55,10 @@
action = TimedAction("foo", "bar", timeline)
# Set variable for deterministic results
action.start = timeline.baseline + datetime.timedelta(0, 0, 0, 2)
+ action._interval_to_now = lambda: datetime.timedelta(0, 0, 0, 3)
log_tuple = action.logTuple()
self.assertEqual(4, len(log_tuple), "!= 4 elements %s" % (log_tuple,))
self.assertAlmostEqual(2, log_tuple[0])
- self.assertAlmostEqual(1000001, log_tuple[1])
+ self.assertAlmostEqual(5, log_tuple[1])
self.assertEqual("foo", log_tuple[2])
self.assertEqual("bar", log_tuple[3])
=== modified file 'lib/lp/services/timeline/timedaction.py'
--- lib/lp/services/timeline/timedaction.py 2010-09-05 05:07:57 +0000
+++ lib/lp/services/timeline/timedaction.py 2010-09-06 22:41:10 +0000
@@ -47,14 +47,14 @@
"""Return a 4-tuple suitable for errorlog's use."""
offset = self._td_to_ms(self.start - self.timeline.baseline)
if self.duration is None:
- # This action wasn't finished: give it a duration that will stand
- # out. This is pretty normal when action ends are recorded by
- # callbacks rather than stack-like structures. E.g. storm
- # tracers in launchpad:
+ # This action wasn't finished: pretend it has finished now
+ # (even though it hasn't). This is pretty normal when action ends
+ # are recorded by callbacks rather than stack-like structures. E.g.
+ # storm tracers in launchpad:
# log-trace START : starts action
# timeout-trace START : raises
# log-trace FINISH is never called.
- length = 999999
+ length = self._td_to_ms(self._interval_to_now())
else:
length = self._td_to_ms(self.duration)
return (offset, offset + length, self.category, self.detail)
@@ -66,4 +66,7 @@
def finish(self):
"""Mark the TimedAction as finished."""
- self.duration = datetime.datetime.now(UTC) - self.start
+ self.duration = self._interval_to_now()
+
+ def _interval_to_now(self):
+ return datetime.datetime.now(UTC) - self.start
Follow ups