Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set processing version as integer #11040

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/python/WMComponent/DBS3Buffer/DBSBufferBlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,17 @@ def setProcessingVer(self, procVer):
Set the block's processing version.
"""
# compatibility statement for old style proc ver (still needed ?)
if procVer.count("-") == 1:
self.data["processing_era"]["processing_version"] = procVer.split("-v")[1]
pver = procVer
vkuznet marked this conversation as resolved.
Show resolved Hide resolved
if isinstance(pver, str) or isinstance(pver, bytes):
procVer = int(pver)
elif isinstance(pver, int):
procVer = pver
elif pver == None:
vkuznet marked this conversation as resolved.
Show resolved Hide resolved
procVer = 0
else:
self.data["processing_era"]["processing_version"] = procVer
msg = "Provided procVer=%s of type %s cannot be converted to int" % (procVer, type(procVer))
raise Exception(msg)
self.data["processing_era"]["processing_version"] = procVer

self.data["processing_era"]["create_by"] = "WMAgent"
self.data["processing_era"]["description"] = ""
Expand Down
12 changes: 10 additions & 2 deletions src/python/WMComponent/DBS3Buffer/DBSBufferFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,16 @@ def setProcessingVer(self, ver):
Set the era
"""

self['processingVer'] = ver
if isinstance(ver, str) or isinstance(ver, bytes):
procVer = int(ver)
elif isinstance(ver, int):
procVer = ver
elif ver == None:
procVer = 0
else:
msg = "Provided procVer=%s of type %s cannot be converted to int" % (ver, type(ver))
raise Exception(msg)
self['processingVer'] = procVer
return

def setAcquisitionEra(self, era):
Expand Down
4 changes: 0 additions & 4 deletions src/python/WMComponent/DBS3Buffer/MySQL/FindDASToUpload.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ def makeDAS(self, results):
datasetalgos = []
for result in results:

# compatibility statement for old style proc ver (still needed ?)
if result['procver'].count("-") == 1:
result['procver'] = result['procver'].split("-v")[1]

datasetalgos.append( { 'DatasetPath' : result['datasetpath'],
'AcquisitionEra' : result['acquera'],
'ProcessingVer' : result['procver'] } )
Expand Down
13 changes: 12 additions & 1 deletion src/python/WMCore/WMSpec/WMWorkload.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,14 +949,25 @@ def setProcessingVersion(self, processingVersions):
Change the processing version for all tasks in the spec and then update
all of the output LFNs and datasets to use the new processing version.
:param processingVersions: can be any data-type but it is set from StdBase
which performs the input data sanitization/type already.
"""
stepNameMapping = self.getStepMapping()

for task in self.taskIterator():
task.setProcessingVersion(processingVersions, stepChainMap=stepNameMapping)

self.updateLFNsAndDatasets()
self.data.properties.processingVersion = processingVersions
if isinstance(processingVersions, int):
procVer = processingVersions
elif isinstance(processingVersions, dict) or isinstance(processingVersions, list):
procVer = processingVersions
else:
msg = "Provided procVer=%s of type %s cannot be converted to int" \
% (processingVersions, type(processingVersions))
raise Exception(msg)
self.data.properties.processingVersion = procVer
return

def setProcessingString(self, processingStrings):
Expand Down
2 changes: 1 addition & 1 deletion test/python/WMComponent_t/DBS3Buffer_t/DBSBufferFile_t.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ def testProperties(self):
configContent="MOREGIBBERISH")
testFileA.setDatasetPath("/Cosmics/CRUZET09-PromptReco-v1/RECO")
testFileA.setValidStatus(validStatus="VALID")
testFileA.setProcessingVer(ver="ProcVer")
testFileA.setProcessingVer(ver="123")
testFileA.setAcquisitionEra(era="AcqEra")
testFileA.setGlobalTag(globalTag="GlobalTag")
testFileA.setDatasetParent(datasetParent="Parent")
Expand Down