From fc805c6fb75be10e756947fc556b305ae92bb133 Mon Sep 17 00:00:00 2001 From: Norraphat Date: Sun, 3 May 2020 12:56:37 +0200 Subject: [PATCH 1/2] Add warning if WF name (without date/time from computing) is too long --- .../PyReleaseValidation/python/MatrixInjector.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/MatrixInjector.py b/Configuration/PyReleaseValidation/python/MatrixInjector.py index 98bbb3e439db0..e8ed128484ac5 100644 --- a/Configuration/PyReleaseValidation/python/MatrixInjector.py +++ b/Configuration/PyReleaseValidation/python/MatrixInjector.py @@ -59,7 +59,7 @@ def __init__(self,opt,mode='init',options=''): self.batchTime = str(int(time.time())) if(opt.batchName): self.batchName = '__'+opt.batchName+'-'+self.batchTime - + #wagemt stuff if not self.wmagent: self.wmagent=os.getenv('WMAGENT_REQMGR') @@ -83,7 +83,8 @@ def __init__(self,opt,mode='init',options=''): self.speciallabel='' if opt.label: self.speciallabel= '_'+opt.label - + self.countLongWFName = 0 + self.longWFName = '' if not os.getenv('WMCORE_ROOT'): print('\n\twmclient is not setup properly. Will not be able to upload or submit requests.\n') @@ -477,6 +478,11 @@ def prepare(self,mReader, directories, mode='init'): chainDict['RequestString']='RV'+chainDict['CMSSWVersion']+s[1].split('+')[0] if processStrPrefix or thisLabel: chainDict['RequestString']+='_'+processStrPrefix+thisLabel + #check candidate WF name + self.candidateWFName = self.user+'_'+chainDict['RequestString'] + if (len(self.candidateWFName)>81): + self.countLongWFName+=1 + self.longWFName+=self.candidateWFName+' ('+str(len(self.candidateWFName))+' characters) \n' ### PrepID chainDict['PrepID'] = chainDict['CMSSWVersion']+'__'+self.batchTime+'-'+s[1].split('+')[0] @@ -647,6 +653,6 @@ def submit(self): workFlow=makeRequest(self.wmagent,d,encodeDict=True) print("...........",n,"submitted") random_sleep() - - - + if self.testMode and self.countLongWFName>0: + print("\n*** FIX NEEDED BEFORE INJECTION: "+str(self.countLongWFName)+" candidate workflows have too long name (>81 characters) ***") + print(self.longWFName) From 02369292782ad5cf8dc0e63935bbaf7f6b4a94a0 Mon Sep 17 00:00:00 2001 From: Norraphat Date: Mon, 4 May 2020 17:26:32 +0200 Subject: [PATCH 2/2] Update to list for long workflow name counting --- .../python/MatrixInjector.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/MatrixInjector.py b/Configuration/PyReleaseValidation/python/MatrixInjector.py index e8ed128484ac5..e6ce587c304c2 100644 --- a/Configuration/PyReleaseValidation/python/MatrixInjector.py +++ b/Configuration/PyReleaseValidation/python/MatrixInjector.py @@ -7,6 +7,8 @@ import time import re +MAXWORKFLOWLENGTH = 81 + def performInjectionOptionTest(opt): if opt.show: print('Not injecting to wmagent in --show mode. Need to run the worklfows.') @@ -59,7 +61,7 @@ def __init__(self,opt,mode='init',options=''): self.batchTime = str(int(time.time())) if(opt.batchName): self.batchName = '__'+opt.batchName+'-'+self.batchTime - + #wagemt stuff if not self.wmagent: self.wmagent=os.getenv('WMAGENT_REQMGR') @@ -83,8 +85,7 @@ def __init__(self,opt,mode='init',options=''): self.speciallabel='' if opt.label: self.speciallabel= '_'+opt.label - self.countLongWFName = 0 - self.longWFName = '' + self.longWFName = [] if not os.getenv('WMCORE_ROOT'): print('\n\twmclient is not setup properly. Will not be able to upload or submit requests.\n') @@ -480,9 +481,8 @@ def prepare(self,mReader, directories, mode='init'): chainDict['RequestString']+='_'+processStrPrefix+thisLabel #check candidate WF name self.candidateWFName = self.user+'_'+chainDict['RequestString'] - if (len(self.candidateWFName)>81): - self.countLongWFName+=1 - self.longWFName+=self.candidateWFName+' ('+str(len(self.candidateWFName))+' characters) \n' + if (len(self.candidateWFName)>MAXWORKFLOWLENGTH): + self.longWFName.append(self.candidateWFName) ### PrepID chainDict['PrepID'] = chainDict['CMSSWVersion']+'__'+self.batchTime+'-'+s[1].split('+')[0] @@ -653,6 +653,6 @@ def submit(self): workFlow=makeRequest(self.wmagent,d,encodeDict=True) print("...........",n,"submitted") random_sleep() - if self.testMode and self.countLongWFName>0: - print("\n*** FIX NEEDED BEFORE INJECTION: "+str(self.countLongWFName)+" candidate workflows have too long name (>81 characters) ***") - print(self.longWFName) + if self.testMode and len(self.longWFName)>0: + print("\n*** WARNING: "+str(len(self.longWFName))+" workflows have too long names for submission (>"+str(MAXWORKFLOWLENGTH)+ "characters) ***") + print('\n'.join(self.longWFName))