diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2021-04-14 13:13:14 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2021-04-14 13:13:14 +0000 |
commit | fdaa468a094581e79e97baaba9008205cecaebdb (patch) | |
tree | 06397a9167581e8905a164f465d932dbd6986612 | |
parent | 542f964d13901c80d06a3dbeb8da1785f59924f0 (diff) | |
download | linaro-scripts-master.tar.gz |
Rename "Time" column to "Duration", and add "T Since" column for
time since completion of last build.
Change-Id: Ib530151c14798748a292879f515e93e79fe1bd66
-rwxr-xr-x | monitor/bot-status.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/monitor/bot-status.py b/monitor/bot-status.py index e27a7ee..a603c02 100755 --- a/monitor/bot-status.py +++ b/monitor/bot-status.py @@ -96,12 +96,14 @@ def get_bot_status(session, bot, base_url, builder_url, build_url): reversed_builds = iter(sorted(builds['builds'], key=lambda b: -b["number"])) for build in reversed_builds: if build['complete']: - delta = int(build['complete_at']) - int(build['started_at']) + time_since = (int(datetime.now().timestamp()) - int(build['complete_at'])) + duration = int(build['complete_at']) - int(build['started_at']) status = { 'builderid': build['builderid'], 'number': build['number'], 'state': build['state_string'], - 'time': timedelta(seconds=delta), + 'time_since': timedelta(seconds=time_since), + 'duration': timedelta(seconds=duration), 'fail': build['state_string'] != 'build successful', } if status['fail']: @@ -159,8 +161,9 @@ def write_bot_status(config, output_file, bots_status): for builder in server['builders']: temp.write("<tr><td colspan=5> </td><tr>\n") temp.write("<tr><th colspan=5>{}</td><tr>\n".format(builder['name'])) - temp.write("<tr><th>Buildbot</th><th>Status</th><th>Time</th>" - "<th>Build #</th><th>Commits</th><th>Failing steps</th></tr>\n") + temp.write("<tr><th>Buildbot</th><th>Status</th><th>T Since</th>" + "<th>Duration</th><th>Build #</th><th>Commits</th>" + "<th>Failing steps</th></tr>\n") for bot in builder['bots']: temp.write("<tr>\n") status = bots_status[(base_url, bot['name'])] @@ -171,8 +174,12 @@ def write_bot_status(config, output_file, bots_status): .format('red' if status['fail'] else 'green', 'FAIL' if status['fail'] else 'PASS')) empty_cell=" <td> </td>\n" - if 'time' in status: - temp.write(" <td>{}</td>\n".format(status['time'])) + if 'time_since' in status: + temp.write(" <td>{}</td>\n".format(status['time_since'])) + else: + temp.write(empty_cell) + if 'duration' in status: + temp.write(" <td>{}</td>\n".format(status['duration'])) else: temp.write(empty_cell) if 'number' in status: |