CMS 3D CMS Logo

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

Functions

def commentTableName
 
def dropAllTreeTables
 
def inventoryIDTableName
 
def inventoryTableName
 
def tagInTrees
 
def treeIDTableName
 
def treeTableName
 

Variables

tuple hello = tagInTrees(session,'Tracker_Geometry_CRUZ3')
 
tuple intrees = tagInTrees(session,'Tracker_Geometry_CRUZET3')
 
tuple kitty = tagInTrees(session,'Tracker_Geometry_CRUZET3','pfnme')
 
tuple mikey = tagInTrees(session,'Tracker_Geometry_CRUZET3','frontier://(proxyurl=http://localhost:3128)(serverurl=http://frontier1.cms:8000/FrontierOnProd)(serverurl=http://frontier2.cms:8000/FrontierOnProd)(retrieve-ziplevel=0)/CMS_COND_20X_ALIGNMENT')
 
tuple session
 
tuple svc = coral.ConnectionService()
 

Function Documentation

def python.CommonUtils.commentTableName ( )

Definition at line 10 of file CommonUtils.py.

10 
11 def commentTableName():
12  return 'ENTRYCOMMENT_TABLE'
def python.CommonUtils.dropAllTreeTables (   dbsession)
drop all tagtree related tables

Definition at line 14 of file CommonUtils.py.

14 
15 def dropAllTreeTables(dbsession):
16  """drop all tagtree related tables
17  """
18  try:
19  dbsession.transaction().start(False)
20  tablelist = dbsession.nominalSchema().listTables()
21  for tname in tablelist:
22  if tname.find('TAGTREE_') != -1:
23  dbsession.nominalSchema().dropTable(tname)
24  dbsession.transaction().commit()
25  except Exception, e:
26  raise Exception, str(e)
Definition: start.py:1
def python.CommonUtils.inventoryIDTableName ( )

Definition at line 4 of file CommonUtils.py.

4 
return 'TAGINVENTORY_IDS'
def python.CommonUtils.inventoryTableName ( )

Definition at line 2 of file CommonUtils.py.

Referenced by python.CommonUtils.tagInTrees().

2 
return 'TAGINVENTORY_TABLE'
def python.CommonUtils.tagInTrees (   dbsession,
  tagname,
  pfn = '' 
)
returns the tree names which contain the given tag
   select tagid from taginventory_table where tagname=tagname
   select count(*) from tablename where tablename.tagid=tagid

Definition at line 27 of file CommonUtils.py.

References python.multivaluedict.append(), data, and python.CommonUtils.inventoryTableName().

27 
28 def tagInTrees(dbsession,tagname,pfn=''):
29  """returns the tree names which contain the given tag
30  select tagid from taginventory_table where tagname=tagname
31  select count(*) from tablename where tablename.tagid=tagid
32  """
33  try:
34  dbsession.transaction().start(True)
35  invquery = dbsession.nominalSchema().tableHandle(inventoryTableName()).newQuery()
36  conditionbindDict=coral.AttributeList()
37  conditionbindDict.extend('tagname','string')
38  conditionbindDict['tagname'].setData(tagname)
39  condition='tagname = :tagname'
40  if len(pfn) !=0 :
41  condition+=' AND pfn = :pfn'
42  conditionbindDict.extend('pfn','string')
43  conditionbindDict['pfn'].setData(pfn)
44  invquery.setCondition(condition,conditionbindDict)
45  invquery.addToOutputList('tagid')
46  invquery.addToOutputList('pfn')
47  cursor = invquery.execute()
48  tagidmap={}
49  while ( cursor.next() ):
50  tagid=cursor.currentRow()['tagid'].data()
51  pfn=cursor.currentRow()['pfn'].data()
52  tagidmap[pfn]=tagid
53  cursor.close()
54  dbsession.transaction().commit()
55  del invquery
56  if len(tagidmap)==0:
57  return tagidmap
58 
59  result={}
60  treetablelist=[]
61  dbsession.transaction().start(True)
62  tablelist = dbsession.nominalSchema().listTables()
63  for t in tablelist:
64  if t.find('TAGTREE_TABLE_')!= -1:
65  treetablelist.append(t)
66  for (pfn,tagid) in tagidmap.items():
67  result[pfn]=[]
68  condition='tagid = :tagid'
69  for t in treetablelist:
70  conditionBind=coral.AttributeList()
71  conditionBind.extend('tagid','unsigned long')
72  conditionBind['tagid'].setData(tagid)
73  q=dbsession.nominalSchema().tableHandle(t).newQuery()
74  q.addToOutputList('count(*)','count')
75  myresult=coral.AttributeList()
76  myresult.extend('count','unsigned long')
77  q.defineOutput(myresult)
78  q.setCondition(condition,conditionBind)
79  cr=q.execute()
80  while (cr.next()):
81  if cr.currentRow()['count'].data()!=0:
82  result[pfn].append(t[len('TAGTREE_TABLE_'):])
83  cr.close()
84  del q
85  dbsession.transaction().commit()
86  return result
87  except Exception, e:
88  raise Exception, str(e)
Definition: start.py:1
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def python.CommonUtils.treeIDTableName (   treename)

Definition at line 8 of file CommonUtils.py.

8 
9 def treeIDTableName(treename):
return 'TAGTREE_'+str.upper(treename)+'_IDS'
def python.CommonUtils.treeTableName (   treename)

Definition at line 6 of file CommonUtils.py.

6 
7 def treeTableName(treename):
return 'TAGTREE_TABLE_'+str.upper(treename)

Variable Documentation

tuple python.CommonUtils.hello = tagInTrees(session,'Tracker_Geometry_CRUZ3')

Definition at line 100 of file CommonUtils.py.

tuple python.CommonUtils.intrees = tagInTrees(session,'Tracker_Geometry_CRUZET3')

Definition at line 97 of file CommonUtils.py.

tuple python.CommonUtils.kitty = tagInTrees(session,'Tracker_Geometry_CRUZET3','pfnme')

Definition at line 103 of file CommonUtils.py.

tuple python.CommonUtils.mikey = tagInTrees(session,'Tracker_Geometry_CRUZET3','frontier://(proxyurl=http://localhost:3128)(serverurl=http://frontier1.cms:8000/FrontierOnProd)(serverurl=http://frontier2.cms:8000/FrontierOnProd)(retrieve-ziplevel=0)/CMS_COND_20X_ALIGNMENT')

Definition at line 106 of file CommonUtils.py.

tuple python.CommonUtils.session
Initial value:
1 = svc.connect( 'sqlite_file:testInventory.db',
2  accessMode = coral.access_Update )

Definition at line 93 of file CommonUtils.py.

Referenced by LumiProducer.beginRun(), ora::SchemaUtils.cleanUp(), RPCDBCom.connect(), TestBase.connect(), ora::ConnectionPool.connect(), popcon::L1RPCHwConfigSourceHandler.ConnectOnlineDB(), popcon::RPCEMapSourceHandler.ConnectOnlineDB(), RPCFw.createFEB(), RPCFw.createGAS(), RPCFw.createIDMAP(), RPCFw.createIMON(), RPCFw.createMix(), cond::CredentialStore.createSchema(), RPCFw.createSTATUS(), RPCFw.createT(), RPCFw.createUXC(), RPCFw.createVMON(), lumi::service::DBService.disconnect(), popcon::L1RPCHwConfigSourceHandler.DisconnectOnlineDB(), popcon::RPCEMapSourceHandler.DisconnectOnlineDB(), cond::CredentialStore.drop(), L1TriggerScalerRead.dropTable(), WriteDQMSummaryIntoOMDS.dropTable(), WriteDQMSummaryIntoOMDS.dropView(), cond::CredentialStore.exportAll(), DIPLumiProducer.filldetailcache(), ExpressLumiProducer.fillLSCache(), LumiProducer.fillLSCache(), LumiCorrectionSource.fillparamcache(), DIPLumiProducer.fillsummarycache(), CondDBESSource.fillTagCollectionFromGT(), HcalO2OManager.getListOfPoolIovs(), HcalO2OManager.getListOfPoolTags(), FillInfoPopConSourceHandler.getNewObjects(), cond::RDBMS.globalTag(), cond::CredentialStore.importForPrincipal(), cond::CredentialStore.installAdmin(), cond::CredentialStore.listConnections(), cond::CredentialStore.listPrincipals(), cond::Utilities.newDbSession(), l1t::DataWriter.payloadToken(), L1RCTOmdsFedVectorProducer.produce(), DQMSummaryReader.readData(), RunInfoRead.readData(), RunSummaryRead.readData(), L1TriggerScalerRead.readData(), popcon::RPCEMapSourceHandler.readEMap1(), popcon::L1RPCHwConfigSourceHandler.readHwConfig1(), l1t::DataWriter.readObject(), cond::CredentialStore.removeConnection(), cond::CredentialStore.removePrincipal(), lumi::CMSRunSummaryDummy2DB.retrieveData(), lumi::HLTDummy2DB.retrieveData(), lumi::HLTConfDummy2DB.retrieveData(), lumi::TRGDummy2DB.retrieveData(), lumi::LumiDummy2DB.retrieveData(), lumi::Lumi2DB.retrieveData(), l1t::WriterProxyT< Record, Type >.save(), cond::CredentialStore.selectForUser(), cond::CredentialStore.selectPermissions(), cond::CredentialStore.setPermission(), cond::CredentialStore.unsetPermission(), cond::CredentialStore.updateConnection(), cond::CredentialStore.updatePrincipal(), WriteDQMSummaryIntoOMDS.writeData(), and l1t::DataWriter.writeKeyList().

tuple python.CommonUtils.svc = coral.ConnectionService()

Definition at line 92 of file CommonUtils.py.

Referenced by lumi::CMSRunSummaryDummy2DB.retrieveData(), lumi::HLTDummy2DB.retrieveData(), lumi::HLTConfDummy2DB.retrieveData(), lumi::TRGDummy2DB.retrieveData(), lumi::LumiDummy2DB.retrieveData(), lumi::TRGWBM2DB.retrieveData(), lumi::HLTConf2DB.retrieveData(), lumi::Lumi2DB.retrieveData(), lumi::TRGScalers2DB.retrieveData(), lumi::HLTV32DB.retrieveData(), and lumi::CMSRunSummary2DB.retrieveData().