[Qa-jenkins-scm] [jenkins.debian.net] 01/02: reproducible: convert duration to human readable information

Holger Levsen holger at moszumanska.debian.org
Fri Sep 11 13:50:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 5dfbba01b1150dd7e1ebd72610943cad4a63c7cf
Author: Holger Levsen <holger at layer-acht.org>
Date:   Fri Sep 11 15:39:34 2015 +0200

    reproducible: convert duration to human readable information
---
 bin/reproducible_html_live_status.py | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/bin/reproducible_html_live_status.py b/bin/reproducible_html_live_status.py
index 426ff81..96d6eb2 100755
--- a/bin/reproducible_html_live_status.py
+++ b/bin/reproducible_html_live_status.py
@@ -11,6 +11,22 @@
 from reproducible_common import *
 from reproducible_html_indexes import build_leading_text_section
 
+def convert_into_hms_string(duration):
+    if not duration:
+        duration = "None"
+    else:
+        hours = int(duration/3600)
+        minutes = int((duration-(hours*3600))/60)
+        seconds = int(duration-(hours*3600)-(minutes*60))
+        duration = ''
+        if hours > 0:
+            duration = str(hours)+'h ' + str(minutes)+'m ' + str(seconds) + 's'
+        elif minutes > 0:
+            duration = str(minutes)+'m ' + str(seconds) + 's'
+        else:
+            duration = str(seconds+"s")
+    return duration
+
 def generate_schedule(arch):
     """ the schedule pages are very different than others index pages """
     log.info('Building the schedule index page for ' + arch + '...')
@@ -63,11 +79,12 @@ def generate_live_status_table(arch):
         suite = row[1]
         arch = row[2]
         pkg = row[3]
+        duration = convert_into_hms_string(row[7])
         html += tab + '<tr><td> </td><td>' + str(row[0]) + '</td>'
         html += '<td>' + suite + '</td><td>' + arch + '</td>'
         html += '<td><code>' + link_package(pkg, suite, arch) + '</code></td>'
         html += '<td>' + str(row[4]) + '</td><td>' + str(row[5]) + '</td>'
-        html += '<td>' + str(row[6]) + '</td><td>' + str(row[7]) + '</td> '
+        html += '<td>' + str(row[6]) + '</td><td>' + duration + '</td> '
         html += '<td><a href="https://jenkins.debian.net/job/reproducible_builder_' + str(row[8]) + '/console">' + str(row[8]) + '</a></td>'
         html += '</tr>\n'
     html += '</table></p>\n'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list