aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2023-06-12 12:23:28 +0100
committerDavid Spickett <david.spickett@linaro.org>2023-06-12 12:25:51 +0100
commite44441bb1350d462486cc4056eed9afa468658ac (patch)
treec8e1d633ae8fb39df3302dbbe705b941f3ed0162
parent8dcb6ed59d31efc93fd8606858f50ae78f7c990b (diff)
llvmbot monitor: Print generated time only once, at top of page
Previously we printed this for all the sections but the time is the time we generated the HTML not the time we polled the API, so it didn't need to be per category. It's at the top so you can tell at a glance if there's an issue with the script that means it can't update the page. It's a bit awkward to place it because it needs to go in a table with content so that it aligns nicely. This leads to a "bug" where if you had nothing to print, you'd see no "Generated" line, but I am ok with that. If the status monitor was blank, I'd have bigger problems than what time it was made. Change-Id: Idd9257f75a4c4cbf1be66c3c758f464b47dd3e35
-rwxr-xr-xmonitor/bot-status.py42
1 files changed, 26 insertions, 16 deletions
diff --git a/monitor/bot-status.py b/monitor/bot-status.py
index 336f601..b6e0f22 100755
--- a/monitor/bot-status.py
+++ b/monitor/bot-status.py
@@ -131,7 +131,6 @@ def get_buildbot_bots_status(config):
def write_bot_status(config, output_file, bots_status):
temp = tempfile.NamedTemporaryFile(mode='w+', delete=False)
- today = "{}\n".format(datetime.today().ctime())
temp.write(dedent("""\
<!DOCTYPE html>
@@ -147,29 +146,40 @@ def write_bot_status(config, output_file, bots_status):
}
</style>"""))
+ column_titles = [
+ "Buildbot",
+ "Status",
+ "T Since",
+ "Duration",
+ "Build",
+ "Failing steps",
+ "Build In Progress",
+ ]
+ num_columns = len(column_titles)
+ column_titles_html = "<tr>{}</tr>\n".format(
+ "".join(["<th>{}</th>".format(t) for t in column_titles]))
+
+ # The first table should also say when this was generated.
+ # If we were to put this in its own header only table, it would
+ # not align with the rest because it has no content.
+ first = True
+
# Dump all servers / bots
for server in filter(not_ignored, config):
base_url = server['base_url']
builder_url = server['builder_url']
build_url = server['build_url']
- column_titles = [
- "Buildbot",
- "Status",
- "T Since",
- "Duration",
- "Build",
- "Failing steps",
- "Build In Progress",
- ]
- num_columns = len(column_titles)
- column_titles_html = "<tr>{}</tr>\n".format(
- "".join(["<th>{}</th>".format(t) for t in column_titles]))
-
temp.write("<table border=0 cellspacing=1 cellpadding=2>\n")
temp.write("<tr><td colspan={}>&nbsp;</td><tr>\n".format(num_columns))
- temp.write("<tr><th colspan={}>{} @ {}</td><tr>\n"
- .format(num_columns, server['name'], today))
+ if first:
+ temp.write("<tr><th colspan={}>Generated {}</td><tr>\n"
+ .format(num_columns, datetime.today().ctime()))
+ temp.write("<tr><td colspan={}>&nbsp;</td><tr>\n".format(num_columns))
+ first = False
+
+ temp.write("<tr><th colspan={}>{}</td><tr>\n"
+ .format(num_columns, server['name']))
for builder in server['builders']:
temp.write("<tr><td colspan={}>&nbsp;</td><tr>\n".format(num_columns))