本文整理汇总了Python中buildbot.status.slave.SlaveStatus.setConnected方法的典型用法代码示例。如果您正苦于以下问题:Python SlaveStatus.setConnected方法的具体用法?Python SlaveStatus.setConnected怎么用?Python SlaveStatus.setConnected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildbot.status.slave.SlaveStatus
的用法示例。
在下文中一共展示了SlaveStatus.setConnected方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AbstractBuildSlave
# 需要导入模块: from buildbot.status.slave import SlaveStatus [as 别名]
# 或者: from buildbot.status.slave.SlaveStatus import setConnected [as 别名]
#.........这里部分代码省略.........
def updateSlave(self):
"""Called to add or remove builders after the slave has connected.
@return: a Deferred that indicates when an attached slave has
accepted the new builders and/or released the old ones."""
if self.conn:
return self.sendBuilderList()
else:
return defer.succeed(None)
def updateSlaveStatus(self, buildStarted=None, buildFinished=None):
# TODO
pass
@defer.inlineCallbacks
def attached(self, conn):
"""This is called when the slave connects."""
metrics.MetricCountEvent.log("AbstractBuildSlave.attached_slaves", 1)
# now we go through a sequence of calls, gathering information, then
# tell the Botmaster that it can finally give this slave to all the
# Builders that care about it.
# Reset graceful shutdown status
self.slave_status.setGraceful(False)
# We want to know when the graceful shutdown flag changes
self.slave_status.addGracefulWatcher(self._gracefulChanged)
self.conn = conn
self._old_builder_list = None # clear builder list before proceed
self.slave_status.addPauseWatcher(self._pauseChanged)
self.slave_status.setConnected(True)
self._applySlaveInfo(conn.info)
self.slave_commands = conn.info.get("slave_commands", {})
self.slave_environ = conn.info.get("environ", {})
self.slave_basedir = conn.info.get("basedir", None)
self.slave_system = conn.info.get("system", None)
self.conn.notifyOnDisconnect(self.detached)
slaveinfo = {
'admin': conn.info.get('admin'),
'host': conn.info.get('host'),
'access_uri': conn.info.get('access_uri'),
'version': conn.info.get('version')
}
yield self.master.data.updates.buildslaveConnected(
buildslaveid=self.buildslaveid,
masterid=self.master.masterid,
slaveinfo=slaveinfo
)
if self.slave_system == "nt":
self.path_module = namedModule("ntpath")
else:
# most everything accepts / as separator, so posix should be a
# reasonable fallback
self.path_module = namedModule("posixpath")
log.msg("bot attached")
self.messageReceivedFromSlave()
self.stopMissingTimer()
self.master.status.slaveConnected(self.slavename)
示例2: AbstractBuildSlave
# 需要导入模块: from buildbot.status.slave import SlaveStatus [as 别名]
# 或者: from buildbot.status.slave.SlaveStatus import setConnected [as 别名]
#.........这里部分代码省略.........
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)
def detached(self, mind):