From 5aee03212d5e09b884a4c9864e5ab0fc4a6bb4ff Mon Sep 17 00:00:00 2001 From: Stephen Diehl Date: Fri, 6 Apr 2012 12:39:27 -0400 Subject: [PATCH] Replayable error log. --- zipline/monitor.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zipline/monitor.py b/zipline/monitor.py index bf50505e..f6b55037 100644 --- a/zipline/monitor.py +++ b/zipline/monitor.py @@ -169,6 +169,8 @@ class Controller(object): self.pub_socket = pub_socket self.route_socket = route_socket + self.error_replay = {} + if logging: self.logging = logging else: @@ -242,6 +244,13 @@ class Controller(object): #self.logging.info("[Controller] Tracking : %s" % ([c for c in self.tracked],)) pass + def replay_errors(self): + """ + Replay the errors in the order they were reported to the + controller. + """ + return [ a for a in sorted(self.replay_errors.keys())] + # ------------- # Publications # ------------- @@ -377,6 +386,7 @@ class Controller(object): self.logging.info('[Controller] Component "%s" done.' % component) def exception(self, component, failure): + self.error_replay[time.time()] = failure self.logging.error('Component "%s" in exception state' % component) # -----------------