本文整理汇总了Python中WMComponent.TaskArchiver.TaskArchiverPoller.TaskArchiverPoller.killSubscriptions方法的典型用法代码示例。如果您正苦于以下问题:Python TaskArchiverPoller.killSubscriptions方法的具体用法?Python TaskArchiverPoller.killSubscriptions怎么用?Python TaskArchiverPoller.killSubscriptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMComponent.TaskArchiver.TaskArchiverPoller.TaskArchiverPoller
的用法示例。
在下文中一共展示了TaskArchiverPoller.killSubscriptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: atestTaskArchiverPollerAlertsSending_killSubscriptions
# 需要导入模块: from WMComponent.TaskArchiver.TaskArchiverPoller import TaskArchiverPoller [as 别名]
# 或者: from WMComponent.TaskArchiver.TaskArchiverPoller.TaskArchiverPoller import killSubscriptions [as 别名]
def atestTaskArchiverPollerAlertsSending_killSubscriptions(self):
"""
Cause exception (alert-worthy situation) in
the TaskArchiverPoller killSubscriptions method.
(only 1 situation out of two tested).
"""
return
myThread = threading.currentThread()
config = self.getConfig()
testTaskArchiver = TaskArchiverPoller(config = config)
# shall later be called directly from utils module
handler, self.alertsReceiver = \
utils.setUpReceiver(config.Alert.address, config.Alert.controlAddr)
# will fail on calling .load() - regardless, the same except block
numAlerts = 3
doneList = [{'id': x} for x in range(numAlerts)]
# final re-raise is currently commented, so don't expect Exception here
testTaskArchiver.killSubscriptions(doneList)
# wait for the generated alert to arrive
while len(handler.queue) < numAlerts:
time.sleep(0.3)
print "%s waiting for alert to arrive ..." % inspect.stack()[0][3]
self.alertsReceiver.shutdown()
self.alertsReceiver = None
# now check if the alert was properly sent
self.assertEqual(len(handler.queue), numAlerts)
alert = handler.queue[0]
self.assertEqual(alert["Source"], "TaskArchiverPoller")
return