3 import string, os, time,re
27 runnumber=int(lumifilename.split(
'_')[4])
33 command =
'lumiData2.py -c ' +connectionString+
' -P '+authpath+
' listrun'
35 command+=
' --minrun '+str(minrun)
36 statusAndOutput = commands.getstatusoutput(command)
37 rlist= eval(statusAndOutput[1])
39 lastAnalyzedRunNumber = rlist[-1]
40 print 'Last run in DB: ', lastAnalyzedRunNumber
42 print 'No qualified run found in DB'
43 lastAnalyzedRunNumber=int(minrun)
46 p=re.compile(
'^CMS_LUMI_RAW_\d\d\d\d\d\d\d\d_\d\d\d\d\d\d\d\d\d_\d\d\d\d_\d.root$')
47 files=
filter(os.path.isfile,[os.path.join(dropbox,x)
for x
in os.listdir(dropbox)
if p.match(x)])
48 files.sort(key=
lambda x: os.path.getmtime(os.path.join(dropbox,x)))
54 print 'Last lumi file produced by HF: ', lastRaw +
', Run: ', lastRecordedRun
58 if lastRecordedRun != lastAnalyzedRunNumber:
60 if len(file.split(
'_'))!=7:
continue
64 if thisrun>lastAnalyzedRunNumber :
65 runsToBeAnalyzed[str(thisrun)] = file
66 return runsToBeAnalyzed
69 from RecoLuminosity.LumiDB
import argparse
72 parser.add_argument(
'-c',dest=
'connect',action=
'store',required=
True,help=
'connect string to lumiDB')
73 parser.add_argument(
'-d',dest=
'dropbox',action=
'store',required=
True,help=
'location of the lumi root files')
74 parser.add_argument(
'-P',dest=
'authpath',action=
'store',required=
False,help=
'auth path')
75 parser.add_argument(
'-L',dest=
'logpath',action=
'store',required=
False,help=
'log path')
76 parser.add_argument(
'-f',dest=
'loaderconf',action=
'store',required=
True,help=
'path to loder config file')
77 parser.add_argument(
'--minrun',dest=
'minrun',action=
'store',required=
False,help=
'minimum run to serch')
78 args=parser.parse_args()
80 lumiauthpath=args.authpath
82 lumilogpath=args.logpath
83 loaderconf=args.loaderconf
84 runsToBeAnalyzed =
getRunsToBeUploaded(args.connect,args.dropbox,lumiauthpath,minrun=args.minrun)
87 rs=runsToBeAnalyzed.keys()
91 if runCounter==1:
print 'List of processed runs: '
92 print 'Run: ', run,
' file: ', runsToBeAnalyzed[run]
93 logFile=open(os.path.join(lumilogpath,
'loadDB_run'+run+
'.log'),
'w',0)
96 command =
'$LOCALRT/test/$SCRAM_ARCH/cmmdLoadLumiDB -r '+run+
' -L "file:'+runsToBeAnalyzed[run]+
'"'+
' -f '+loaderconf+
' --debug'
97 statusAndOutput = commands.getstatusoutput(command)
98 logFile.write(command+
'\n')
99 logFile.write(statusAndOutput[1])
100 if not statusAndOutput[0] == 0:
101 print 'ERROR while loading info onto DB for run ' + run
102 print statusAndOutput[1]
113 if runCounter == 0:
print 'No runs to be analyzed'
115 if __name__==
'__main__':
def getRunnumberFromFileName