CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
uploader Namespace Reference

Classes

class  FileObj
 

Functions

def main
 

Function Documentation

def uploader.main ( )

Definition at line 14 of file uploader.py.

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

14 
15 def main():
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')
20  print(listOfFiles)
21  finalList = {}
22  for fileName in listOfFiles:
23  file = open(payloadDir + fileName)
24  for line in file:
25  if line.find("since") != -1:
26  tmpObj = FileObj()
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
31  file.close()
32  break
33 
34  sortedKeys = sorted(finalList.keys())
35 
36  databaseTag = ''
37  regExp = re.search('(\D+)(\d+)_(\d+)_(\w+)',listOfFiles[0])
38  if regExp:
39  databaseTag = regExp.group(4)
40  else:
41  exit("Can't find reg exp")
42 
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 )
52  dropbox = "/DropBox"
53  print(sortedKeys[0])
54  print(finalList[sortedKeys[0]].fileName)
55 # uploadSqliteFile(payloadDir, final_sqlite_file_name, dropbox)
56 
57 
58 
def main
Definition: uploader.py:14
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47