本文整理汇总了Python中WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter._setNoStale方法的典型用法代码示例。如果您正苦于以下问题:Python RequestDBWriter._setNoStale方法的具体用法?Python RequestDBWriter._setNoStale怎么用?Python RequestDBWriter._setNoStale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter
的用法示例。
在下文中一共展示了RequestDBWriter._setNoStale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tier0PluginTest
# 需要导入模块: from WMCore.Services.RequestDB.RequestDBWriter import RequestDBWriter [as 别名]
# 或者: from WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter import _setNoStale [as 别名]
class Tier0PluginTest(unittest.TestCase):
def setUp(self):
"""
_setUp_
Setup the test environment
"""
self.testInit = TestInit(__file__)
self.testInit.setDatabaseConnection()
self.testInit.setSchema(["WMCore.WMBS"])
self.requestCouchDB = 'wmstats_plugin_t'
self.testInit.setupCouch(self.requestCouchDB, 'T0Request')
self.testDir = self.testInit.generateWorkDir()
reqDBURL = "%s/%s" % (os.environ['COUCHURL'], self.requestCouchDB)
self.requestDBWriter = RequestDBWriter(reqDBURL, couchapp="T0Request")
self.requestDBWriter._setNoStale()
self.stateMap = {}
self.orderedStates = []
self.plugin = None
return
def tearDown(self):
"""
_tearDown_
Clear databases and delete files
"""
self.testInit.tearDownCouch()
self.testInit.clearDatabase()
self.testInit.delWorkDir()
return
def setupRepackWorkflow(self):
"""
_setupRepackWorkflow_
Populate WMBS with a repack-like workflow,
every subscription must be unfinished at first
"""
workflowName = 'Repack_Run481516_StreamZ'
mergeTasks = ['RepackMergewrite_QuadElectron_RAW', 'RepackMergewrite_TriPhoton_RAW',
'RepackMergewrite_SingleNeutrino_RAW']
self.stateMap = {'Merge': [],
'Processing Done': []}
self.orderedStates = ['Merge', 'Processing Done']
# Populate WMStats
self.requestDBWriter.insertGenericRequest({'RequestName': workflowName})
self.requestDBWriter.updateRequestStatus(workflowName, 'Closed')
# Create a wmspec in disk
workload = newWorkload(workflowName)
repackTask = workload.newTask('Repack')
for task in mergeTasks:
repackTask.addTask(task)
repackTask.addTask('RepackCleanupUnmergedwrite_QuadElectron_RAW')
specPath = os.path.join(self.testDir, 'Repack.pkl')
workload.save(specPath)
# Populate WMBS
topFileset = Fileset(name='TestStreamerFileset')
topFileset.create()
options = {'spec': specPath, 'owner': 'ItsAMeMario',
'name': workflowName, 'wfType': 'tier0'}
topLevelWorkflow = Workflow(task='/%s/Repack' % workflowName,
**options)
topLevelWorkflow.create()
topLevelSub = Subscription(topFileset, topLevelWorkflow)
topLevelSub.create()
self.stateMap['Merge'].append(topFileset)
for task in mergeTasks:
mergeWorkflow = Workflow(task='/%s/Repack/%s' % (workflowName, task), **options)
mergeWorkflow.create()
unmergedFileset = Fileset(name='TestUnmergedFileset%s' % task)
unmergedFileset.create()
mergeSub = Subscription(unmergedFileset, mergeWorkflow)
mergeSub.create()
self.stateMap['Processing Done'].append(unmergedFileset)
cleanupWorkflow = Workflow(task='/Repack_Run481516_StreamZ/Repack/RepackCleanupUnmergedwrite_QuadElectron_RAW',
**options)
cleanupWorkflow.create()
unmergedFileset = Fileset(name='TestUnmergedFilesetToCleanup')
unmergedFileset.create()
cleanupSub = Subscription(unmergedFileset, cleanupWorkflow)
cleanupSub.create()
return
def setupExpressWorkflow(self):
"""
_setupExpressWorkflow_
Populate WMBS with a express-like workflow,
#.........这里部分代码省略.........
示例2: Request
# 需要导入模块: from WMCore.Services.RequestDB.RequestDBWriter import RequestDBWriter [as 别名]
# 或者: from WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter import _setNoStale [as 别名]
#.........这里部分代码省略.........
stuff like this has to masked out from result of this call:
_attachments: {u'spec': {u'stub': True, u'length': 51712, u'revpos': 2, u'content_type': u'application/json'}}
_id: maxa_RequestString-OVERRIDE-ME_130621_174227_9225
_rev: 4-c6ceb2737793aaeac3f1cdf591593da4
"""
# list of status
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))
示例3: Request
# 需要导入模块: from WMCore.Services.RequestDB.RequestDBWriter import RequestDBWriter [as 别名]
# 或者: from WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter import _setNoStale [as 别名]
#.........这里部分代码省略.........
_attachments: {u'spec': {u'stub': True, u'length': 51712, u'revpos': 2, u'content_type': u'application/json'}}
_id: maxa_RequestString-OVERRIDE-ME_130621_174227_9225
_rev: 4-c6ceb2737793aaeac3f1cdf591593da4
"""
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: