1
|
|
# This file is part of Buildbot. Buildbot is free software: you can
|
2
|
|
# redistribute it and/or modify it under the terms of the GNU General Public
|
3
|
|
# License as published by the Free Software Foundation, version 2.
|
4
|
|
#
|
5
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
6
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
7
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
8
|
|
# details.
|
9
|
|
#
|
10
|
|
# You should have received a copy of the GNU General Public License along with
|
11
|
|
# this program; if not, write to the Free Software Foundation, Inc., 51
|
12
|
|
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
13
|
|
#
|
14
|
|
# Copyright Buildbot Team Members
|
15
|
|
|
16
|
4
|
from __future__ import absolute_import
|
17
|
4
|
from __future__ import print_function
|
18
|
|
|
19
|
4
|
from twisted.internet import defer
|
20
|
|
|
21
|
4
|
from buildbot_worker.base import WorkerBase
|
22
|
|
|
23
|
|
|
24
|
4
|
class LocalWorker(WorkerBase):
|
25
|
|
|
26
|
4
|
@defer.inlineCallbacks
|
27
|
4
|
def startService(self):
|
28
|
|
# importing here to avoid dependency on buildbot master package
|
29
|
|
# requires buildot version >= 0.9.0b5
|
30
|
4
|
from buildbot.worker.protocols.null import Connection
|
31
|
|
|
32
|
4
|
yield WorkerBase.startService(self)
|
33
|
4
|
self.workername = self.name
|
34
|
4
|
conn = Connection(self.parent, self)
|
35
|
|
# I don't have a master property, but my parent has.
|
36
|
4
|
master = self.parent.master
|
37
|
4
|
res = yield master.workers.newConnection(conn, self.name)
|
38
|
4
|
if res:
|
39
|
4
|
yield self.parent.attached(conn)
|
40
|
|
|
41
|
4
|
@defer.inlineCallbacks
|
42
|
4
|
def stopService(self):
|
43
|
4
|
yield self.parent.detached()
|
44
|
4
|
yield WorkerBase.stopService(self)
|