Browse Source

Merge "builds: set missing start/end time for node errors"

tags/3.4.0
Zuul 6 months ago
parent
commit
ea3e777469
2 changed files with 6 additions and 0 deletions
  1. 4
    0
      zuul/driver/sql/sqlreporter.py
  2. 2
    0
      zuul/model.py

+ 4
- 0
zuul/driver/sql/sqlreporter.py View File

@@ -14,6 +14,7 @@
14 14
 
15 15
 import datetime
16 16
 import logging
17
+import time
17 18
 import voluptuous as v
18 19
 
19 20
 from zuul.reporter import BaseReporter
@@ -55,6 +56,9 @@ class SQLReporter(BaseReporter):
55 56
                     # stats about builds. It doesn't understand how to store
56 57
                     # information about the change.
57 58
                     continue
59
+                # Ensure end_time is defined
60
+                if not build.end_time:
61
+                    build.end_time = time.time()
58 62
 
59 63
                 (result, url) = item.formatJobResult(job)
60 64
                 start = end = None

+ 2
- 0
zuul/model.py View File

@@ -2258,6 +2258,8 @@ class QueueItem(object):
2258 2258
 
2259 2259
     def setNodeRequestFailure(self, job):
2260 2260
         fakebuild = Build(job, None)
2261
+        fakebuild.start_time = time.time()
2262
+        fakebuild.end_time = time.time()
2261 2263
         self.addBuild(fakebuild)
2262 2264
         fakebuild.result = 'NODE_FAILURE'
2263 2265
         self.setResult(fakebuild)

Loading…
Cancel
Save