本文整理汇总了Python中WMCore.RequestManager.RequestDB.Interface.Admin.SoftwareManagement类的典型用法代码示例。如果您正苦于以下问题:Python SoftwareManagement类的具体用法?Python SoftwareManagement怎么用?Python SoftwareManagement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SoftwareManagement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testA_SoftwareManagement
def testA_SoftwareManagement(self):
"""
_SoftwareManagement_
Test the SoftwareManagement code
"""
self.assertEqual(SoftwareManagement.listSoftware(), {})
softwareVersions = ReqMgrWebTools.allScramArchsAndVersions()
ReqMgrWebTools.updateScramArchsAndCMSSWVersions()
result = SoftwareManagement.listSoftware()
for scramArch in result.keys():
self.assertEqual(set(result[scramArch]), set(softwareVersions[scramArch]))
# Now for each scramArch insert a blank set
# Because of the way that updateSoftware works, this interprets a blank list
# as telling it that no softwareVersions are available.
# It deletes every software version it is not handed, so it should give nothing out.
for scramArch in result.keys():
SoftwareManagement.updateSoftware(softwareNames = [], scramArch = scramArch)
self.assertEqual(SoftwareManagement.listSoftware(), {})
from WMCore.HTTPFrontEnd.RequestManager import Admin
setattr(self.config, 'database', self.testInit.coreConfig.CoreDatabase)
self.config.section_('templates')
self.config.section_('html')
admin = Admin.Admin(self.config)
ReqMgrWebTools.updateScramArchsAndCMSSWVersions()
self.assertTrue('slc5_amd64_gcc434' in admin.scramArchs())
return
示例2: testH_RemoveSoftwareVersion
def testH_RemoveSoftwareVersion(self):
"""
_RemoveSoftwareVersion_
Remove the software version after submitting the request. See what that does.
"""
myThread = threading.currentThread()
userName = "Taizong"
groupName = "Li"
teamName = "Tang"
CMSSWVersion = "CMSSW_3_5_8"
scramArch = "slc5_ia32_gcc434"
schema = self.setupSchema(
userName=userName, groupName=groupName, teamName=teamName, CMSSWVersion=CMSSWVersion, scramArch=scramArch
)
result = self.jsonSender.put("request/testRequest", schema)
self.assertEqual(result[1], 200)
requestName = result[0]["RequestName"]
req = self.jsonSender.get("request/%s" % requestName)[0]
self.assertEqual(req["SoftwareVersions"], [CMSSWVersion])
# Delete software versions and make sure they're gone from the DB
SoftwareManagement.removeSoftware(softwareName=CMSSWVersion, scramArch=scramArch)
versions = myThread.dbi.processData("SELECT * FROM reqmgr_software")[0].fetchall()
self.assertEqual(versions, [])
assocs = myThread.dbi.processData("SELECT * FROM reqmgr_software_dependency")[0].fetchall()
self.assertEqual(assocs, [])
req = self.jsonSender.get("request/%s" % requestName)[0]
self.assertEqual(req["SoftwareVersions"], [CMSSWVersion])
return
示例3: checkIn
def checkIn(request):
"""
_CheckIn_
Check in of a request manager
Given a new request, check it in to the DB and add the
appropriate IDs.
"""
# //
# // First try and register the request in the DB
#//
requestName = request['RequestName']
# test if the software versions are registered first
versions = SoftwareManagement.listSoftware()
for version in request.get('SoftwareVersions', []):
if not version in versions:
raise RuntimeError, "Cannot find software version %s in ReqMgr" % version
try:
reqId = MakeRequest.createRequest(
request['Requestor'],
request['Group'],
requestName,
request['RequestType'],
request['RequestWorkflow'],
request.get('PrepID', None)
)
except Exception, ex:
msg = "Error creating new request:\n"
msg += str(ex)
raise RuntimeError, msg
示例4: checkIn
def checkIn(request, requestType = 'None'):
"""
_CheckIn_
Check in of a request manager
Given a new request, check it in to the DB and add the
appropriate IDs.
"""
# //
# // First try and register the request in the DB
#//
requestName = request['RequestName']
# test if the software versions are registered first
versions = SoftwareManagement.listSoftware()
scramArch = request.get('ScramArch')
if requestType.lower() in ['resubmission']:
# Do nothing, as we have no valid software version yet
pass
else:
if not scramArch in versions.keys():
m = ("Cannot find scramArch %s in ReqMgr (the one(s) available: %s)" %
(scramArch, versions))
raise RequestCheckInError(m)
for version in request.get('SoftwareVersions', []):
if not version in versions[scramArch]:
raise RequestCheckInError("Cannot find software version %s in ReqMgr for "
"scramArch %s. Supported versions: %s" %
(version, scramArch, versions[scramArch]))
try:
reqId = MakeRequest.createRequest(
request['Requestor'],
request['Group'],
requestName,
request['RequestType'],
request['RequestWorkflow'],
request.get('PrepID', None),
request.get('ReqMgrRequestBasePriority', None)
)
except Exception, ex:
msg = "Error creating new request:\n"
msg += str(ex)
raise RequestCheckInError( msg )
示例5: checkIn
def checkIn(request, requestType="None", wmstatSvc=None):
"""
_CheckIn_
Check in of a request manager
Given a new request, check it in to the DB and add the
appropriate IDs.
"""
# //
# // First try and register the request in the DB
# //
requestName = request["RequestName"]
# test if the software versions are registered first
versions = SoftwareManagement.listSoftware()
scramArch = request.get("ScramArch")
if requestType.lower() in ["resubmission"]:
# Do nothing, as we have no valid software version yet
pass
else:
if not scramArch in versions.keys():
m = "Cannot find scramArch %s in ReqMgr (the one(s) available: %s)" % (scramArch, versions)
raise RequestCheckInError(m)
for version in request.get("SoftwareVersions", []):
if not version in versions[scramArch]:
raise RequestCheckInError(
"Cannot find software version %s in ReqMgr for scramArch %s" % (version, scramArch)
)
try:
reqId = MakeRequest.createRequest(
request["Requestor"],
request["Group"],
requestName,
request["RequestType"],
request["RequestWorkflow"],
request.get("PrepID", None),
)
except Exception, ex:
msg = "Error creating new request:\n"
msg += str(ex)
raise RequestCheckInError(msg)
示例6: checkIn
def checkIn(request, requestType="None"):
"""
_CheckIn_
Check in of a request manager
Given a new request, check it in to the DB and add the
appropriate IDs.
"""
# //
# // First try and register the request in the DB
# //
requestName = request["RequestName"]
# test if the software versions are registered first
versions = SoftwareManagement.listSoftware()
scramArch = request.get("ScramArch")
if requestType.lower() in ["resubmission"]:
# Do nothing, as we have no valid software version yet
pass
else:
if not scramArch in versions.keys():
m = "Cannot find scramArch %s in ReqMgr (the one(s) available: %s)" % (scramArch, versions)
raise RequestCheckInError(m)
for version in request.get("SoftwareVersions", []):
if not version in versions[scramArch]:
raise RequestCheckInError(
"Cannot find software version %s in ReqMgr for "
"scramArch %s. Supported versions: %s" % (version, scramArch, versions[scramArch])
)
try:
reqId = MakeRequest.createRequest(
request["Requestor"],
request["Group"],
requestName,
request["RequestType"],
request["RequestWorkflow"],
request.get("PrepID", None),
request.get("RequestPriority", None),
)
except Exception as ex:
msg = "Error creating new request:\n"
msg += str(ex)
raise RequestCheckInError(msg)
# FIXME LAST_INSERT_ID doesn't work on oracle
reqId = GetRequest.requestID(requestName)
request["RequestID"] = reqId
logging.info("Request %s created with request id %s" % (requestName, request["RequestID"]))
# //
# // add metadata about the request
# //
try:
if request["InputDatasetTypes"] != {}:
for ds, dsType in request["InputDatasetTypes"].items():
MakeRequest.associateInputDataset(requestName, ds, dsType)
elif isinstance(request["InputDatasets"], list):
for ds in request["InputDatasets"]:
MakeRequest.associateInputDataset(requestName, ds)
else:
MakeRequest.associateInputDataset(requestName, request["InputDatasets"])
except Exception as ex:
_raiseCheckInError(request, ex, "Unable to Associate input datasets to request")
try:
for ds in request["OutputDatasets"]:
# request['OutputDatasets'] may contain a list of lists (each sublist for a task)
# which is actually not understood why but seems to be correct (Steve)
# dirty
if isinstance(ds, list):
for dss in ds:
MakeRequest.associateOutputDataset(requestName, dss)
else:
MakeRequest.associateOutputDataset(requestName, ds)
except Exception as ex:
_raiseCheckInError(request, ex, "Unable to Associate output datasets to request")
try:
for sw in request["SoftwareVersions"]:
MakeRequest.associateSoftware(requestName, sw)
except Exception as ex:
_raiseCheckInError(request, ex, "Unable to associate software for this request")
MakeRequest.updateRequestSize(
requestName,
request.get("RequestNumEvents", 0),
request.get("RequestSizeFiles", 0),
request.get("SizePerEvent", 0),
)
campaign = request.get("Campaign", "")
if campaign != "" and campaign != None:
Campaign.associateCampaign(campaign, reqId)
logging.info("Request '%s' built with request id '%s" "" % (requestName, request["RequestID"]))
示例7: handleAllVersions
def handleAllVersions(self):
""" Registers all versions in the TC """
currentVersions = SoftwareAdmin.listSoftware().keys()
allVersions = Utilities.allSoftwareVersions()
result = ""
for version in allVersions:
if not version in currentVersions:
WMCore.Lexicon.cmsswversion(version)
SoftwareAdmin.addSoftware(version)
result += "Added version %s<br/>" % version
if result == "":
result = "Version list is up to date"
return result
示例8: versions
def versions(self):
""" Lists all versions """
versions = SoftwareAdmin.listSoftware().keys()
versions.sort()
for version in versions:
WMCore.Lexicon.cmsswversion(version)
return self.templatepage("Versions", versions=versions)
示例9: updateScramArchsAndCMSSWVersions
def updateScramArchsAndCMSSWVersions():
"""
_updateScramArchsAndCMSSWVersions_
Update both the scramArchs and their associated software versions to
the current tag collector standard.
"""
allArchsAndVersions = allScramArchsAndVersions()
if allArchsAndVersions == {}:
# The tag collector is probably down
# NO valid CMSSW Versions is not a valid use case!
# Do nothing.
logging.error("Handed blank list of scramArchs/versions. Ignoring for this cycle.")
return
for scramArch in allArchsAndVersions.keys():
SoftwareAdmin.updateSoftware(scramArch=scramArch, softwareNames=allArchsAndVersions[scramArch])
示例10: scramArchs
def scramArchs(self):
"""
_scramArchs_
List all scramArchs in the DB
Prelim for putting this in the template pages
"""
return SoftwareAdmin.listSoftware().keys()
示例11: getVersion
def getVersion(self):
""" Returns a list of all CMSSW versions registered with ReqMgr """
archList = SoftwareAdmin.listSoftware()
result = []
for arch in archList.keys():
for version in archList[arch]:
if not version in result:
result.append(version)
return result
示例12: versions
def versions(self):
""" Lists all versions """
archList = SoftwareAdmin.listSoftware()
versions = []
for versionList in archList.values():
for version in versionList:
if not version in versions:
versions.append(version)
versions.sort()
for version in versions:
WMCore.Lexicon.cmsswversion(version)
return self.templatepage("Versions", versions=versions)
示例13: deleteVersion
def deleteVersion(self, version, scramArch):
""" Un-register this software version with ReqMgr """
SoftwareAdmin.removeSoftware(version, scramArch)
示例14: putVersion
def putVersion(self, version, scramArch = None):
""" Registers a new CMSSW version with ReqMgr """
return SoftwareAdmin.addSoftware(version, scramArch = scramArch)
示例15: getVersion
def getVersion(self):
""" Returns a list of all CMSSW versions registered with ReqMgr """
return SoftwareAdmin.listSoftware().keys()