本文整理汇总了Python中buildbot.status.slave.SlaveStatus.removeGracefulWatcher方法的典型用法代码示例。如果您正苦于以下问题:Python SlaveStatus.removeGracefulWatcher方法的具体用法?Python SlaveStatus.removeGracefulWatcher怎么用?Python SlaveStatus.removeGracefulWatcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildbot.status.slave.SlaveStatus
的用法示例。
在下文中一共展示了SlaveStatus.removeGracefulWatcher方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AbstractBuildSlave
# 需要导入模块: from buildbot.status.slave import SlaveStatus [as 别名]
# 或者: from buildbot.status.slave.SlaveStatus import removeGracefulWatcher [as 别名]
#.........这里部分代码省略.........
'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)
yield self.updateSlave()
yield self.botmaster.maybeStartBuildsForSlave(self.slavename)
def messageReceivedFromSlave(self):
now = time.time()
self.lastMessageReceived = now
self.slave_status.setLastMessageReceived(now)
@defer.inlineCallbacks
def detached(self):
metrics.MetricCountEvent.log("AbstractBuildSlave.attached_slaves", -1)
self.conn = None
self._old_builder_list = []
self.slave_status.removeGracefulWatcher(self._gracefulChanged)
self.slave_status.removePauseWatcher(self._pauseChanged)
self.slave_status.setConnected(False)
log.msg("BuildSlave.detached(%s)" % self.slavename)
self.master.status.slaveDisconnected(self.slavename)
self.releaseLocks()
yield self.master.data.updates.buildslaveDisconnected(
buildslaveid=self.buildslaveid,
masterid=self.master.masterid,
)
def disconnect(self):
"""Forcibly disconnect the slave.
This severs the TCP connection and returns a Deferred that will fire
(with None) when the connection is probably gone.
If the slave is still alive, they will probably try to reconnect
again in a moment.
This is called in two circumstances. The first is when a slave is
removed from the config file. In this case, when they try to
reconnect, they will be rejected as an unknown slave. The second is
when we wind up with two connections for the same slave, in which
case we disconnect the older connection.
"""
if self.conn is None:
return defer.succeed(None)
log.msg("disconnecting old slave %s now" % self.slavename)
# When this Deferred fires, we'll be ready to accept the new slave
return self._disconnect(self.conn)
示例2: AbstractBuildSlave
# 需要导入模块: from buildbot.status.slave import SlaveStatus [as 别名]
# 或者: from buildbot.status.slave.SlaveStatus import removeGracefulWatcher [as 别名]
#.........这里部分代码省略.........
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):
metrics.MetricCountEvent.log("AbstractBuildSlave.attached_slaves", -1)
self.slave = None
self._old_builder_list = []
self.slave_status.removeGracefulWatcher(self._gracefulChanged)
self.slave_status.setConnected(False)
log.msg("BuildSlave.detached(%s)" % self.slavename)
self.botmaster.master.status.slaveDisconnected(self.slavename)
self.stopKeepaliveTimer()
# notify watchers, but do so in the next reactor iteration so that
# any further detached() action by subclasses happens first
def notif():
subs = self.detached_subs
self.detached_subs = None
subs.deliver()
reactor.callLater(0, notif)
def subscribeToDetach(self, callback):
"""
Request that C{callable} be invoked with no arguments when the
L{detached} method is invoked.
@returns: L{Subscription}
"""
assert self.detached_subs, "detached_subs is only set if attached"
return self.detached_subs.subscribe(callback)
def disconnect(self):
"""Forcibly disconnect the slave.
This severs the TCP connection and returns a Deferred that will fire
(with None) when the connection is probably gone.
If the slave is still alive, they will probably try to reconnect
again in a moment.