예제 #1
0
 def __set_init_time__(self, utcDatetime):
     """
     Configure the initialization time,
     depends on the value of self.IntitialTime
     Default: using the lower between the proposed time and the current time
     'Now' : use the higher between the current time and the proposed time
     dateime : use this datetime
     """
     #default situation
     if self.getProp("InitialTime").lower()=="safe" or not len(self.getProp("InitialTime")):
         #default situation
         utcDatetime = min(datetime.utcnow(), utcDatetime)
     elif self.getProp("InitialTime").lower()=="now":
         #Moore!
         utcDatetime = max(datetime.utcnow(), utcDatetime)
     else:
         raise TypeError("DDDBConf.InitialTime, I don't have a good way to convert "+self.getProp("InitialTime")+" to a datetime, please use 'Now' or 'Safe'")
     from Configurables import EventClockSvc
     ecs = EventClockSvc()
     # do not overwrite already set values
     if not ecs.isPropertySet("InitialTime"):
         dt = utcDatetime - datetime(1970, 1, 1, 0)
         ns = (dt.days * 24 * 60 * 60 + dt.seconds) * 1000000000
         ecs.InitialTime = ns
     else:
         t = datetime(1970, 1, 1, 0) + timedelta(seconds=ecs.InitialTime/1000000000)
         log.warning("EventClockSvc().InitialTime already set to %s UTC (requested %s UTC)",
                     t.isoformat(), utcDatetime.isoformat())
예제 #2
0
 def defineDB(self):
     # Delegate handling of properties to DDDBConf
     self.setOtherProps(DDDBConf(), ["Simulation", "DataType"])
     # Set CondDB tags if given, otherwise use default defined in DDDBConf
     from Configurables import CondDB
     if hasattr(self, "DDDBtag"):
         CondDB().Tags["DDDB"] = self.getProp("DDDBtag")
     if hasattr(self, "CondDBtag"):
         CondDB().Tags["LHCBCOND"] = self.getProp("CondDBtag")
         CondDB().Tags["SIMCOND"] = self.getProp("CondDBtag")
     if hasattr(self, "DQFLAGStag"):
         CondDB().Tags["DQFLAGS"] = self.getProp("DQFLAGStag")
     # Set up a time decoder for real data (Simulation uses FakeEventTime)
     if not self.getProp("Simulation"):
         from Configurables import EventClockSvc
         ecs = EventClockSvc()
         # do not overwrite already set values
         if not ecs.isPropertySet("EventTimeDecoder"):
             ecs.EventTimeDecoder = "OdinTimeDecoder"