567 def register(self, since=(MINRUN,MINLBK), tag="", chan=-1, payload=None):
568 """
569 Registers the folder in the database.
570 - since: lower limit of IOV
571 - tag : The tag to write to
572 - chan : COOL channel to write, if negative - all COOL channels are written
573 Comment channel is always written
574
575 The interpretation of the 'since' inputs depends on their type:
576 - tuple(int,int) : run and lbk number
577 """
578
579 if self.__payload is None and payload is None:
580 jdata = {}
581 for drawerIdx,blob in self.__drawerBlob.items():
582 if chan<0 or drawerIdx==chan or drawerIdx==1000:
583 if blob is None or blob==0:
584 b64string = ''
585 else:
586 blob.seek(0)
587 b64string = str(base64.b64encode(blob.read()), 'ascii')
588 jdata[drawerIdx] = [b64string]
589 else:
590 if payload is not None:
591 self.__payload = payload
592 jdata = self.__payload
593
594 (sinceRun, sinceLumi) = since
595
596 if not self.__db or (self.__db and self.__db.endswith('.json')):
597
598 fullTag = tag
599 if self.__folderPath and not (tag.upper().startswith('TILE') or tag.upper().startswith('CALO')):
601 fileName = f"{fullTag}.{sinceRun}.{sinceLumi}.json"
602 if self.__db:
603 fileName = f'{self.__db[:-5]}.{fileName}'
604
605 with open(fileName, 'w') as the_file:
606 json.dump(jdata, the_file)
607 the_file.write('\n')
608
609
610 self.log().info( 'Writting tag "%s"', fullTag)
611 self.log().info( '... since : [%s,%s]' , sinceRun, sinceLumi)
612 if self.__payload is None:
613 self.log().info( '... with comment field: "%s"', self.getComment())
614 self.log().info( '... into file : %s' , fileName)
615
static std::string getFullTag(const std::string &folder, const std::string &tag)
Returns the full tag string, composed of camelized folder name and tag part.