本文整理汇总了Python中buildbot.status.slave.SlaveStatus.addInfoWatcher方法的典型用法代码示例。如果您正苦于以下问题:Python SlaveStatus.addInfoWatcher方法的具体用法?Python SlaveStatus.addInfoWatcher怎么用?Python SlaveStatus.addInfoWatcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildbot.status.slave.SlaveStatus
的用法示例。
在下文中一共展示了SlaveStatus.addInfoWatcher方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AbstractBuildSlave
# 需要导入模块: from buildbot.status.slave import SlaveStatus [as 别名]
# 或者: from buildbot.status.slave.SlaveStatus import addInfoWatcher [as 别名]
#.........这里部分代码省略.........
return # oh well..
self.botmaster.maybeStartBuildsForSlave(self.slavename)
def _saveSlaveInfoDict(self, slaveinfo):
return self.master.db.buildslaves.updateBuildslave(name=self.slavename, slaveinfo=slaveinfo)
def _getSlaveInfo(self):
d = self.master.db.buildslaves.getBuildslaveByName(self.slavename)
@d.addCallback
def applyInfo(buildslave):
if buildslave is None:
return
self.updateSlaveInfo(**buildslave["slaveinfo"])
return d
def updateSlaveInfo(self, **kwargs):
self.slave_status.updateInfo(**kwargs)
def getSlaveInfo(self, key, default=None):
return self.slave_status.getInfo(key, default)
def setServiceParent(self, parent):
# botmaster needs to set before setServiceParent which calls startService
self.botmaster = parent
self.master = parent.master
service.MultiService.setServiceParent(self, parent)
def startService(self):
self.updateLocks()
self.startMissingTimer()
self.slave_status.addInfoWatcher(self._saveSlaveInfoDict)
d = self._getSlaveInfo()
d.addCallback(lambda _: service.MultiService.startService(self))
return d
@defer.inlineCallbacks
def reconfigService(self, new_config):
# Given a new BuildSlave, configure this one identically. Because
# BuildSlave objects are remotely referenced, we can't replace them
# without disconnecting the slave, yet there's no reason to do that.
new = self.findNewSlaveInstance(new_config)
assert self.slavename == new.slavename
# do we need to re-register?
if (
not self.registration
or self.password != new.password
or new_config.protocols["pb"]["port"] != self.registered_port
):
if self.registration:
yield self.registration.unregister()
self.registration = None
self.password = new.password
self.registered_port = new_config.protocols["pb"]["port"]
self.registration = self.master.pbmanager.register(
self.registered_port, self.slavename, self.password, self.getPerspective
)
# adopt new instance's configuration parameters
self.max_builds = new.max_builds
self.access = new.access
self.notify_on_missing = new.notify_on_missing