CMS 3D CMS Logo

Functions | Variables
cmsLHEtoEOSManager Namespace Reference

Functions

def articleExist (artId)
 
def fileUpload (uploadPath, lheList, checkSumList, reallyDoIt, force=False)
 
def findXrdDir (theDirRecord)
 
def lastArticle ()
 

Variables

 __version__
 
 action
 
 args
 
 default
 
 defaultEOSchecksumCommand
 
 defaultEOScpCommand
 
 defaultEOSfeCommand
 
 defaultEOSlistCommand
 
 defaultEOSLoadPath
 
 defaultEOSmkdirCommand
 
 defaultEOSRootPath
 
 dest
 
 err
 
 exeCheckIntegrity
 
 exeCheckSum
 
 exeCompression
 
 exeFullList
 
 exeList
 
 exeUpload
 
 f
 
 getCheckSum
 
 help
 
 intCode
 
 l
 
 listPath
 
 metavar
 
 newArt
 
 oldArt
 
 options
 
 output
 
 parser
 
 PIPE
 
 reallyDoIt
 
 stdin
 
 stdout
 
 theCheckIntegrityCommand
 
 theCheckSumList
 
 theCommand
 
 theCompressedFilesList
 
 theCompressionCommand
 
 theList
 
 type
 
 universal_newlines
 
 uploadPath
 
 usage
 

Detailed Description

:"

python_cmd="python"
python3 -c "from FWCore.PythonFramework.CmsRun import CmsRun" 2>/dev/null && python_cmd="python3"
exec ${python_cmd} $0 ${1+"$@"}

Function Documentation

◆ articleExist()

def cmsLHEtoEOSManager.articleExist (   artId)

Definition at line 39 of file cmsLHEtoEOSManager.py.

References findXrdDir(), and str.

39 def articleExist(artId):
40 
41  itExists = False
42  theCommand = defaultEOSlistCommand+' '+defaultEOSRootPath
43  dirList = subprocess.Popen(["/bin/sh","-c",theCommand], stdout=subprocess.PIPE, universal_newlines=True)
44  for line in dirList.stdout.readlines():
45  if findXrdDir(line) == str(artId):
46  itExists = True
47 
48  return itExists
49 
def findXrdDir(theDirRecord)
#define str(s)

◆ fileUpload()

def cmsLHEtoEOSManager.fileUpload (   uploadPath,
  lheList,
  checkSumList,
  reallyDoIt,
  force = False 
)

Definition at line 66 of file cmsLHEtoEOSManager.py.

References print(), and str.

66 def fileUpload(uploadPath,lheList, checkSumList, reallyDoIt, force=False):
67 
68  inUploadScript = ''
69  index = 0
70  for f in lheList:
71  realFileName = f.split('/')[-1]
72  # Check the file existence
73  newFileName = uploadPath+'/'+str(realFileName)
74  addFile = True
75  additionalOption = ''
76  theCommand = defaultEOSfeCommand+' '+newFileName
77  exeFullList = subprocess.Popen(["/bin/sh","-c",theCommand], stdout=subprocess.PIPE, universal_newlines=True)
78  result = exeFullList.stdout.readlines()
79  if [line for line in result if ("flags:" in line.lower()) and ("isreadable" in line.lower())] and (not force):
80  addFile = False
81  print('File '+newFileName+' already exists: do you want to overwrite? [y/n]')
82  reply = raw_input()
83  if reply == 'y' or reply == 'Y':
84  addFile = True
85  additionalOption = ' -f '
86  print('')
87  print('Overwriting file '+newFileName+'\n')
88  # add the file
89  if addFile:
90 # print 'Adding file '+str(f)+'\n'
91  inUploadScript = defaultEOScpCommand + additionalOption + ' ' + str(f) + ' ' + defaultEOSLoadPath+uploadPath + '/' + str(realFileName)
92  print('Uploading file %s...' % str(f))
93  if reallyDoIt:
94  exeRealUpload = subprocess.Popen(["/bin/sh","-c",inUploadScript])
95  exeRealUpload.communicate()
96  eosCheckSumCommand = defaultEOSchecksumCommand + uploadPath + '/' + str(realFileName) + ' | awk \'{print $2}\' | cut -d= -f2'
97  exeEosCheckSum = subprocess.Popen(eosCheckSumCommand ,shell=True, stdout=subprocess.PIPE, universal_newlines=True)
98  EosCheckSum = exeEosCheckSum.stdout.read()
99  assert exeEosCheckSum.wait() == 0
100  # print 'checksum: eos = ' + EosCheckSum + 'orig file = ' + checkSumList[index] + '\n'
101  if checkSumList[index] not in EosCheckSum:
102  print('WARNING! The checksum for file ' + str(realFileName) + ' in EOS\n')
103  print(EosCheckSum + '\n')
104  print('does not match the checksum of the original one\n')
105  print(checkSumList[index] + '\n')
106  print('please try to re-upload file ' + str(realFileName) + ' to EOS.\n')
107  else:
108  print('Checksum OK for file ' + str(realFileName))
109  index = index+1
110 
111 # launch the upload shell script
112 
113 # print '\n Launching upload script \n'+inUploadScript+'\n at '+time.asctime(time.localtime(time.time()))+' ...\n'
114 # if reallyDoIt:
115 # exeRealUpload = subprocess.Popen(["/bin/sh","-c",inUploadScript])
116 # exeRealUpload.communicate()
117  print('\n Upload ended at '+time.asctime(time.localtime(time.time())))
118 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def fileUpload(uploadPath, lheList, checkSumList, reallyDoIt, force=False)
#define str(s)

◆ findXrdDir()

def cmsLHEtoEOSManager.findXrdDir (   theDirRecord)

Definition at line 31 of file cmsLHEtoEOSManager.py.

References submitPVValidationJobs.split().

Referenced by articleExist(), and lastArticle().

31 def findXrdDir(theDirRecord):
32 
33  elements = theDirRecord.split(' ')
34  if len(elements):
35  return elements[-1].rstrip('\n').split('/')[-1]
36  else:
37  return None
38 
def findXrdDir(theDirRecord)

◆ lastArticle()

def cmsLHEtoEOSManager.lastArticle ( )

Definition at line 50 of file cmsLHEtoEOSManager.py.

References findXrdDir(), createfilelist.int, and SiStripPI.max.

50 def lastArticle():
51 
52  artList = [0]
53 
54  theCommand = defaultEOSlistCommand+' '+defaultEOSRootPath
55  dirList = subprocess.Popen(["/bin/sh","-c",theCommand], stdout=subprocess.PIPE, universal_newlines=True)
56  for line in dirList.stdout.readlines():
57  try:
58  if line.rstrip('\n') != '':
59  artList.append(int(findXrdDir(line)))
60  except:
61  break
62 
63  return max(artList)
64 
65 
def findXrdDir(theDirRecord)

Variable Documentation

◆ __version__

cmsLHEtoEOSManager.__version__
private

Definition at line 14 of file cmsLHEtoEOSManager.py.

◆ action

cmsLHEtoEOSManager.action

Definition at line 138 of file cmsLHEtoEOSManager.py.

◆ args

cmsLHEtoEOSManager.args

Definition at line 172 of file cmsLHEtoEOSManager.py.

◆ default

cmsLHEtoEOSManager.default

Definition at line 130 of file cmsLHEtoEOSManager.py.

◆ defaultEOSchecksumCommand

cmsLHEtoEOSManager.defaultEOSchecksumCommand

Definition at line 28 of file cmsLHEtoEOSManager.py.

◆ defaultEOScpCommand

cmsLHEtoEOSManager.defaultEOScpCommand

Definition at line 29 of file cmsLHEtoEOSManager.py.

◆ defaultEOSfeCommand

cmsLHEtoEOSManager.defaultEOSfeCommand

Definition at line 27 of file cmsLHEtoEOSManager.py.

◆ defaultEOSlistCommand

cmsLHEtoEOSManager.defaultEOSlistCommand

Definition at line 25 of file cmsLHEtoEOSManager.py.

◆ defaultEOSLoadPath

cmsLHEtoEOSManager.defaultEOSLoadPath

Definition at line 24 of file cmsLHEtoEOSManager.py.

◆ defaultEOSmkdirCommand

cmsLHEtoEOSManager.defaultEOSmkdirCommand

Definition at line 26 of file cmsLHEtoEOSManager.py.

◆ defaultEOSRootPath

cmsLHEtoEOSManager.defaultEOSRootPath

Definition at line 21 of file cmsLHEtoEOSManager.py.

◆ dest

cmsLHEtoEOSManager.dest

Definition at line 131 of file cmsLHEtoEOSManager.py.

◆ err

cmsLHEtoEOSManager.err

Definition at line 252 of file cmsLHEtoEOSManager.py.

◆ exeCheckIntegrity

cmsLHEtoEOSManager.exeCheckIntegrity

Definition at line 233 of file cmsLHEtoEOSManager.py.

◆ exeCheckSum

cmsLHEtoEOSManager.exeCheckSum

Definition at line 249 of file cmsLHEtoEOSManager.py.

◆ exeCompression

cmsLHEtoEOSManager.exeCompression

Definition at line 242 of file cmsLHEtoEOSManager.py.

◆ exeFullList

cmsLHEtoEOSManager.exeFullList

Definition at line 299 of file cmsLHEtoEOSManager.py.

◆ exeList

cmsLHEtoEOSManager.exeList

Definition at line 286 of file cmsLHEtoEOSManager.py.

◆ exeUpload

cmsLHEtoEOSManager.exeUpload

Definition at line 269 of file cmsLHEtoEOSManager.py.

◆ f

cmsLHEtoEOSManager.f

Definition at line 208 of file cmsLHEtoEOSManager.py.

◆ getCheckSum

cmsLHEtoEOSManager.getCheckSum

Definition at line 250 of file cmsLHEtoEOSManager.py.

◆ help

cmsLHEtoEOSManager.help

Definition at line 129 of file cmsLHEtoEOSManager.py.

◆ intCode

cmsLHEtoEOSManager.intCode

Definition at line 234 of file cmsLHEtoEOSManager.py.

◆ l

cmsLHEtoEOSManager.l

Definition at line 212 of file cmsLHEtoEOSManager.py.

◆ listPath

cmsLHEtoEOSManager.listPath

Definition at line 284 of file cmsLHEtoEOSManager.py.

◆ metavar

cmsLHEtoEOSManager.metavar

Definition at line 133 of file cmsLHEtoEOSManager.py.

◆ newArt

cmsLHEtoEOSManager.newArt

Definition at line 257 of file cmsLHEtoEOSManager.py.

◆ oldArt

cmsLHEtoEOSManager.oldArt

Definition at line 263 of file cmsLHEtoEOSManager.py.

◆ options

cmsLHEtoEOSManager.options

Definition at line 172 of file cmsLHEtoEOSManager.py.

◆ output

cmsLHEtoEOSManager.output

Definition at line 252 of file cmsLHEtoEOSManager.py.

◆ parser

cmsLHEtoEOSManager.parser

Definition at line 127 of file cmsLHEtoEOSManager.py.

◆ PIPE

cmsLHEtoEOSManager.PIPE

◆ reallyDoIt

cmsLHEtoEOSManager.reallyDoIt

Definition at line 182 of file cmsLHEtoEOSManager.py.

◆ stdin

cmsLHEtoEOSManager.stdin

Definition at line 250 of file cmsLHEtoEOSManager.py.

Referenced by spu.zerr().

◆ stdout

cmsLHEtoEOSManager.stdout

Definition at line 249 of file cmsLHEtoEOSManager.py.

◆ theCheckIntegrityCommand

cmsLHEtoEOSManager.theCheckIntegrityCommand

Definition at line 232 of file cmsLHEtoEOSManager.py.

◆ theCheckSumList

cmsLHEtoEOSManager.theCheckSumList

Definition at line 218 of file cmsLHEtoEOSManager.py.

◆ theCommand

cmsLHEtoEOSManager.theCommand

Definition at line 267 of file cmsLHEtoEOSManager.py.

◆ theCompressedFilesList

cmsLHEtoEOSManager.theCompressedFilesList

Definition at line 217 of file cmsLHEtoEOSManager.py.

◆ theCompressionCommand

cmsLHEtoEOSManager.theCompressionCommand

Definition at line 241 of file cmsLHEtoEOSManager.py.

◆ theList

cmsLHEtoEOSManager.theList

Definition at line 202 of file cmsLHEtoEOSManager.py.

Referenced by MuonAlignment.recursiveList().

◆ type

cmsLHEtoEOSManager.type

Definition at line 145 of file cmsLHEtoEOSManager.py.

◆ universal_newlines

cmsLHEtoEOSManager.universal_newlines

Definition at line 249 of file cmsLHEtoEOSManager.py.

◆ uploadPath

cmsLHEtoEOSManager.uploadPath

Definition at line 258 of file cmsLHEtoEOSManager.py.

◆ usage

cmsLHEtoEOSManager.usage

Definition at line 126 of file cmsLHEtoEOSManager.py.