本文整理汇总了Python中buildbot.status.slave.SlaveStatus.setVersion方法的典型用法代码示例。如果您正苦于以下问题:Python SlaveStatus.setVersion方法的具体用法?Python SlaveStatus.setVersion怎么用?Python SlaveStatus.setVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildbot.status.slave.SlaveStatus
的用法示例。
在下文中一共展示了SlaveStatus.setVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AbstractBuildSlave
# 需要导入模块: from buildbot.status.slave import SlaveStatus [as 别名]
# 或者: from buildbot.status.slave.SlaveStatus import setVersion [as 别名]
#.........这里部分代码省略.........
to look at it.
"""
log.msg("acquireLocks(slave %s, locks %s)" % (self, self.locks))
if not self.locksAvailable():
log.msg("slave %s can't lock, giving up" % (self, ))
return False
# all locks are available, claim them all
for lock, access in self.locks:
lock.claim(self, access)
return True
def releaseLocks(self):
"""
I am called to release any locks after a build has finished
"""
log.msg("releaseLocks(%s): %s" % (self, self.locks))
for lock, access in self.locks:
lock.release(self, access)
def _lockReleased(self):
"""One of the locks for this slave was released; try scheduling
builds."""
if not self.botmaster:
return # oh well..
self.botmaster.maybeStartBuildsForSlave(self.slavename)
def _applySlaveInfo(self, info):
if not info:
return
self.slave_status.setAdmin(info.get("admin"))
self.slave_status.setHost(info.get("host"))
self.slave_status.setAccessURI(info.get("access_uri", None))
self.slave_status.setVersion(info.get("version", "(unknown)"))
@defer.inlineCallbacks
def _getSlaveInfo(self):
buildslave = yield self.master.data.get(
('buildslaves', self.buildslaveid))
self._applySlaveInfo(buildslave['slaveinfo'])
def setServiceParent(self, parent):
# botmaster needs to set before setServiceParent which calls startService
self.manager = parent
self.master = parent.master
self.botmaster = parent.master.botmaster
return service.AsyncMultiService.setServiceParent(self, parent)
@defer.inlineCallbacks
def startService(self):
self.updateLocks()
self.startMissingTimer()
self.buildslaveid = yield self.master.data.updates.findBuildslaveId(
self.slavename)
yield self._getSlaveInfo()
yield service.AsyncMultiService.startService(self)
@defer.inlineCallbacks
def reconfigServiceWithBuildbotConfig(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)
示例2: AbstractBuildSlave
# 需要导入模块: from buildbot.status.slave import SlaveStatus [as 别名]
# 或者: from buildbot.status.slave.SlaveStatus import setVersion [as 别名]
#.........这里部分代码省略.........
d.addCallback(_get_info)
self.startKeepaliveTimer()
def _get_version(res):
d = bot.callRemote("getVersion")
def _got_version(version):
state["version"] = version
def _version_unavailable(why):
why.trap(pb.NoSuchMethod)
# probably an old slave
state["version"] = '(unknown)'
d.addCallbacks(_got_version, _version_unavailable)
return d
d.addCallback(_get_version)
def _get_commands(res):
d1 = bot.callRemote("getCommands")
def _got_commands(commands):
state["slave_commands"] = commands
def _commands_unavailable(why):
# probably an old slave
log.msg("BuildSlave._commands_unavailable")
if why.check(AttributeError):
return
log.err(why)
d1.addCallbacks(_got_commands, _commands_unavailable)
return d1
d.addCallback(_get_commands)
def _accept_slave(res):
self.slave_status.setAdmin(state.get("admin"))
self.slave_status.setHost(state.get("host"))
self.slave_status.setAccessURI(state.get("access_uri"))
self.slave_status.setVersion(state.get("version"))
self.slave_status.setConnected(True)
self.slave_commands = state.get("slave_commands")
self.slave_environ = state.get("slave_environ")
self.slave_basedir = state.get("slave_basedir")
self.slave_system = state.get("slave_system")
self.slave = bot
if self.slave_system == "win32":
self.path_module = namedModule("win32path")
else:
# most eveything accepts / as separator, so posix should be a
# reasonable fallback
self.path_module = namedModule("posixpath")
log.msg("bot attached")
self.messageReceivedFromSlave()
self.stopMissingTimer()
self.botmaster.master.status.slaveConnected(self.slavename)
return self.updateSlave()
d.addCallback(_accept_slave)
d.addCallback(lambda _:
self.botmaster.maybeStartBuildsForSlave(self.slavename))
# Finally, the slave gets a reference to this BuildSlave. They
# receive this later, after we've started using them.
d.addCallback(lambda _: self)
return d
def messageReceivedFromSlave(self):
now = time.time()
self.lastMessageReceived = now
self.slave_status.setLastMessageReceived(now)