From e9d99c87c5530b0f515972a85e9ba720b6949275 Mon Sep 17 00:00:00 2001 From: Nico Vermaas <vermaas@astron.nl> Date: Tue, 8 Feb 2022 17:44:49 +0100 Subject: [PATCH] bonus: added a '(late)' timestamp in the monitor when a timestamp arrives > 60 seconds late. --- atdb/taskdatabase/services/algorithms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/atdb/taskdatabase/services/algorithms.py b/atdb/taskdatabase/services/algorithms.py index 0e8bca9f..73c71a8d 100644 --- a/atdb/taskdatabase/services/algorithms.py +++ b/atdb/taskdatabase/services/algorithms.py @@ -266,7 +266,8 @@ def convert_monitor_to_html(request, monitor_data): d1 = datetime.utcnow().replace(tzinfo=None) d2 = record.timestamp.replace(tzinfo=None) delta = d1 - d2 - if delta.seconds > 60: + # if the heartbeat is 30 minutes late, show '(late)' in red + if delta.seconds > 1800: line += '<td class="error">' + str(record.timestamp.strftime(TIME_FORMAT)) + " - (late)</td>" else: line += '<td>' + str(record.timestamp) + "</td>" -- GitLab