本文整理汇总了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