本文整理汇总了Python中WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter.getRequestByCouchView方法的典型用法代码示例。如果您正苦于以下问题:Python RequestDBWriter.getRequestByCouchView方法的具体用法?Python RequestDBWriter.getRequestByCouchView怎么用?Python RequestDBWriter.getRequestByCouchView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter
的用法示例。
在下文中一共展示了RequestDBWriter.getRequestByCouchView方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Request
# 需要导入模块: from WMCore.Services.RequestDB.RequestDBWriter import RequestDBWriter [as 别名]
# 或者: from WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter import getRequestByCouchView [as 别名]
#.........这里部分代码省略.........
status = kwargs.get("status", [])
# list of request names
name = kwargs.get("name", [])
request_type = kwargs.get("request_type", [])
prep_id = kwargs.get("prep_id", [])
inputdataset = kwargs.get("inputdataset", [])
outputdataset = kwargs.get("outputdataset",[])
date_range = kwargs.get("date_range", False)
campaign = kwargs.get("campaign", [])
workqueue = kwargs.get("workqueue", [])
team = kwargs.get("team", [])
mc_pileup = kwargs.get("mc_pileup", [])
data_pileup = kwargs.get("data_pileup", [])
requestor = kwargs.get("requestor", [])
mask = kwargs.get("mask", [])
detail = kwargs.get("detail", True)
# set the return format. default format has requset name as a key
# if is set to one it returns list of dictionary with RequestName field.
common_dict = int(kwargs.get("common_dict", 0))
if detail in (False, "false", "False", "FALSE"):
option = {"include_docs": False}
else:
option = {"include_docs": True}
# eventhing should be stale view. this only needs for test
_nostale = kwargs.get("_nostale", False)
if _nostale:
self.reqmgr_db_service._setNoStale()
request_info = []
if len(status) == 1 and status[0] == "ACTIVE":
status = ACTIVE_STATUS
if status and not team and not request_type and not requestor:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("bystatus", option, status))
if status and team:
query_keys = [[t, s] for t in team for s in status]
request_info.append(
self.reqmgr_db_service.getRequestByCouchView("byteamandstatus", option, query_keys))
if status and request_type:
query_keys = [[s, rt] for rt in request_type for s in status]
request_info.append(self.reqmgr_db_service.getRequestByCouchView("requestsbystatusandtype",
option, query_keys))
if status and requestor:
query_keys = [[s, r] for r in requestor for s in status]
request_info.append(
self.reqmgr_db_service.getRequestByCouchView("bystatusandrequestor", option, query_keys))
if name:
request_info.append(self.reqmgr_db_service.getRequestByNames(name))
if prep_id:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("byprepid", option, prep_id))
if inputdataset:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("byinputdataset", option, inputdataset))
if outputdataset:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("byoutputdataset", option, outputdataset))
if date_range:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("bydate", option, date_range))
if campaign:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("bycampaign", option, campaign))
if workqueue:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("byworkqueue", option, workqueue))
if mc_pileup:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("bymcpileup", option, mc_pileup))
if data_pileup:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("bydatapileup", option, data_pileup))
# get interaction of the request
示例2: Request
# 需要导入模块: from WMCore.Services.RequestDB.RequestDBWriter import RequestDBWriter [as 别名]
# 或者: from WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter import getRequestByCouchView [as 别名]
#.........这里部分代码省略.........
if len(kwargs) == 0:
kwargs['status'] = "running"
options = {"descending": True, 'include_docs': True, 'limit': 200}
request_docs = self.reqmgr_db.loadView("ReqMgr", "bystatus", options)
return rows([request_docs])
# list of status
status = kwargs.get("status", False)
# list of request names
name = kwargs.get("name", False)
request_type = kwargs.get("request_type", False)
prep_id = kwargs.get("prep_id", False)
inputdataset = kwargs.get("inputdataset", False)
outputdataset = kwargs.get("outputdataset", False)
date_range = kwargs.get("date_range", False)
campaign = kwargs.get("campaign", False)
workqueue = kwargs.get("workqueue", False)
team = kwargs.get("team", False)
mc_pileup = kwargs.get("mc_pileup", False)
data_pileup = kwargs.get("data_pileup", False)
detail = kwargs.get("detail", True)
if detail in (False, "false", "False"):
option = {"include_docs": False}
else:
option = {"include_docs": True}
# eventhing should be stale view. this only needs for test
_nostale = kwargs.get("_nostale", False)
if _nostale:
self.reqmgr_db_service._setNoStale()
request_info = []
if status and not team and not request_type:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("bystatus", option, status))
if status and team:
request_info.append(
self.reqmgr_db_service.getRequestByCouchView("byteamandstatus", option, [[team, status]]))
if status and request_type:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("requestsbystatusandtype", option,
[[status, request_type]]))
if name:
request_info.append(self.reqmgr_db_service.getRequestByNames(name))
if prep_id:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("byprepid", option, prep_id))
if inputdataset:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("byinputdataset", option, inputdataset))
if outputdataset:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("byoutputdataset", option, outputdataset))
if date_range:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("bydate", option, date_range))
if campaign:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("bycampaign", option, campaign))
if workqueue:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("byworkqueue", option, workqueue))
if mc_pileup:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("bymcpileup", option, mc_pileup))
if data_pileup:
request_info.append(self.reqmgr_db_service.getRequestByCouchView("bydatapileup", option, data_pileup))
# get interaction of the request
result = self._intersection_of_request_info(request_info)
if len(result) == 0:
return []
return rows([result])
def _intersection_of_request_info(self, request_info):
requests = {}