当前位置: 首页>>代码示例>>Python>>正文


Python SlaveStatus.addInfoWatcher方法代码示例

本文整理汇总了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
开发者ID:Ratio2,项目名称:buildbot,代码行数:70,代码来源:base.py


注:本文中的buildbot.status.slave.SlaveStatus.addInfoWatcher方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。