[perf-web] Allow setting a time adjustment for a machine
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perf-web] Allow setting a time adjustment for a machine
- Date: Fri, 25 Jul 2014 13:45:18 +0000 (UTC)
commit 5b945aba2c1ac6a72c701fccd181f24acd1c0814
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Fri Jul 25 15:21:31 2014 +0200
Allow setting a time adjustment for a machine
The clock on the one current controller is off by 8 hours for some
reason; since I can't currently get there to investigate, add a config
key to allow adjusting incoming pull times by a fixed number of seconds.
config/machines/tartini.conf | 2 ++
metrics/config.py | 6 ++++++
metrics/views.py | 1 +
3 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/config/machines/tartini.conf b/config/machines/tartini.conf
index fd6334a..c61ce25 100644
--- a/config/machines/tartini.conf
+++ b/config/machines/tartini.conf
@@ -5,6 +5,8 @@ summary=i5-2500K, 16GB memory
cpu=Intel Core i5-2500K CPU @ 3.30GHz
graphics=Intel HD Graphics 3000
memory=16GiB
+# Temporary workaround until why the time isn't coming from NTP can be investigated
+time_adjust_sec=-28800
[partition tartini/ext4-ssd]
filesystem=ext4
diff --git a/metrics/config.py b/metrics/config.py
index 9575dfe..09fd638 100644
--- a/metrics/config.py
+++ b/metrics/config.py
@@ -113,6 +113,12 @@ class Machine(ConfigObject):
self.cpu = parser.get(section, 'cpu')
self.graphics = parser.get(section, 'graphics')
self.memory = parser.get(section, 'memory')
+ # Time to adjust pull_times with - this is a workaround for a temporarily
+ # inacessible control server that is not tracking time properly
+ try:
+ self.time_adjust_sec = int(parser.get(section, 'time_adjust_sec'))
+ except ConfigParser.NoOptionError, e:
+ self.time_adjust_sec = 0
class Metric(ConfigObject):
def _load(self, parser, section):
diff --git a/metrics/views.py b/metrics/views.py
index 5140714..57f7d4b 100644
--- a/metrics/views.py
+++ b/metrics/views.py
@@ -331,6 +331,7 @@ def process_report(data, machine_name):
pull_time_str = child_string(data, 'pullTime')
try:
pull_time = datetime.strptime(pull_time_str, '%Y-%m-%d %H:%M:%S').replace(tzinfo=timezone.utc)
+ pull_time = pull_time + timedelta(seconds=partition.machine.time_adjust_sec)
except ValueError:
raise ValidationError("Can't parse property 'pullTime'")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]