Skip to content
This repository
Browse code

For in-progress builds, estimate the duration

We do this by taking the current time of the Trac host for the
intermediate "completed" timestamp, which is OK as far as the
Trac host and the Hudson host clocks are synchronized.
  • Loading branch information...
commit c5228020a5db07b2a907bb9925c2c5da38ae0ea8 1 parent e17bc42
Christian Boos authored April 27, 2010

Showing 1 changed file with 10 additions and 5 deletions. Show diff stats Hide diff stats

  1. 15  HudsonTrac/HudsonTracPlugin.py
15  HudsonTrac/HudsonTracPlugin.py
@@ -186,18 +186,23 @@ def get_number(parent, child):
186 186
         for entry in info.documentElement.getElementsByTagName("build"):
187 187
             # ignore builds that are still running
188 188
             if get_string(entry, 'building') == 'true':
189  
-                if not self.display_building:
190  
-                    continue
191  
-                else:
  189
+                if self.display_building:
192 190
                     result = 'INPROGRESS'
  191
+                else:
  192
+                    continue
193 193
             else:
194 194
                 result = get_string(entry, 'result')
195 195
 
196 196
             # create timeline entry
197 197
             started = get_number(entry, 'timestamp')
198  
-            completed = started + get_number(entry, 'duration')
  198
+            if result == 'INPROGRESS':
  199
+                # we hope the clocks are close...
  200
+                completed = time.time()
  201
+            else:
  202
+                duration = get_number(entry, 'duration')
  203
+                completed = started + duration
  204
+                completed /= 1000
199 205
             started /= 1000
200  
-            completed /= 1000
201 206
             
202 207
             message, kind = {
203 208
                 'SUCCESS': ('Build finished successfully',

1 note on commit c522802

Christian Boos

maybe have an option to turn this off, in case clocks are really not the same?

Christian Boos

s/ignore/eventually ignore/

Christian Boos
Owner

note that these are just random comments to try out how #2035 works here...

Please sign in to comment.
Something went wrong with that request. Please try again.