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


Python RequestDBReader._getCouchView方法代码示例

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


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

示例1: acdcCleanup

# 需要导入模块: from WMCore.Services.RequestDB.RequestDBReader import RequestDBReader [as 别名]
# 或者: from WMCore.Services.RequestDB.RequestDBReader.RequestDBReader import _getCouchView [as 别名]
    def acdcCleanup(self, config):
        """
        gather active data statistics
        """
        
        reqDB = RequestDBReader(config.reqmgrdb_url)

        from WMCore.ACDC.CouchService import CouchService
        baseURL, acdcDB = splitCouchServiceURL(config.acdc_url)
        acdcService = CouchService(url = baseURL, database = acdcDB)
        originalRequests = acdcService.listCollectionNames()
        
        if len(originalRequests) == 0:
            return 
        # filter requests
        results = reqDB._getCouchView("byrequest", {}, originalRequests)
        # checkt he status of the requests [announced, rejected-archived, aborted-archived, normal-archived]
        deleteStates = ["announced", "rejected-archived", "aborted-archived", "normal-archived"]
        filteredRequests = []
        for row in results["rows"]:
            if row["value"][0] in deleteStates:
                filteredRequests.append(row["key"])
                
        total = 0
        for req in filteredRequests:
            try:
                deleted = acdcService.removeFilesetsByCollectionName(req)
                if deleted == None:
                    self.logger.warning("request alread deleted %s" % req)
                else:
                    total += len(deleted)
                    self.logger.info("request %s deleted" % req)
            except:
                self.logger.error("request deleted failed: will try again %s" % req)
        self.logger.info("total %s requests deleted" % total)        
        return
开发者ID:AndresTanasijczuk,项目名称:WMCore,代码行数:38,代码来源:CouchDBCleanup.py


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