1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 from zope.interface import implements
17 from twisted.python import log
18 from twisted.internet import defer
19 from buildbot import interfaces
20 from buildbot.util.eventual import eventually
23 implements(interfaces.IBuildRequestStatus)
24
25 - def __init__(self, buildername, brid, status):
26 self.buildername = buildername
27 self.brid = brid
28 self.status = status
29 self.master = status.master
30
31 self._buildrequest = None
32 self._buildrequest_lock = defer.DeferredLock()
33
34 @defer.inlineCallbacks
36 """
37 Get the underlying BuildRequest object for this status. This is a slow
38 operation!
39
40 @returns: BuildRequest instance or None, via Deferred
41 """
42
43 from buildbot.process import buildrequest
44
45
46 if self._buildrequest:
47 defer.returnValue(self._buildrequest)
48 return
49
50 yield self._buildrequest_lock.acquire()
51
52 try:
53 if not self._buildrequest:
54 brd = yield self.master.db.buildrequests.getBuildRequest(
55 self.brid)
56
57 br = yield buildrequest.BuildRequest.fromBrdict(self.master,
58 brd)
59 self._buildrequest = br
60 except:
61 self._buildrequest_lock.release()
62 raise
63
64 self._buildrequest_lock.release()
65
66 defer.returnValue(self._buildrequest)
67
71
72
73 @defer.inlineCallbacks
75 br = yield self._getBuildRequest()
76 defer.returnValue(br.bsid)
77
78 @defer.inlineCallbacks
80 br = yield self._getBuildRequest()
81 defer.returnValue(br.source)
82
84 return self.buildername
85
86 @defer.inlineCallbacks
100
102 d = self.getBuilds()
103 def notify_old(oldbuilds):
104 for bs in oldbuilds:
105 eventually(observer, bs)
106 d.addCallback(notify_old)
107 d.addCallback(lambda _ :
108 self.status._buildrequest_subscribe(self.brid, observer))
109 d.addErrback(log.err, 'while notifying subscribers')
110
112 self.status._buildrequest_unsubscribe(self.brid, observer)
113
114 @defer.inlineCallbacks
116 br = yield self._getBuildRequest()
117 defer.returnValue(br.submittedAt)
118
120 result = {}
121
122 result['source'] = None
123 result['builderName'] = self.buildername
124 result['submittedAt'] = None
125
126
127 result['builds'] = []
128 return result
129
130 @defer.inlineCallbacks
143