OLD | NEW |
1 # -*- test-case-name: buildbot.test.test_status -*- | 1 # -*- test-case-name: buildbot.test.test_status -*- |
2 | 2 |
3 from zope.interface import implements | 3 from zope.interface import implements |
4 from twisted.python import log | 4 from twisted.python import log |
5 from twisted.persisted import styles | 5 from twisted.persisted import styles |
6 from twisted.internet import reactor, defer, threads | 6 from twisted.internet import reactor, defer, threads |
7 from twisted.protocols import basic | 7 from twisted.protocols import basic |
8 from buildbot.process.properties import Properties | 8 from buildbot.process.properties import Properties |
9 | 9 |
10 import weakref | 10 import weakref |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 return self.results | 731 return self.results |
732 def getID(self): | 732 def getID(self): |
733 return self.id | 733 return self.id |
734 | 734 |
735 def getBuilderNames(self): | 735 def getBuilderNames(self): |
736 return self.builderNames | 736 return self.builderNames |
737 def getBuildRequests(self): | 737 def getBuildRequests(self): |
738 return self.buildRequests | 738 return self.buildRequests |
739 def isFinished(self): | 739 def isFinished(self): |
740 return self.finished | 740 return self.finished |
741 | 741 |
742 def waitUntilSuccess(self): | 742 def waitUntilSuccess(self): |
743 if self.finished or not self.stillHopeful: | 743 if self.finished or not self.stillHopeful: |
744 # the deferreds have already fired | 744 # the deferreds have already fired |
745 return defer.succeed(self) | 745 return defer.succeed(self) |
746 d = defer.Deferred() | 746 d = defer.Deferred() |
747 self.successWatchers.append(d) | 747 self.successWatchers.append(d) |
748 return d | 748 return d |
749 | 749 |
750 def waitUntilFinished(self): | 750 def waitUntilFinished(self): |
751 if self.finished: | 751 if self.finished: |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 self.statistics = {} | 1111 self.statistics = {} |
1112 | 1112 |
1113 def asDict(self): | 1113 def asDict(self): |
1114 result = {} | 1114 result = {} |
1115 # Constant | 1115 # Constant |
1116 result['name'] = self.getName() | 1116 result['name'] = self.getName() |
1117 | 1117 |
1118 # Transient | 1118 # Transient |
1119 result['text'] = self.getText() | 1119 result['text'] = self.getText() |
1120 result['results'] = self.getResults() | 1120 result['results'] = self.getResults() |
1121 result['is_started'] = self.isStarted() | 1121 result['isStarted'] = self.isStarted() |
1122 result['is_finished'] = self.isFinished() | 1122 result['isFinished'] = self.isFinished() |
1123 result['statistics'] = self.statistics | 1123 result['statistics'] = self.statistics |
1124 result['times'] = self.getTimes() | 1124 result['times'] = self.getTimes() |
1125 result['expectations'] = self.getExpectations() | 1125 result['expectations'] = self.getExpectations() |
1126 result['eta'] = self.getETA() | 1126 result['eta'] = self.getETA() |
1127 result['urls'] = self.getURLs() | 1127 result['urls'] = self.getURLs() |
1128 # TODO(maruel): Move that to a sub-url or just publish the log_url | 1128 # TODO(maruel): Move that to a sub-url or just publish the log_url |
1129 # instead. | 1129 # instead. |
1130 #result['logs'] = self.getLogs() | 1130 #result['logs'] = self.getLogs() |
1131 return result | 1131 return result |
1132 | 1132 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 os.unlink(filename) | 1535 os.unlink(filename) |
1536 os.rename(tmpfilename, filename) | 1536 os.rename(tmpfilename, filename) |
1537 except: | 1537 except: |
1538 log.msg("unable to save build %s-#%d" % (self.builder.name, | 1538 log.msg("unable to save build %s-#%d" % (self.builder.name, |
1539 self.number)) | 1539 self.number)) |
1540 log.err() | 1540 log.err() |
1541 | 1541 |
1542 def asDict(self): | 1542 def asDict(self): |
1543 result = {} | 1543 result = {} |
1544 # Constant | 1544 # Constant |
| 1545 result['builderName'] = self.builder.name |
1545 result['number'] = self.getNumber() | 1546 result['number'] = self.getNumber() |
1546 result['source_stamp'] = self.getSourceStamp().asDict() | 1547 result['sourceStamp'] = self.getSourceStamp().asDict() |
1547 result['reason'] = self.getReason() | 1548 result['reason'] = self.getReason() |
1548 result['requests'] = [r.asDict() for r in self.getRequests()] | 1549 result['requests'] = [r.asDict() for r in self.getRequests()] |
1549 result['blame'] = self.getResponsibleUsers() | 1550 result['blame'] = self.getResponsibleUsers() |
1550 result['changes'] = [c.asText() for c in self.getChanges()] | 1551 result['changes'] = [c.asText() for c in self.getChanges()] |
1551 | 1552 |
1552 # Transient | 1553 # Transient |
1553 result['properties'] = self.getProperties().asList() | 1554 result['properties'] = self.getProperties().asList() |
1554 result['times'] = self.getTimes() | 1555 result['times'] = self.getTimes() |
1555 result['text'] = self.getText() | 1556 result['text'] = self.getText() |
1556 result['results'] = self.getResults() | 1557 result['results'] = self.getResults() |
1557 result['slave'] = self.getSlavename() | 1558 result['slave'] = self.getSlavename() |
1558 # TODO(maruel): Add. | 1559 # TODO(maruel): Add. |
1559 #result['test_results'] = self.getTestResults() | 1560 #result['test_results'] = self.getTestResults() |
1560 # TODO(maruel): Include the url? It's too heavy otherwise. | 1561 # TODO(maruel): Include the url? It's too heavy otherwise. |
1561 #result['logs'] = self.getLogs() | 1562 #result['logs'] = self.getLogs() |
1562 result['eta'] = self.getETA() | 1563 result['eta'] = self.getETA() |
1563 result['steps'] = [bss.asDict() for bss in self.steps] | 1564 result['steps'] = [bss.asDict() for bss in self.steps] |
1564 if self.getCurrentStep(): | 1565 if self.getCurrentStep(): |
1565 result['current_step'] = self.getCurrentStep().asDict() | 1566 result['currentStep'] = self.getCurrentStep().asDict() |
1566 else: | 1567 else: |
1567 result['current_step'] = None | 1568 result['currentStep'] = None |
1568 return result | 1569 return result |
1569 | 1570 |
1570 | 1571 |
1571 | 1572 |
1572 class BuilderStatus(styles.Versioned): | 1573 class BuilderStatus(styles.Versioned): |
1573 """I handle status information for a single process.base.Builder object. | 1574 """I handle status information for a single process.base.Builder object. |
1574 That object sends status changes to me (frequently as Events), and I | 1575 That object sends status changes to me (frequently as Events), and I |
1575 provide them on demand to the various status recipients, like the HTML | 1576 provide them on demand to the various status recipients, like the HTML |
1576 waterfall display and the live status clients. It also sends build | 1577 waterfall display and the live status clients. It also sends build |
1577 summaries to me, which I log and provide to status clients who aren't | 1578 summaries to me, which I log and provide to status clients who aren't |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2153 result['slaves'] = self.slavenames | 2154 result['slaves'] = self.slavenames |
2154 #result['url'] = self.parent.getURLForThing(self) | 2155 #result['url'] = self.parent.getURLForThing(self) |
2155 # TODO(maruel): Add cache settings? Do we care? | 2156 # TODO(maruel): Add cache settings? Do we care? |
2156 | 2157 |
2157 # Transient | 2158 # Transient |
2158 # Collect build numbers. | 2159 # Collect build numbers. |
2159 # Important: Only grab the *cached* builds numbers to reduce I/O. | 2160 # Important: Only grab the *cached* builds numbers to reduce I/O. |
2160 current_builds = [b.getNumber() for b in self.currentBuilds] | 2161 current_builds = [b.getNumber() for b in self.currentBuilds] |
2161 cached_builds = list(set(self.buildCache.keys() + current_builds)) | 2162 cached_builds = list(set(self.buildCache.keys() + current_builds)) |
2162 cached_builds.sort() | 2163 cached_builds.sort() |
2163 result['cached_builds'] = cached_builds | 2164 result['cachedBuilds'] = cached_builds |
2164 result['current_builds'] = current_builds | 2165 result['currentBuilds'] = current_builds |
2165 result['state'] = self.getState()[0] | 2166 result['state'] = self.getState()[0] |
2166 # BuildRequestStatus doesn't have a number so display the SourceStamp. | 2167 # BuildRequestStatus doesn't have a number so display the SourceStamp. |
2167 result['pending_builds'] = [ | 2168 result['pendingBuilds'] = [ |
2168 b.getSourceStamp().asDict() for b in self.getPendingBuilds() | 2169 b.getSourceStamp().asDict() for b in self.getPendingBuilds() |
2169 ] | 2170 ] |
2170 return result | 2171 return result |
2171 | 2172 |
2172 | 2173 |
2173 class SlaveStatus: | 2174 class SlaveStatus: |
2174 implements(interfaces.ISlaveStatus) | 2175 implements(interfaces.ISlaveStatus) |
2175 | 2176 |
2176 admin = None | 2177 admin = None |
2177 host = None | 2178 host = None |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2534 result = {} | 2535 result = {} |
2535 # Constant | 2536 # Constant |
2536 result['projectName'] = self.getProjectName() | 2537 result['projectName'] = self.getProjectName() |
2537 result['projectURL'] = self.getProjectURL() | 2538 result['projectURL'] = self.getProjectURL() |
2538 result['buildbotURL'] = self.getBuildbotURL() | 2539 result['buildbotURL'] = self.getBuildbotURL() |
2539 # TODO: self.getSchedulers() | 2540 # TODO: self.getSchedulers() |
2540 # self.getChangeSources() | 2541 # self.getChangeSources() |
2541 return result | 2542 return result |
2542 | 2543 |
2543 # vim: set ts=4 sts=4 sw=4 et: | 2544 # vim: set ts=4 sts=4 sw=4 et: |
OLD | NEW |