Skip to content

Commit

Permalink
Fixed checksum upload validation when compressing LHE files
Browse files Browse the repository at this point in the history
Script only gets the checksum of the files being added to EOS.
When compressing LHE files with the previous behavior, the script added a checksum for both the original .lhe file and the compressed .lhe.xz. Therefore, it would not compare the correct checksum to the file in EOS and and always produce a warning if the compression option was used.
  • Loading branch information
davidsheffield committed Sep 2, 2015
1 parent 86df8ec commit 3390574
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions GeneratorInterface/LHEInterface/scripts/cmsLHEtoEOSManager.py
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 3390574

Please sign in to comment.