CMS 3D CMS Logo

Classes | Functions
uploader Namespace Reference

Classes

class  FileObj
 

Functions

def main ()
 

Function Documentation

def uploader.main ( )

Definition at line 13 of file uploader.py.

References CommonMethods.appendSqliteFile(), cmsRelvalreport.exit, python.rootplot.root2matplotlib.replace(), split, and timeUnitHelper.unpackLumiid().

13 def main():
14  payloadDir = "./archive_repro_13May/payloads/"
15  aCommand = "ls " + payloadDir + " | grep BeamSpotObjects_2009_LumiBased_ | grep txt"
16  output = commands.getstatusoutput( aCommand )
17  listOfFiles = output[1].split('\n')
18  print listOfFiles
19  finalList = {}
20  for fileName in listOfFiles:
21  file = open(payloadDir + fileName)
22  for line in file:
23  if line.find("since") != -1:
24  tmpObj = FileObj()
25  tmpObj.run = unpackLumiid(long(line.split(' ')[1]))["run"]
26  tmpObj.iovSince = line.split(' ')[1].replace('\n','')
27  tmpObj.fileName = fileName
28  finalList[tmpObj.run] = tmpObj
29  file.close()
30  break
31 
32  sortedKeys = sorted(finalList.keys())
33 
34  databaseTag = ''
35  regExp = re.search('(\D+)(\d+)_(\d+)_(\w+)',listOfFiles[0])
36  if regExp:
37  databaseTag = regExp.group(4)
38  else:
39  exit("Can't find reg exp")
40 
41  uuid = commands.getstatusoutput('uuidgen -t')[1]
42  final_sqlite_file_name = databaseTag + '@' + uuid
43  megaNumber = "18446744073709551615"
44  print final_sqlite_file_name
45  for run in sortedKeys:
46  appendSqliteFile(final_sqlite_file_name + ".db", payloadDir+finalList[run].fileName.replace(".txt",".db"), databaseTag, finalList[run].iovSince, megaNumber,payloadDir)
47  print finalList[run].fileName.replace(".txt",".db")
48  aCommand = "cp " + payloadDir + finalList[sortedKeys[0]].fileName + " " + payloadDir + final_sqlite_file_name + ".txt"
49  output = commands.getstatusoutput( aCommand )
50  dropbox = "/DropBox"
51  print sortedKeys[0]
52  print finalList[sortedKeys[0]].fileName
53 # uploadSqliteFile(payloadDir, final_sqlite_file_name, dropbox)
54 
55 
56 
57 
def replace(string, replacements)
def appendSqliteFile(combinedSqliteFileName, sqliteFileName, tagName, IOVSince, IOVTill, tmpDir="/tmp/")
def main()
Definition: uploader.py:13
double split
Definition: MVATrainer.cc:139