本文整理汇总了Python中WMComponent.TaskArchiver.TaskArchiverPoller.TaskArchiverPoller.notifyWorkQueue方法的典型用法代码示例。如果您正苦于以下问题:Python TaskArchiverPoller.notifyWorkQueue方法的具体用法?Python TaskArchiverPoller.notifyWorkQueue怎么用?Python TaskArchiverPoller.notifyWorkQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMComponent.TaskArchiver.TaskArchiverPoller.TaskArchiverPoller
的用法示例。
在下文中一共展示了TaskArchiverPoller.notifyWorkQueue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: atestTaskArchiverPollerAlertsSending_notifyWorkQueue
# 需要导入模块: from WMComponent.TaskArchiver.TaskArchiverPoller import TaskArchiverPoller [as 别名]
# 或者: from WMComponent.TaskArchiver.TaskArchiverPoller.TaskArchiverPoller import notifyWorkQueue [as 别名]
def atestTaskArchiverPollerAlertsSending_notifyWorkQueue(self):
"""
Cause exception (alert-worthy situation) in
the TaskArchiverPoller notifyWorkQueue method.
"""
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)
# prepare input such input which will go until where it expectantly
# fails and shall send an alert
# this will currently fail in the TaskArchiverPoller killSubscriptions
# on trying to access .load() method which items of below don't have.
# should anything change in the TaskArchiverPoller without modifying this
# test accordingly, it may be failing ...
print "failures 'AttributeError: 'dict' object has no attribute 'load' expected ..."
subList = [{'id': 1}, {'id': 2}, {'id': 3}]
testTaskArchiver.notifyWorkQueue(subList)
# wait for the generated alert to arrive
while len(handler.queue) < len(subList):
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 (expect this many failures)
self.assertEqual(len(handler.queue), len(subList))
alert = handler.queue[0]
self.assertEqual(alert["Source"], "TaskArchiverPoller")