16 payloadDir =
"./archive_repro_13May/payloads/"
17 aCommand =
"ls " + payloadDir +
" | grep BeamSpotObjects_2009_LumiBased_ | grep txt"
18 output = subprocess.getstatusoutput( aCommand )
19 listOfFiles = output[1].
split(
'\n')
22 for fileName
in listOfFiles:
23 file = open(payloadDir + fileName)
25 if line.find(
"since") != -1:
27 tmpObj.run =
unpackLumiid(long(line.split(
' ')[1]))[
"run"]
28 tmpObj.iovSince = line.split(
' ')[1].
replace(
'\n',
'')
29 tmpObj.fileName = fileName
30 finalList[tmpObj.run] = tmpObj
34 sortedKeys = sorted(finalList.keys())
37 regExp = re.search(
'(\D+)(\d+)_(\d+)_(\w+)',listOfFiles[0])
39 databaseTag = regExp.group(4)
41 exit(
"Can't find reg exp")
43 uuid = subprocess.getstatusoutput(
'uuidgen -t')[1]
44 final_sqlite_file_name = databaseTag +
'@' + uuid
45 megaNumber =
"18446744073709551615"
46 print(final_sqlite_file_name)
47 for run
in sortedKeys:
48 appendSqliteFile(final_sqlite_file_name +
".db", payloadDir+finalList[run].fileName.replace(
".txt",
".db"), databaseTag, finalList[run].iovSince, megaNumber,payloadDir)
49 print(finalList[run].fileName.replace(
".txt",
".db"))
50 aCommand =
"cp " + payloadDir + finalList[sortedKeys[0]].fileName +
" " + payloadDir + final_sqlite_file_name +
".txt"
51 output = subprocess.getstatusoutput( aCommand )
54 print(finalList[sortedKeys[0]].fileName)