当前位置: 首页>>代码示例>>Python>>正文


Python TaskArchiverPoller.killSubscriptions方法代码示例

本文整理汇总了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
开发者ID:AndrewLevin,项目名称:WMCore,代码行数:35,代码来源:TaskArchiver_t.py


注:本文中的WMComponent.TaskArchiver.TaskArchiverPoller.TaskArchiverPoller.killSubscriptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。