Skip to content

Commit

Permalink
Merge pull request #11088 from davidsheffield/71X_fix_cmsLHEtoEOSManager
Browse files Browse the repository at this point in the history
Fixed checksum upload validation when compressing LHE files
  • Loading branch information
cmsbuild committed Dec 3, 2015
2 parents f06ae3b + 3390574 commit 0c54573
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions GeneratorInterface/LHEInterface/scripts/cmsLHEtoEOSManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,25 +205,13 @@ def fileUpload(uploadPath,lheList, checkSumList, reallyDoIt):
print "Important! Input file "+f+" is already zipped: please make sure you verified its integrity with xmllint before zipping it. You can do it with:\n"
print "xmllint file.lhe\n"
print "Otherwise it is best to pass the unzipped file to this script and let it check its integrity and compress the file with the --compress option\n"
exeCheckSum = subprocess.Popen(["/afs/cern.ch/cms/caf/bin/cms_adler32",f], stdout=subprocess.PIPE)
getCheckSum = subprocess.Popen(["awk", "{print $1}"], stdin=exeCheckSum.stdout, stdout=subprocess.PIPE)
exeCheckSum.stdout.close()
output,err = getCheckSum.communicate()
# print 'orig file checksum = ' + output + '\n'
theCheckSumList.append(output)
# Check the local file existence
if not os.path.exists(f):
raise Exception('Input file '+f+' does not exists')
if( f.lower().endswith(".lhe") ):
theCheckIntegrityCommand = 'xmllint -noout '+f
exeCheckIntegrity = subprocess.Popen(["/bin/sh","-c", theCheckIntegrityCommand])
intCode = exeCheckIntegrity.wait()
exeCheckSum = subprocess.Popen(["/afs/cern.ch/cms/caf/bin/cms_adler32",f], stdout=subprocess.PIPE)
getCheckSum = subprocess.Popen(["awk", "{print $1}"], stdin=exeCheckSum.stdout, stdout=subprocess.PIPE)
exeCheckSum.stdout.close()
output,err = getCheckSum.communicate()
# print 'orig file checksum = ' + output + '\n'
theCheckSumList.append(output)
if(intCode is not 0):
raise Exception('Input file '+f+ ' is corrupted')
if reallyDoIt and options.compress:
Expand All @@ -233,15 +221,15 @@ def fileUpload(uploadPath,lheList, checkSumList, reallyDoIt):
theCompressionCommand = 'xz '+f
exeCompression = subprocess.Popen(["/bin/sh","-c",theCompressionCommand])
exeCompression.communicate()
exeCheckSum = subprocess.Popen(["/afs/cern.ch/cms/caf/bin/cms_adler32",f+".xz"], stdout=subprocess.PIPE)
getCheckSum = subprocess.Popen(["awk", "{print $1}"], stdin=exeCheckSum.stdout, stdout=subprocess.PIPE)
exeCheckSum.stdout.close()
output,err = getCheckSum.communicate()
# print 'orig file checksum = ' + output + '\n'
theCheckSumList.append(output)
theCompressedFilesList.append(f+'.xz')
if reallyDoIt and options.compress:
theList = theCompressedFilesList
for f in theList:
exeCheckSum = subprocess.Popen(["/afs/cern.ch/cms/caf/bin/cms_adler32",f], stdout=subprocess.PIPE)
getCheckSum = subprocess.Popen(["awk", "{print $1}"], stdin=exeCheckSum.stdout, stdout=subprocess.PIPE)
exeCheckSum.stdout.close()
output,err = getCheckSum.communicate()
theCheckSumList.append(output)

newArt = 0
uploadPath = ''
Expand Down

0 comments on commit 0c54573

Please sign in to comment.