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


Python ReqMgr.getRequestByStatusFromMemoryCache方法代码示例

本文整理汇总了Python中WMCore.Services.ReqMgr.ReqMgr.ReqMgr.getRequestByStatusFromMemoryCache方法的典型用法代码示例。如果您正苦于以下问题:Python ReqMgr.getRequestByStatusFromMemoryCache方法的具体用法?Python ReqMgr.getRequestByStatusFromMemoryCache怎么用?Python ReqMgr.getRequestByStatusFromMemoryCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WMCore.Services.ReqMgr.ReqMgr.ReqMgr的用法示例。


在下文中一共展示了ReqMgr.getRequestByStatusFromMemoryCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: WorkQueueManagerCleaner

# 需要导入模块: from WMCore.Services.ReqMgr.ReqMgr import ReqMgr [as 别名]
# 或者: from WMCore.Services.ReqMgr.ReqMgr.ReqMgr import getRequestByStatusFromMemoryCache [as 别名]
class WorkQueueManagerCleaner(BaseWorkerThread):
    """
    Cleans expired items, updates element status.
    """
    def __init__(self, queue, config):
        """
        Initialise class members
        """
        BaseWorkerThread.__init__(self)
        self.forbiddenStatus = ["aborted", "aborted-completed", "force-complete", "completed"]
        self.queue = queue
        self.config = config
        self.reqmgr2Svc = ReqMgr(self.config.General.ReqMgr2ServiceURL)
        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS",
                                logger=myThread.logger,
                                dbinterface=myThread.dbi)
        self.finishedWorflowCheck = daoFactory(classname="Subscriptions.CountFinishedSubscriptionsByWorkflow")

    def setup(self, parameters):
        """
        Called at startup - introduce random delay
             to avoid workers all starting at once
        """
        t = random.randrange(self.idleTime)
        self.logger.info('Sleeping for %d seconds before 1st loop' % t)
        time.sleep(t)

    @timeFunction
    def algorithm(self, parameters):
        """
        Check & expire negotiation failures
        """
        self.queue.logger.info("Start updating & cleaning...")
        try:
            self.queue.performQueueCleanupActions()
            # this will clean up whatever left over from above clean up.
            # also if the wq replication has problem it won't delay the killing jobs in condor
            # and updating wmbs status
            # state lists which shouldn't be populated in wmbs. (To prevent creating work before WQE status updated)
            # added completed status in the list due to the race condition
            requests = self.reqmgr2Svc.getRequestByStatusFromMemoryCache(self.forbiddenStatus).getData()
            results = self.finishedWorflowCheck.execute(workflowNames=requests)

            requestsToKill = [reqInfo["workflow"] for reqInfo in results if reqInfo["open"] > 0]

            self.queue.logger.info("Killing %d requests in WMBS ...", len(requestsToKill))
            self.queue.killWMBSWorkflows(requestsToKill)
        except Exception as ex:
            self.queue.logger.exception("Error cleaning queue: %s", str(ex))

        self.queue.logger.info("Finished updating & cleaning.")
开发者ID:vkuznet,项目名称:WMCore,代码行数:54,代码来源:WorkQueueManagerCleaner.py


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