CMS 3D CMS Logo

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.

00219                           :
00220     dbsession.transaction().start(False)
00221     schema=dbsession.nominalSchema()
00222     schema.tableHandle( nameDealer.lumisummaryTableName() ).schemaEditor().createIndex('lumisummary_runnum',('RUNNUM'))
00223     schema.tableHandle( nameDealer.trgTableName() ).schemaEditor().createIndex('trg_runnum',('RUNNUM'))
00224     schema.tableHandle( nameDealer.hltTableName() ).schemaEditor().createIndex('hlt_runnum',('RUNNUM'))
00225     dbsession.transaction().commit()
    
def lumiSchema::createLumi (   dbsession)

Definition at line 7 of file lumiSchema.py.

00008                          :
00009     print 'creating lumi db schema...'
00010     dbsession.transaction().start(False)
00011     schema=dbsession.nominalSchema()
00012     db=dbUtil.dbUtil(schema)
00013     #cms run summary table
00014     
00015     cmsrunsummary=coral.TableDescription()
00016     cmsrunsummary.setName( nameDealer.cmsrunsummaryTableName() )
00017     cmsrunsummary.insertColumn('RUNNUM','unsigned int')
00018     cmsrunsummary.insertColumn('HLTKEY','string')
00019     cmsrunsummary.insertColumn('FILLNUM','unsigned int')
00020     cmsrunsummary.insertColumn('SEQUENCE','string')
00021     cmsrunsummary.insertColumn('STARTTIME','time stamp',6)
00022     cmsrunsummary.insertColumn('STOPTIME','time stamp',6)
00023     cmsrunsummary.setPrimaryKey('RUNNUM')
00024     cmsrunsummary.setNotNullConstraint('HLTKEY',True)
00025     cmsrunsummary.setNotNullConstraint('FILLNUM',True)
00026     cmsrunsummary.setNotNullConstraint('SEQUENCE',True)
00027     cmsrunsummary.createIndex('cmsrunsummary_fillnum',('FILLNUM'))
00028     cmsrunsummary.createIndex('cmsrunsummary_startime',('STARTTIME'))
00029     db.createTable(cmsrunsummary,False)
00030 
00031     #lumi summary table
00032     summary=coral.TableDescription()
00033     summary.setName( nameDealer.lumisummaryTableName() )
00034     summary.insertColumn('LUMISUMMARY_ID','unsigned long long')
00035     summary.insertColumn('RUNNUM','unsigned int')
00036     summary.insertColumn('CMSLSNUM','unsigned int')
00037     summary.insertColumn('LUMILSNUM','unsigned int')
00038     summary.insertColumn('LUMIVERSION','string')
00039     summary.insertColumn('DTNORM','float')
00040     summary.insertColumn('LHCNORM','float')
00041     summary.insertColumn('INSTLUMI','float')
00042     summary.insertColumn('INSTLUMIERROR','float')
00043     summary.insertColumn('INSTLUMIQUALITY','short')
00044     summary.insertColumn('CMSALIVE','short')
00045     summary.insertColumn('STARTORBIT','unsigned int')
00046     summary.insertColumn('NUMORBIT','unsigned int')
00047     summary.insertColumn('LUMISECTIONQUALITY','short')
00048     summary.insertColumn('BEAMENERGY','float')
00049     summary.insertColumn('BEAMSTATUS','string')
00050     summary.insertColumn('CMSBXINDEXBLOB','blob')
00051     summary.insertColumn('BEAMINTENSITYBLOB_1','blob')
00052     summary.insertColumn('BEAMINTENSITYBLOB_2','blob')
00053          
00054     summary.setPrimaryKey('LUMISUMMARY_ID')
00055     summary.setNotNullConstraint('RUNNUM',True)
00056     summary.setNotNullConstraint('CMSLSNUM',True)
00057     summary.setNotNullConstraint('LUMILSNUM',True)
00058     summary.setNotNullConstraint('LUMIVERSION',True)
00059     summary.setNotNullConstraint('DTNORM',True)
00060     summary.setNotNullConstraint('LHCNORM',True)
00061     summary.setNotNullConstraint('INSTLUMI',True)
00062     summary.setNotNullConstraint('INSTLUMIERROR',True)
00063     summary.setNotNullConstraint('INSTLUMIQUALITY',True)
00064     summary.setNotNullConstraint('CMSALIVE',True)
00065     summary.setNotNullConstraint('STARTORBIT',True)
00066     summary.setNotNullConstraint('NUMORBIT',True)
00067     summary.setNotNullConstraint('LUMISECTIONQUALITY',True)
00068     summary.setNotNullConstraint('BEAMENERGY',True)
00069     summary.setNotNullConstraint('BEAMSTATUS',True)
00070 
00071     summary.setUniqueConstraint(('RUNNUM','LUMIVERSION','LUMILSNUM'))
00072     summary.createIndex('lumisummary_runnum',('RUNNUM'))
00073     
00074     db.createTable(summary,True)
00075     #lumi detail table
00076     detail=coral.TableDescription()
00077     detail.setName( nameDealer.lumidetailTableName() )
00078     detail.insertColumn('LUMIDETAIL_ID','unsigned long long')
00079     detail.insertColumn('LUMISUMMARY_ID','unsigned long long')
00080     detail.insertColumn('BXLUMIVALUE','blob')
00081     detail.insertColumn('BXLUMIERROR','blob')
00082     detail.insertColumn('BXLUMIQUALITY','blob')
00083     detail.insertColumn('ALGONAME','string')
00084     detail.setPrimaryKey('LUMIDETAIL_ID')
00085     detail.createForeignKey('DETAILSOURCE','LUMISUMMARY_ID',nameDealer.lumisummaryTableName(),'LUMISUMMARY_ID')
00086     detail.setNotNullConstraint('BXLUMIVALUE',True)
00087     detail.setNotNullConstraint('BXLUMIERROR',True)
00088     detail.setNotNullConstraint('BXLUMIQUALITY',True)
00089     detail.setNotNullConstraint('ALGONAME',True)
00090 
00091     detail.setUniqueConstraint(('LUMISUMMARY_ID','ALGONAME'))
00092 
00093     db.createTable(detail,True)
00094     #trg table
00095     trg=coral.TableDescription()
00096     trg.setName( nameDealer.trgTableName() )
00097     trg.insertColumn('TRG_ID','unsigned long long')
00098     trg.insertColumn('RUNNUM','unsigned int')
00099     trg.insertColumn('CMSLSNUM','unsigned int')
00100     trg.insertColumn('BITNUM','unsigned int')
00101     trg.insertColumn('BITNAME','string')
00102     trg.insertColumn('TRGCOUNT','unsigned int')
00103     trg.insertColumn('DEADTIME','unsigned long long')
00104     trg.insertColumn('PRESCALE','unsigned int')
00105 
00106     trg.setNotNullConstraint('RUNNUM',True)
00107     trg.setNotNullConstraint('CMSLSNUM',True)
00108     trg.setNotNullConstraint('BITNUM',True)
00109     trg.setNotNullConstraint('BITNAME',True)
00110     trg.setNotNullConstraint('TRGCOUNT',True)
00111     trg.setNotNullConstraint('DEADTIME',True)
00112     trg.setNotNullConstraint('PRESCALE',True)
00113     trg.setPrimaryKey('TRG_ID')
00114     trg.createIndex('trg_runnum',('RUNNUM'))
00115     
00116     db.createTable(trg,True)
00117     #hlt table
00118     hlt=coral.TableDescription()
00119     hlt.setName( nameDealer.hltTableName() )
00120     hlt.insertColumn( 'HLT_ID','unsigned long long')
00121     hlt.insertColumn( 'RUNNUM','unsigned int')
00122     hlt.insertColumn( 'CMSLSNUM','unsigned int')
00123     hlt.insertColumn( 'PATHNAME','string')
00124     hlt.insertColumn( 'INPUTCOUNT','unsigned int')
00125     hlt.insertColumn( 'ACCEPTCOUNT','unsigned int')
00126     hlt.insertColumn( 'PRESCALE','unsigned int')
00127     hlt.setPrimaryKey( 'HLT_ID' )
00128     hlt.setNotNullConstraint('RUNNUM',True)
00129     hlt.setNotNullConstraint('CMSLSNUM',True)
00130     hlt.setNotNullConstraint('PATHNAME',True)
00131     hlt.setNotNullConstraint('INPUTCOUNT',True)
00132     hlt.setNotNullConstraint('ACCEPTCOUNT',True)
00133     hlt.setNotNullConstraint('PRESCALE',True)
00134     hlt.createIndex('hlt_runnum',('RUNNUM'))
00135     db.createTable(hlt,True)
00136     #trghlt map table
00137     trghlt=coral.TableDescription()
00138     trghlt.setName( nameDealer.trghltMapTableName() )
00139     #trghlt.insertColumn( 'RUNNUM','unsigned int' )
00140     trghlt.insertColumn( 'HLTKEY','string' )
00141     trghlt.insertColumn( 'HLTPATHNAME','string' )
00142     trghlt.insertColumn( 'L1SEED','string' )
00143     trghlt.setNotNullConstraint('HLTKEY',True)
00144     trghlt.setNotNullConstraint('HLTPATHNAME',True)
00145     trghlt.setNotNullConstraint('L1SEED',True)
00146     db.createTable(trghlt,False)
00147     #lumiresult table
00148     lumiresult=coral.TableDescription()
00149     lumiresult.setName( nameDealer.lumiresultTableName() )
00150     lumiresult.insertColumn( 'RUNNUM','unsigned int' )
00151     lumiresult.insertColumn( 'LUMIVERSION','string' )
00152     lumiresult.insertColumn( 'DELIVEREDLUMI','float' )
00153     lumiresult.insertColumn( 'RECORDEDLUMI','float' )
00154     db.createTable(lumiresult,False)
00155     #lumihltresult table
00156     lumihltresult=coral.TableDescription()
00157     lumihltresult.setName( nameDealer.lumihltresultTableName() )
00158     lumihltresult.insertColumn( 'RUNNUM','unsigned int' )
00159     lumihltresult.insertColumn( 'LUMIVERSION','string' )
00160     lumihltresult.insertColumn( 'HLTPATH','float' )
00161     lumihltresult.insertColumn( 'RECORDEDLUMI','float' )
00162     db.createTable(lumihltresult,False)
00163     
00164     #lumivalidation table
00165     lumivalidation=coral.TableDescription()
00166     lumivalidation.setName( nameDealer.lumivalidationTableName() )
00167     lumivalidation.insertColumn( 'RUNNUM','unsigned int' )
00168     lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' )
00169     lumivalidation.insertColumn( 'FLAG','string' )
00170     lumivalidation.insertColumn( 'COMMENT','string' )
00171     lumivalidation.setPrimaryKey(('RUNNUM','CMSLSNUM'))
00172     lumivalidation.setNotNullConstraint('FLAG',True)
00173     
00174     db.createTable(lumivalidation,False)
00175     dbsession.transaction().commit()
    
def lumiSchema::createValidation (   dbsession)
lumivalidation table

Definition at line 176 of file lumiSchema.py.

00177                                :
00178     '''
00179     lumivalidation table
00180     '''
00181     dbsession.transaction().start(False)
00182     schema=dbsession.nominalSchema()
00183     db=dbUtil.dbUtil(schema)
00184     lumivalidation=coral.TableDescription()
00185     lumivalidation.setName( nameDealer.lumivalidationTableName() )
00186     lumivalidation.insertColumn( 'RUNNUM','unsigned int' )
00187     lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' )
00188     lumivalidation.insertColumn( 'FLAG','string' )
00189     lumivalidation.insertColumn( 'COMMENT','string' )
00190     lumivalidation.setPrimaryKey(('RUNNUM','CMSLSNUM'))
00191     lumivalidation.setNotNullConstraint('FLAG',True)
00192     db.createTable(lumivalidation,False)
00193     dbsession.transaction().commit()
    
def lumiSchema::describeLumi (   dbsession)

Definition at line 210 of file lumiSchema.py.

00211                            :
00212     print 'lumi db schema dump...'
00213     dbsession.transaction().start(True)
00214     schema=dbsession.nominalSchema()
00215     db=dbUtil.dbUtil(schema)
00216     db.describeSchema()
00217     dbsession.transaction().commit()

def lumiSchema::dropIndex (   dbsession)

Definition at line 226 of file lumiSchema.py.

00227                         :
00228     dbsession.transaction().start(False)
00229     schema=dbsession.nominalSchema()
00230     schema.tableHandle( nameDealer.lumisummaryTableName() ).schemaEditor().dropIndex('lumisummary_runnum')
00231     schema.tableHandle( nameDealer.trgTableName() ).schemaEditor().dropIndex('trg_runnum')
00232     schema.tableHandle( nameDealer.hltTableName() ).schemaEditor().dropIndex('hlt_runnum')
00233     dbsession.transaction().commit()
    
def lumiSchema::dropLumi (   dbsession)

Definition at line 194 of file lumiSchema.py.

00195                        :
00196     print 'droping lumi db schema...'
00197     dbsession.transaction().start(False)
00198     schema=dbsession.nominalSchema()
00199     db=dbUtil.dbUtil(schema)
00200     db.dropTable( nameDealer.lumidetailTableName() )
00201     db.dropTable( nameDealer.cmsrunsummaryTableName() )
00202     db.dropTable( nameDealer.lumisummaryTableName() )
00203     db.dropTable( nameDealer.trgTableName() )
00204     db.dropTable( nameDealer.hltTableName() )
00205     db.dropTable( nameDealer.trghltMapTableName() )
00206     db.dropTable( nameDealer.lumiresultTableName() )
00207     db.dropTable( nameDealer.lumihltresultTableName() )
00208     db.dropTable( nameDealer.lumivalidationTableName() )
00209     dbsession.transaction().commit()
    
def lumiSchema::main ( )

Definition at line 234 of file lumiSchema.py.

00235           :
00236     parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description="Lumi DB schema operations.")
00237     # add the arguments
00238     parser.add_argument('-c',dest='connect',action='store',required=True,help='connect string to lumiDB')
00239     parser.add_argument('-P',dest='authpath',action='store',help='path to authentication file')
00240     parser.add_argument('action',choices=['create','drop','describe','addindex','dropindex'],help='action on the schema')
00241     parser.add_argument('--validationTab',dest='validationTab',action='store_true',help='validation table only')
00242     parser.add_argument('--verbose',dest='verbose',action='store_true',help='verbose')
00243     parser.add_argument('--debug',dest='debug',action='store_true',help='debug mode')
00244     # parse arguments
00245     args=parser.parse_args()
00246     connectstring=args.connect
00247     if args.debug:
00248         msg=coral.MessageStream('')
00249         msg.setMsgVerbosity(coral.message_Level_Debug)
00250     svc = coral.ConnectionService()
00251     if args.authpath and len(args.authpath)!=0:
00252         os.environ['CORAL_AUTH_PATH']=args.authpath
00253     session=svc.connect(connectstring,accessMode=coral.access_Update)
00254     if args.action == 'create':
00255        if args.validationTab:
00256            createValidation(session)
00257        else:
00258            createLumi(session)
00259     if args.action == 'drop':
00260        dropLumi(session)
00261     if args.action == 'describe':
00262        describeLumi(session)
00263     if args.action == 'addindex':
00264        createIndex(session)
00265     if args.action == 'dropindex':
00266        dropIndex(session)
00267     if args.verbose :
        print 'verbose mode'

Variable Documentation

string lumiSchema::VERSION = '2.00'

Definition at line 2 of file lumiSchema.py.