CMS 3D CMS Logo

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

Functions

def createIndex
 
def createLumi
 
def createValidation
 
def describeLumi
 
def dropIndex
 
def dropLumi
 
def main
 

Variables

string VERSION = '2.00'
 

Function Documentation

def lumiSchema.createIndex (   dbsession)

Definition at line 218 of file lumiSchema.py.

References nameDealer.hltTableName(), nameDealer.lumisummaryTableName(), and nameDealer.trgTableName().

Referenced by main().

219 def createIndex(dbsession):
220  dbsession.transaction().start(False)
221  schema=dbsession.nominalSchema()
222  schema.tableHandle( nameDealer.lumisummaryTableName() ).schemaEditor().createIndex('lumisummary_runnum',('RUNNUM'))
223  schema.tableHandle( nameDealer.trgTableName() ).schemaEditor().createIndex('trg_runnum',('RUNNUM'))
224  schema.tableHandle( nameDealer.hltTableName() ).schemaEditor().createIndex('hlt_runnum',('RUNNUM'))
225  dbsession.transaction().commit()
Definition: start.py:1
def lumisummaryTableName
Definition: nameDealer.py:25
def hltTableName
Definition: nameDealer.py:55
def createIndex
Definition: lumiSchema.py:218
def trgTableName
Definition: nameDealer.py:52
def lumiSchema.createLumi (   dbsession)

Definition at line 7 of file lumiSchema.py.

References nameDealer.cmsrunsummaryTableName(), nameDealer.hltTableName(), nameDealer.lumidetailTableName(), nameDealer.lumihltresultTableName(), nameDealer.lumiresultTableName(), nameDealer.lumisummaryTableName(), nameDealer.lumivalidationTableName(), nameDealer.trghltMapTableName(), and nameDealer.trgTableName().

Referenced by main().

7 
8 def createLumi(dbsession):
9  print 'creating lumi db schema...'
10  dbsession.transaction().start(False)
11  schema=dbsession.nominalSchema()
12  db=dbUtil.dbUtil(schema)
13  #cms run summary table
14 
15  cmsrunsummary=coral.TableDescription()
16  cmsrunsummary.setName( nameDealer.cmsrunsummaryTableName() )
17  cmsrunsummary.insertColumn('RUNNUM','unsigned int')
18  cmsrunsummary.insertColumn('HLTKEY','string')
19  cmsrunsummary.insertColumn('FILLNUM','unsigned int')
20  cmsrunsummary.insertColumn('SEQUENCE','string')
21  cmsrunsummary.insertColumn('STARTTIME','time stamp',6)
22  cmsrunsummary.insertColumn('STOPTIME','time stamp',6)
23  cmsrunsummary.setPrimaryKey('RUNNUM')
24  cmsrunsummary.setNotNullConstraint('HLTKEY',True)
25  cmsrunsummary.setNotNullConstraint('FILLNUM',True)
26  cmsrunsummary.setNotNullConstraint('SEQUENCE',True)
27  cmsrunsummary.createIndex('cmsrunsummary_fillnum',('FILLNUM'))
28  cmsrunsummary.createIndex('cmsrunsummary_startime',('STARTTIME'))
29  db.createTable(cmsrunsummary,False)
30 
31  #lumi summary table
32  summary=coral.TableDescription()
33  summary.setName( nameDealer.lumisummaryTableName() )
34  summary.insertColumn('LUMISUMMARY_ID','unsigned long long')
35  summary.insertColumn('RUNNUM','unsigned int')
36  summary.insertColumn('CMSLSNUM','unsigned int')
37  summary.insertColumn('LUMILSNUM','unsigned int')
38  summary.insertColumn('LUMIVERSION','string')
39  summary.insertColumn('DTNORM','float')
40  summary.insertColumn('LHCNORM','float')
41  summary.insertColumn('INSTLUMI','float')
42  summary.insertColumn('INSTLUMIERROR','float')
43  summary.insertColumn('INSTLUMIQUALITY','short')
44  summary.insertColumn('CMSALIVE','short')
45  summary.insertColumn('STARTORBIT','unsigned int')
46  summary.insertColumn('NUMORBIT','unsigned int')
47  summary.insertColumn('LUMISECTIONQUALITY','short')
48  summary.insertColumn('BEAMENERGY','float')
49  summary.insertColumn('BEAMSTATUS','string')
50  summary.insertColumn('CMSBXINDEXBLOB','blob')
51  summary.insertColumn('BEAMINTENSITYBLOB_1','blob')
52  summary.insertColumn('BEAMINTENSITYBLOB_2','blob')
53 
54  summary.setPrimaryKey('LUMISUMMARY_ID')
55  summary.setNotNullConstraint('RUNNUM',True)
56  summary.setNotNullConstraint('CMSLSNUM',True)
57  summary.setNotNullConstraint('LUMILSNUM',True)
58  summary.setNotNullConstraint('LUMIVERSION',True)
59  summary.setNotNullConstraint('DTNORM',True)
60  summary.setNotNullConstraint('LHCNORM',True)
61  summary.setNotNullConstraint('INSTLUMI',True)
62  summary.setNotNullConstraint('INSTLUMIERROR',True)
63  summary.setNotNullConstraint('INSTLUMIQUALITY',True)
64  summary.setNotNullConstraint('CMSALIVE',True)
65  summary.setNotNullConstraint('STARTORBIT',True)
66  summary.setNotNullConstraint('NUMORBIT',True)
67  summary.setNotNullConstraint('LUMISECTIONQUALITY',True)
68  summary.setNotNullConstraint('BEAMENERGY',True)
69  summary.setNotNullConstraint('BEAMSTATUS',True)
70 
71  summary.setUniqueConstraint(('RUNNUM','LUMIVERSION','LUMILSNUM'))
72  summary.createIndex('lumisummary_runnum',('RUNNUM'))
73 
74  db.createTable(summary,True)
75  #lumi detail table
76  detail=coral.TableDescription()
77  detail.setName( nameDealer.lumidetailTableName() )
78  detail.insertColumn('LUMIDETAIL_ID','unsigned long long')
79  detail.insertColumn('LUMISUMMARY_ID','unsigned long long')
80  detail.insertColumn('BXLUMIVALUE','blob')
81  detail.insertColumn('BXLUMIERROR','blob')
82  detail.insertColumn('BXLUMIQUALITY','blob')
83  detail.insertColumn('ALGONAME','string')
84  detail.setPrimaryKey('LUMIDETAIL_ID')
85  detail.createForeignKey('DETAILSOURCE','LUMISUMMARY_ID',nameDealer.lumisummaryTableName(),'LUMISUMMARY_ID')
86  detail.setNotNullConstraint('BXLUMIVALUE',True)
87  detail.setNotNullConstraint('BXLUMIERROR',True)
88  detail.setNotNullConstraint('BXLUMIQUALITY',True)
89  detail.setNotNullConstraint('ALGONAME',True)
90 
91  detail.setUniqueConstraint(('LUMISUMMARY_ID','ALGONAME'))
92 
93  db.createTable(detail,True)
94  #trg table
95  trg=coral.TableDescription()
96  trg.setName( nameDealer.trgTableName() )
97  trg.insertColumn('TRG_ID','unsigned long long')
98  trg.insertColumn('RUNNUM','unsigned int')
99  trg.insertColumn('CMSLSNUM','unsigned int')
100  trg.insertColumn('BITNUM','unsigned int')
101  trg.insertColumn('BITNAME','string')
102  trg.insertColumn('TRGCOUNT','unsigned int')
103  trg.insertColumn('DEADTIME','unsigned long long')
104  trg.insertColumn('PRESCALE','unsigned int')
105 
106  trg.setNotNullConstraint('RUNNUM',True)
107  trg.setNotNullConstraint('CMSLSNUM',True)
108  trg.setNotNullConstraint('BITNUM',True)
109  trg.setNotNullConstraint('BITNAME',True)
110  trg.setNotNullConstraint('TRGCOUNT',True)
111  trg.setNotNullConstraint('DEADTIME',True)
112  trg.setNotNullConstraint('PRESCALE',True)
113  trg.setPrimaryKey('TRG_ID')
114  trg.createIndex('trg_runnum',('RUNNUM'))
115 
116  db.createTable(trg,True)
117  #hlt table
118  hlt=coral.TableDescription()
119  hlt.setName( nameDealer.hltTableName() )
120  hlt.insertColumn( 'HLT_ID','unsigned long long')
121  hlt.insertColumn( 'RUNNUM','unsigned int')
122  hlt.insertColumn( 'CMSLSNUM','unsigned int')
123  hlt.insertColumn( 'PATHNAME','string')
124  hlt.insertColumn( 'INPUTCOUNT','unsigned int')
125  hlt.insertColumn( 'ACCEPTCOUNT','unsigned int')
126  hlt.insertColumn( 'PRESCALE','unsigned int')
127  hlt.setPrimaryKey( 'HLT_ID' )
128  hlt.setNotNullConstraint('RUNNUM',True)
129  hlt.setNotNullConstraint('CMSLSNUM',True)
130  hlt.setNotNullConstraint('PATHNAME',True)
131  hlt.setNotNullConstraint('INPUTCOUNT',True)
132  hlt.setNotNullConstraint('ACCEPTCOUNT',True)
133  hlt.setNotNullConstraint('PRESCALE',True)
134  hlt.createIndex('hlt_runnum',('RUNNUM'))
135  db.createTable(hlt,True)
136  #trghlt map table
137  trghlt=coral.TableDescription()
138  trghlt.setName( nameDealer.trghltMapTableName() )
139  #trghlt.insertColumn( 'RUNNUM','unsigned int' )
140  trghlt.insertColumn( 'HLTKEY','string' )
141  trghlt.insertColumn( 'HLTPATHNAME','string' )
142  trghlt.insertColumn( 'L1SEED','string' )
143  trghlt.setNotNullConstraint('HLTKEY',True)
144  trghlt.setNotNullConstraint('HLTPATHNAME',True)
145  trghlt.setNotNullConstraint('L1SEED',True)
146  db.createTable(trghlt,False)
147  #lumiresult table
148  lumiresult=coral.TableDescription()
149  lumiresult.setName( nameDealer.lumiresultTableName() )
150  lumiresult.insertColumn( 'RUNNUM','unsigned int' )
151  lumiresult.insertColumn( 'LUMIVERSION','string' )
152  lumiresult.insertColumn( 'DELIVEREDLUMI','float' )
153  lumiresult.insertColumn( 'RECORDEDLUMI','float' )
154  db.createTable(lumiresult,False)
155  #lumihltresult table
156  lumihltresult=coral.TableDescription()
157  lumihltresult.setName( nameDealer.lumihltresultTableName() )
158  lumihltresult.insertColumn( 'RUNNUM','unsigned int' )
159  lumihltresult.insertColumn( 'LUMIVERSION','string' )
160  lumihltresult.insertColumn( 'HLTPATH','float' )
161  lumihltresult.insertColumn( 'RECORDEDLUMI','float' )
162  db.createTable(lumihltresult,False)
163 
164  #lumivalidation table
165  lumivalidation=coral.TableDescription()
166  lumivalidation.setName( nameDealer.lumivalidationTableName() )
167  lumivalidation.insertColumn( 'RUNNUM','unsigned int' )
168  lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' )
169  lumivalidation.insertColumn( 'FLAG','string' )
170  lumivalidation.insertColumn( 'COMMENT','string' )
171  lumivalidation.setPrimaryKey(('RUNNUM','CMSLSNUM'))
172  lumivalidation.setNotNullConstraint('FLAG',True)
173 
174  db.createTable(lumivalidation,False)
175  dbsession.transaction().commit()
Definition: start.py:1
def lumivalidationTableName
Definition: nameDealer.py:85
def lumisummaryTableName
Definition: nameDealer.py:25
def trghltMapTableName
Definition: nameDealer.py:76
def hltTableName
Definition: nameDealer.py:55
def lumiresultTableName
Definition: nameDealer.py:79
def lumidetailTableName
Definition: nameDealer.py:34
def createLumi
Definition: lumiSchema.py:7
def lumihltresultTableName
Definition: nameDealer.py:82
def trgTableName
Definition: nameDealer.py:52
def cmsrunsummaryTableName
Definition: nameDealer.py:16
def lumiSchema.createValidation (   dbsession)
lumivalidation table

Definition at line 176 of file lumiSchema.py.

References nameDealer.lumivalidationTableName().

Referenced by main().

177 def createValidation(dbsession):
178  '''
179  lumivalidation table
180  '''
181  dbsession.transaction().start(False)
182  schema=dbsession.nominalSchema()
183  db=dbUtil.dbUtil(schema)
184  lumivalidation=coral.TableDescription()
185  lumivalidation.setName( nameDealer.lumivalidationTableName() )
186  lumivalidation.insertColumn( 'RUNNUM','unsigned int' )
187  lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' )
188  lumivalidation.insertColumn( 'FLAG','string' )
189  lumivalidation.insertColumn( 'COMMENT','string' )
190  lumivalidation.setPrimaryKey(('RUNNUM','CMSLSNUM'))
191  lumivalidation.setNotNullConstraint('FLAG',True)
192  db.createTable(lumivalidation,False)
193  dbsession.transaction().commit()
def createValidation
Definition: lumiSchema.py:176
Definition: start.py:1
def lumivalidationTableName
Definition: nameDealer.py:85
def lumiSchema.describeLumi (   dbsession)

Definition at line 210 of file lumiSchema.py.

Referenced by main().

211 def describeLumi(dbsession):
212  print 'lumi db schema dump...'
213  dbsession.transaction().start(True)
214  schema=dbsession.nominalSchema()
215  db=dbUtil.dbUtil(schema)
216  db.describeSchema()
217  dbsession.transaction().commit()
Definition: start.py:1
def describeLumi
Definition: lumiSchema.py:210
def lumiSchema.dropIndex (   dbsession)

Definition at line 226 of file lumiSchema.py.

References nameDealer.hltTableName(), nameDealer.lumisummaryTableName(), and nameDealer.trgTableName().

Referenced by main().

227 def dropIndex(dbsession):
228  dbsession.transaction().start(False)
229  schema=dbsession.nominalSchema()
230  schema.tableHandle( nameDealer.lumisummaryTableName() ).schemaEditor().dropIndex('lumisummary_runnum')
231  schema.tableHandle( nameDealer.trgTableName() ).schemaEditor().dropIndex('trg_runnum')
232  schema.tableHandle( nameDealer.hltTableName() ).schemaEditor().dropIndex('hlt_runnum')
233  dbsession.transaction().commit()
Definition: start.py:1
def lumisummaryTableName
Definition: nameDealer.py:25
def hltTableName
Definition: nameDealer.py:55
def dropIndex
Definition: lumiSchema.py:226
def trgTableName
Definition: nameDealer.py:52
def lumiSchema.dropLumi (   dbsession)

Definition at line 194 of file lumiSchema.py.

References nameDealer.cmsrunsummaryTableName(), nameDealer.hltTableName(), nameDealer.lumidetailTableName(), nameDealer.lumihltresultTableName(), nameDealer.lumiresultTableName(), nameDealer.lumisummaryTableName(), nameDealer.lumivalidationTableName(), nameDealer.trghltMapTableName(), and nameDealer.trgTableName().

Referenced by main().

195 def dropLumi(dbsession):
196  print 'droping lumi db schema...'
197  dbsession.transaction().start(False)
198  schema=dbsession.nominalSchema()
199  db=dbUtil.dbUtil(schema)
200  db.dropTable( nameDealer.lumidetailTableName() )
201  db.dropTable( nameDealer.cmsrunsummaryTableName() )
202  db.dropTable( nameDealer.lumisummaryTableName() )
203  db.dropTable( nameDealer.trgTableName() )
204  db.dropTable( nameDealer.hltTableName() )
205  db.dropTable( nameDealer.trghltMapTableName() )
206  db.dropTable( nameDealer.lumiresultTableName() )
207  db.dropTable( nameDealer.lumihltresultTableName() )
208  db.dropTable( nameDealer.lumivalidationTableName() )
209  dbsession.transaction().commit()
Definition: start.py:1
def lumivalidationTableName
Definition: nameDealer.py:85
def lumisummaryTableName
Definition: nameDealer.py:25
def trghltMapTableName
Definition: nameDealer.py:76
def hltTableName
Definition: nameDealer.py:55
def dropLumi
Definition: lumiSchema.py:194
def lumiresultTableName
Definition: nameDealer.py:79
def lumidetailTableName
Definition: nameDealer.py:34
def lumihltresultTableName
Definition: nameDealer.py:82
def trgTableName
Definition: nameDealer.py:52
def cmsrunsummaryTableName
Definition: nameDealer.py:16
def lumiSchema.main ( )

Definition at line 234 of file lumiSchema.py.

References createIndex(), createLumi(), createValidation(), describeLumi(), dropIndex(), and dropLumi().

235 def main():
236  parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description="Lumi DB schema operations.")
237  # add the arguments
238  parser.add_argument('-c',dest='connect',action='store',required=True,help='connect string to lumiDB')
239  parser.add_argument('-P',dest='authpath',action='store',help='path to authentication file')
240  parser.add_argument('action',choices=['create','drop','describe','addindex','dropindex'],help='action on the schema')
241  parser.add_argument('--validationTab',dest='validationTab',action='store_true',help='validation table only')
242  parser.add_argument('--verbose',dest='verbose',action='store_true',help='verbose')
243  parser.add_argument('--debug',dest='debug',action='store_true',help='debug mode')
244  # parse arguments
245  args=parser.parse_args()
246  connectstring=args.connect
247  if args.debug:
248  msg=coral.MessageStream('')
249  msg.setMsgVerbosity(coral.message_Level_Debug)
250  svc = coral.ConnectionService()
251  if args.authpath and len(args.authpath)!=0:
252  os.environ['CORAL_AUTH_PATH']=args.authpath
253  session=svc.connect(connectstring,accessMode=coral.access_Update)
254  if args.action == 'create':
255  if args.validationTab:
256  createValidation(session)
257  else:
258  createLumi(session)
259  if args.action == 'drop':
260  dropLumi(session)
261  if args.action == 'describe':
262  describeLumi(session)
263  if args.action == 'addindex':
264  createIndex(session)
265  if args.action == 'dropindex':
266  dropIndex(session)
267  if args.verbose :
print 'verbose mode'
def createValidation
Definition: lumiSchema.py:176
def dropLumi
Definition: lumiSchema.py:194
def createLumi
Definition: lumiSchema.py:7
def createIndex
Definition: lumiSchema.py:218
def describeLumi
Definition: lumiSchema.py:210
def dropIndex
Definition: lumiSchema.py:226

Variable Documentation

string lumiSchema.VERSION = '2.00'

Definition at line 2 of file lumiSchema.py.