aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_step_timer.py
diff options
context:
space:
mode:
authorAlex Shatov <alexs@att.com>2018-05-10 09:23:16 -0400
committerAlex Shatov <alexs@att.com>2018-05-10 09:23:16 -0400
commitf2d7bef13705812c1bf147c2fb65162fbf385c6b (patch)
treee6efb8e25287576a48952942aacdb3cf84a825ff /tests/test_step_timer.py
parent50bed534083c96cbf1f8fa4e220cb2b00dff9621 (diff)
2.4.3 policy-handler - try-catch top Exceptions
- added try-except for top level Exception into all threads of policy-handler to avoid losing the thread and tracking the unexpected crashes - rediscover the deployment-handler if not found before and after each catchup - refactored audit - separated metrics from audit - added more stats and runtime info to healthcheck = gc counts and garbage info if any detected = memory usage - to detect the potential memory leaks = request_id to all stats = stats of active requests - avoid reallocating the whole Queue of policy-updates after catchup = clear of the internal queue under proper lock Change-Id: I3fabcaac70419a68bd070ff7d591a75942f37663 Signed-off-by: Alex Shatov <alexs@att.com> Issue-ID: DCAEGEN2-483
Diffstat (limited to 'tests/test_step_timer.py')
-rw-r--r--tests/test_step_timer.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_step_timer.py b/tests/test_step_timer.py
index a116f8c..631a44f 100644
--- a/tests/test_step_timer.py
+++ b/tests/test_step_timer.py
@@ -47,7 +47,7 @@ class MockTimer(object):
self.step_timer = None
self.status = None
self.run_counter = 0
- self.status_ts = datetime.now()
+ self.status_ts = datetime.utcnow()
self.exe_ts = None
self.exe_interval = None
self.set_status(MockTimer.INIT)
@@ -62,7 +62,7 @@ class MockTimer(object):
def on_time(self, *args, **kwargs):
"""timer event"""
- self.exe_ts = datetime.now()
+ self.exe_ts = datetime.utcnow()
self.exe_interval = (self.exe_ts - self.status_ts).total_seconds()
MockTimer.logger.info("run on_time[%s] (%s, %s) in %s for %s",
self.run_counter, json.dumps(args), json.dumps(kwargs),
@@ -119,9 +119,9 @@ class MockTimer(object):
self.run_counter += 1
self.status = status
- now = datetime.now()
- time_step = (now - self.status_ts).total_seconds()
- self.status_ts = now
+ utcnow = datetime.utcnow()
+ time_step = (utcnow - self.status_ts).total_seconds()
+ self.status_ts = utcnow
MockTimer.logger.info("%s: %s", time_step, self.get_status())
def get_status(self):