CMS 3D CMS Logo

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

Functions

def addEntry
 
def addRevision
 
def addRunToCurrentDataTag
 
def alldataTags
 
def bookNewEntry
 
def bookNewRevision
 
def branchInfoByName
 
def branchType
 
def createBranch
 
def createDataTag
 Data Tagging API. More...
 
def currentDataTag
 
def dataIdsByCurrentTag
 
def dataIdsByTagId
 
def dataIdsByTagName
 
def dataRevisionsOfEntry
 
def dataTagInfo
 
def entryInBranch
 
def getDataTagId
 
def latestDataRevisionOfEntry
 
def revisionsInBranch
 
def revisionsInBranchName
 
def revisionsInTag
 

Variables

tuple databranchinfo = (branchid,'DATA')
 
tuple datainfo = createBranch(schema,'DATA','TRUNK',comment='hold data')
 
tuple entryinfo = (revision_id,entry_id,str(runnum),data_id)
 
tuple hltentryid = entryInBranch(schema,nameDealer.hltdataTableName(),str(runnum),'DATA')
 
tuple latestrevision = latestDataRevisionOfEntry(schema,nameDealer.lumidataTableName(),lumientry_id,revlist)
 
tuple lumientry_id = entryInBranch(schema,nameDealer.lumidataTableName(),'1211','DATA')
 
tuple lumientryid = entryInBranch(schema,nameDealer.lumidataTableName(),str(runnum),'DATA')
 
string myconstr = 'sqlite_file:test.db'
 
tuple norminfo = createBranch(schema,'NORM','TRUNK',comment='hold normalization factor')
 
tuple revisioninfo = bookNewRevision( schema,nameDealer.lumidataTableName() )
 
tuple revlist = revisionsInBranchName(schema,'DATA')
 
tuple schema = session.nominalSchema()
 
tuple session = svc.openSession(isReadOnly=False,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])
 
tuple svc = sessionManager.sessionManager(myconstr,debugON=False)
 
tuple tables = lumidbDDL.createTables(schema)
 
tuple trgentryid = entryInBranch(schema,nameDealer.trgdataTableName(),str(runnum),'DATA')
 
tuple trunkinfo = createBranch(schema,'TRUNK',None,comment='main')
 

Function Documentation

def revisionDML.addEntry (   schema,
  datatableName,
  entryinfo,
  branchinfo 
)
input:
    entryinfo (revision_id(0),entry_id(1),entry_name(2),data_id(3))
    branchinfo (branch_id,branch_name)
1.allocate and insert a new revision into the revisions table
2.allocate and insert a new entry into the entry table with the new revision
3.inset into data_rev table with new data_id ,revision)id mapping

insert into revisions(revision_id,branch_id,branch_name,comment,ctime) values()
insert into datatablename_entries (entry_id,revision_id) values()
insert into datatablename_rev(data_id,revision_id) values()

Definition at line 342 of file revisionDML.py.

Referenced by CalibrationInterface< CategoryT, CalibDataT >.addCategoryDefinition(), TMom.addEntry(), and AlgorithmCalibration< T, CO >.readCategories().

def revisionDML.addRevision (   schema,
  datatableName,
  revisioninfo,
  branchinfo 
)
1.insert a new revision into the revisions table
2.insert into data_id, revision_id pair to  datatable_revmap
insert into revisions(revision_id,branch_id,branch_name,ctime) values()
insert into datatable_rev(data_id,revision_id) values())
input:
     revisioninfo (revision_id(0),data_id(1))
     branchinfo  (branch_id(0),branch_name(1))

Definition at line 394 of file revisionDML.py.

def revisionDML.addRunToCurrentDataTag (   schema,
  runnum,
  lumiid,
  trgid,
  hltid,
  lumitype = 'HF',
  comment = '' 
)
select tagid from tags
insert into tagruns(tagid,runnum,lumidataid,trgdataid,hltdataid,creationtime,comment) values(tagid,runnum,lumiid,trgid,hltid,creationtime,comment)

Definition at line 549 of file revisionDML.py.

def revisionDML.alldataTags (   schema,
  lumitype = 'HF' 
)
select tagname,tagid from tags,tagruns  
    if number of tags==1->open tag
    if tagid is max ->open tag
    for closed tag:
       max run=max(runnum) where tagid=:tagid
       min run
          select min(runnum) from tagruns where tagid<=:tagid
    for open tag:
       max run=None
       min run
          select min(runnum) from tagruns where tagid<=:tagid
output:
   {tagid:(name,minrun,maxrun,creationtime)}

Definition at line 583 of file revisionDML.py.

def revisionDML.bookNewEntry (   schema,
  datatableName 
)
allocate new revision_id,entry_id,data_id

Definition at line 316 of file revisionDML.py.

def revisionDML.bookNewRevision (   schema,
  datatableName 
)
allocate new revision_id,data_id

Definition at line 330 of file revisionDML.py.

def revisionDML.branchInfoByName (   schema,
  branchName 
)
select (revision_id,branch_id) from revisions where name=:branchName

Definition at line 282 of file revisionDML.py.

def revisionDML.branchType (   schema,
  name 
)
output: tag,branch
the difference between tag and branch: tag is an empty branch
select count(revision_id) from revisions where branch_name=:name
if >0: is real branch
else: is tag

Definition at line 112 of file revisionDML.py.

def revisionDML.createBranch (   schema,
  name,
  parentname,
  comment = '' 
)
create a new branch/tag under given parentnode
insert into revisions(revision_id,branch_id,branch_name,name,comment,ctime) values()
return (revisionid,parentid,parentname)

Definition at line 432 of file revisionDML.py.

Referenced by lumidb2Schema.createBranch().

def revisionDML.createDataTag (   schema,
  tagname,
  lumitype = 'HF' 
)

Data Tagging API.

insert into tags(tagname,tagid,creationtime) values()
output:
    tagname,tagid,creationtime

Definition at line 483 of file revisionDML.py.

def revisionDML.currentDataTag (   schema,
  lumitype = 'HF' 
)
select tagid,tagname from tags
output:(tagid,tagname)

Definition at line 513 of file revisionDML.py.

def revisionDML.dataIdsByCurrentTag (   schema,
  runlist = None,
  lumitype = 'HF' 
)
dataIdsByTagId(schema,currenttagid,runlist)
output:
   (currenttagname,{run:(lumidataid,trgdataid,hltdataid)})

Definition at line 889 of file revisionDML.py.

def revisionDML.dataIdsByTagId (   schema,
  tagid,
  runlist = None,
  withcomment = False,
  lumitype = 'HF' 
)
select runnum,lumidataid,trgdataid,hltdataid,comment from tagruns where TAGID<=:tagid;
input:
    runlist: select run list, if None, all
output:
    {run:(lumidataid,trgdataid,hltdataid,(creationtime,comment))}

Definition at line 798 of file revisionDML.py.

def revisionDML.dataIdsByTagName (   schema,
  tagname,
  runlist = None,
  withcomment = False,
  lumitype = 'HF' 
)
select tagid from tags where tagname=:tagname
input:
    runlist: select run list, if None, all
output:
    {run:(lumidataid,trgdataid,hltdataid,(creationtime,comment)}

Definition at line 689 of file revisionDML.py.

def revisionDML.dataRevisionsOfEntry (   schema,
  datatableName,
  entry,
  revrange 
)
all data version of the given entry whose revision falls in branch revision range
select d.data_id,r.revision_id from datatable d, datarevmaptable r where d.entry_id(or name )=:entry and d.data_id=r.data_id
input: if isinstance(entry,str): d.entry_name=:entry ; else d.entry_id=:entry
output: [data_id]

Definition at line 231 of file revisionDML.py.

def revisionDML.dataTagInfo (   schema,
  tagname,
  runlist = None,
  lumitype = 'HF' 
)
select tagid from tags where tagname=:tagname
select runnum,comment from tagruns where tagid<=:tagid
input:
    runlist: select run list, if None, all
output:
   {tagid:(name,minrun,maxrun,creationtime)}

Definition at line 728 of file revisionDML.py.

def revisionDML.entryInBranch (   schema,
  datatableName,
  entryname,
  branch 
)
whether an entry(by name) already exists in the given branch
select e.entry_id from entrytable e,revisiontable r where r.revision_id=e.revision_id and e.name=:entryname and r.branch_name=branchname/branch_id
input:
    if isinstance(branch,str):byname
    else: byid
output:entry_id/None

Definition at line 188 of file revisionDML.py.

def revisionDML.getDataTagId (   schema,
  tagname,
  lumitype = 'HF' 
)
select tagid from tags where tagname=:tagname

Definition at line 658 of file revisionDML.py.

def revisionDML.latestDataRevisionOfEntry (   schema,
  datatableName,
  entry,
  revrange 
)
return max(data_id) of all datarevisionofEntry

Definition at line 274 of file revisionDML.py.

def revisionDML.revisionsInBranch (   schema,
  branchid 
)
returns all revision values in a branch
result=[revision_id]
select distinct branch_id from revisions where branch_id>:branchid;
select revision_id from revisions where branch_id=:branchid ;
if the branchid matches and the revisionid is not in the branchid collection,not 0, then this revision is in the branch
require also revisionid>branchid

Definition at line 61 of file revisionDML.py.

def revisionDML.revisionsInBranchName (   schema,
  branchname 
)
returns all revisions in a branch/tag by name

Definition at line 177 of file revisionDML.py.

def revisionDML.revisionsInTag (   schema,
  tagrevisionid,
  branchid 
)
returns all revisions before tag in selected branch
select revision_id from revisions where revision_id!=0 and revision_id<tagrevisionid and branch_id=:branchid
result=[revision_id]

Definition at line 12 of file revisionDML.py.

Variable Documentation

tuple revisionDML.databranchinfo = (branchid,'DATA')

Definition at line 917 of file revisionDML.py.

tuple revisionDML.datainfo = createBranch(schema,'DATA','TRUNK',comment='hold data')

Definition at line 912 of file revisionDML.py.

tuple revisionDML.entryinfo = (revision_id,entry_id,str(runnum),data_id)

Definition at line 925 of file revisionDML.py.

tuple revisionDML.hltentryid = entryInBranch(schema,nameDealer.hltdataTableName(),str(runnum),'DATA')

Definition at line 922 of file revisionDML.py.

Definition at line 959 of file revisionDML.py.

tuple revisionDML.lumientry_id = entryInBranch(schema,nameDealer.lumidataTableName(),'1211','DATA')

Definition at line 957 of file revisionDML.py.

tuple revisionDML.lumientryid = entryInBranch(schema,nameDealer.lumidataTableName(),str(runnum),'DATA')

Definition at line 920 of file revisionDML.py.

string revisionDML.myconstr = 'sqlite_file:test.db'

Definition at line 904 of file revisionDML.py.

tuple revisionDML.norminfo = createBranch(schema,'NORM','TRUNK',comment='hold normalization factor')

Definition at line 914 of file revisionDML.py.

tuple revisionDML.revisioninfo = bookNewRevision( schema,nameDealer.lumidataTableName() )

Definition at line 929 of file revisionDML.py.

tuple revisionDML.revlist = revisionsInBranchName(schema,'DATA')

Definition at line 955 of file revisionDML.py.

tuple revisionDML.schema = session.nominalSchema()

Definition at line 907 of file revisionDML.py.

tuple revisionDML.session = svc.openSession(isReadOnly=False,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])

Definition at line 906 of file revisionDML.py.

tuple revisionDML.svc = sessionManager.sessionManager(myconstr,debugON=False)

Definition at line 905 of file revisionDML.py.

tuple revisionDML.tables = lumidbDDL.createTables(schema)

Definition at line 909 of file revisionDML.py.

tuple revisionDML.trgentryid = entryInBranch(schema,nameDealer.trgdataTableName(),str(runnum),'DATA')

Definition at line 921 of file revisionDML.py.

tuple revisionDML.trunkinfo = createBranch(schema,'TRUNK',None,comment='main')

Definition at line 910 of file revisionDML.py.