예제 #1
0
    def getGTInfo(self, GT_name): #==gName
        '''Information about GT. object/dict?'''
        
        globalTag = self.rdbms.globalTag(self.global_tag_schema, GT_name + "::All" ,"" ,"")
        #html_list       =       ['record', 'label', 'pfn', 'tag', 'lastSince','time', 'comment', 'iovlist','size','lastLogEntry' ]
        #html_content    =       []
        gt_content = {}
        current_local_time = time.strftime("%d %B, %Y %H:%M:%S", time.localtime())
        gt_content_header = {
            'GlobalTagName':GT_name,
            'creation_time':current_local_time,
            'CMSSW_VERSION':self.cmssw_version
        }
        gt_content['header'] = gt_content_header
        gt_content['body'] = []

        for tag in globalTag.elements: #element of GT. Iteration
            tag_pfn =   tag.pfn
            logger.debug("TAG_PFN" + tag_pfn)
            #because it works only in online - required update of connection
            # string for working offline
            if((tag.pfn).find('FrontierOnProd') != -1):
                tag_pfn = "frontier://PromptProd/CMS_COND"+(tag_pfn).split('/CMS_COND')[1]
                logger.debug("TAG_PFN_UPDATED" + tag_pfn)

            try:            
            	db = self.rdbms.getReadOnlyDB(tag_pfn)
            	log = db.lastLogEntry(tag.tag)
            	iovlist = []
                db.startReadOnlyTransaction()
                iov = db.iov(tag.tag)
                db.commitTransaction()
            except:
                print "Something wrong"
                continue #TODO review

            timeVal = str(time.asctime(time.gmtime(condDB.unpackTime(iov.timestamp())[0])))
            timeVal = time.strftime("%d %b %Y %H:%M",time.strptime(timeVal, "%a %b %d %H:%M:%S %Y"))

            for elem in iov.elements :
                iovlist.append((elem.since(), elem.till()))
            lastSince = iovlist[-1][0]
            #iov.tail(1)
            #for elem in iov.elements :
                #lastSince = elem.since()
            #iov.resetRange()

            gt_content_element = {'record': tag.record,'label':tag.label,'pfn':tag.pfn,'tag':tag.tag,'size':iov.size(),'time':timeVal,'comment':iov.comment(),'last_since':lastSince,'last_log_entry':log.usertext, 'iov_list':iovlist}
            gt_content['body'].append(gt_content_element)

            del iov
            del db
        return gt_content
예제 #2
0
 def __init__(self, db, tag, since=0, till=0, head=0, tail=0):
     self.__db = db
     self.__tag = tag
     self.__db.startReadOnlyTransaction()
     try:
         self.__modName = str(db.payloadModules(tag)[0])
         Plug = __import__(self.__modName)
     except RuntimeError:
         self.__modName = 0
     iov = db.iov(tag)
     #the __me data member is always an IOVRange
     #the IOVSequence is used in the ctor only
     self.__me = iov.range(iov.firstSince(), iov.lastTill())
     if (till): self.__me = iov.range(since, till)
     if (head): self.__me = iov.head(head)
     if (tail): self.__me = iov.tail(tail)
     self.__timetype = iov.timetype()
     self.__comment = iov.comment()
     self.__revision = iov.revision()
     self.__timestamp = CondDB.unpackTime(iov.timestamp())
     self.__payloadClasses = list(iov.payloadClasses())
     self.__db.commitTransaction()
예제 #3
0
 def __init__(self, db, tag, since=0, till=0, head=0, tail=0) :
     self.__db = db
     self.__tag = tag
     self.__db.startReadOnlyTransaction()
     try : 
         self.__modName = str(db.payloadModules(tag)[0])
         Plug = __import__(self.__modName)
     except RuntimeError :
         self.__modName = 0
     iov = db.iov(tag)
     #the __me data member is always an IOVRange
     #the IOVSequence is used in the ctor only
     self.__me = iov.range(iov.firstSince(), iov.lastTill())
     if (till) : self.__me = iov.range(since,till)
     if (head) : self.__me = iov.head(head)
     if (tail) : self.__me = iov.tail(tail)
     self.__timetype = iov.timetype()
     self.__comment = iov.comment()
     self.__revision = iov.revision()
     self.__timestamp = CondDB.unpackTime(iov.timestamp())
     self.__payloadClasses = list(iov.payloadClasses())
     self.__db.commitTransaction()
예제 #4
0
    def getGTInfo(self, GT_name):  #==gName
        '''Information about GT. object/dict?'''

        globalTag = self.rdbms.globalTag(self.global_tag_schema,
                                         GT_name + "::All", "", "")
        #html_list       =       ['record', 'label', 'pfn', 'tag', 'lastSince','time', 'comment', 'iovlist','size','lastLogEntry' ]
        #html_content    =       []
        gt_content = {}
        current_local_time = time.strftime("%d %B, %Y %H:%M:%S",
                                           time.localtime())
        gt_content_header = {
            'GlobalTagName': GT_name,
            'creation_time': current_local_time,
            'CMSSW_VERSION': self.cmssw_version
        }
        gt_content['header'] = gt_content_header
        gt_content['body'] = []

        for tag in globalTag.elements:  #element of GT. Iteration
            tag_pfn = tag.pfn
            logger.debug("TAG_PFN" + tag_pfn)
            #because it works only in online - required update of connection
            # string for working offline
            if ((tag.pfn).find('FrontierOnProd') != -1):
                tag_pfn = "frontier://PromptProd/CMS_COND" + (
                    tag_pfn).split('/CMS_COND')[1]
                logger.debug("TAG_PFN_UPDATED" + tag_pfn)

            try:
                db = self.rdbms.getReadOnlyDB(tag_pfn)
                log = db.lastLogEntry(tag.tag)
                iovlist = []
                db.startReadOnlyTransaction()
                iov = db.iov(tag.tag)
                db.commitTransaction()
            except:
                print "Something wrong"
                continue  #TODO review

            timeVal = str(
                time.asctime(time.gmtime(
                    condDB.unpackTime(iov.timestamp())[0])))
            timeVal = time.strftime(
                "%d %b %Y %H:%M", time.strptime(timeVal,
                                                "%a %b %d %H:%M:%S %Y"))

            for elem in iov.elements:
                iovlist.append((elem.since(), elem.till()))
            lastSince = iovlist[-1][0]
            #iov.tail(1)
            #for elem in iov.elements :
            #lastSince = elem.since()
            #iov.resetRange()

            gt_content_element = {
                'record': tag.record,
                'label': tag.label,
                'pfn': tag.pfn,
                'tag': tag.tag,
                'size': iov.size(),
                'time': timeVal,
                'comment': iov.comment(),
                'last_since': lastSince,
                'last_log_entry': log.usertext,
                'iov_list': iovlist
            }
            gt_content['body'].append(gt_content_element)

            del iov
            del db
        return gt_content
예제 #5
0
 def timestamp(self):
     return time.asctime(
         time.gmtime(condDB.unpackTime(self._iovSequence.timestamp())[0]))
예제 #6
0
 def timestamp(self):
     return  CondDB.unpackTime(self.__me.timestamp())
예제 #7
0
 def timestamp( self ):
     return time.asctime( time.gmtime( condDB.unpackTime( self._iovSequence.timestamp() )[ 0 ] ) )