ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.LumiDBCache.LumiDBCache Class Reference
Collaboration diagram for python.LumiDBCache.LumiDBCache:

Public Member Functions

def __init__ (self, dbstr=None, folderstr=None)
 
def clearValidity (self)
 
def setValidity (self, obj)
 
def isValid (self, time)
 
def getPayload (self, time)
 

Public Attributes

 reader
 
 validStartTime
 
 validEndTime
 
 payload
 

Detailed Description

Definition at line 17 of file LumiDBCache.py.

Constructor & Destructor Documentation

◆ __init__()

def python.LumiDBCache.LumiDBCache.__init__ (   self,
  dbstr = None,
  folderstr = None 
)

Definition at line 19 of file LumiDBCache.py.

19  def __init__(self, dbstr=None, folderstr=None):
20 
21  self.reader = CoolDataReader(dbstr, folderstr)
22  self.clearValidity()
23 

Member Function Documentation

◆ clearValidity()

def python.LumiDBCache.LumiDBCache.clearValidity (   self)

Definition at line 24 of file LumiDBCache.py.

24  def clearValidity(self):
25 
26  self.validStartTime = cool.ValidityKeyMax
27  self.validEndTime = cool.ValidityKeyMin
28  self.payload = None
29 

◆ getPayload()

def python.LumiDBCache.LumiDBCache.getPayload (   self,
  time 
)

Definition at line 38 of file LumiDBCache.py.

38  def getPayload(self, time):
39 
40  # Is existing version valid?
41  if self.isValid(time):
42  return self.payload
43 
44  # Nope, invalidate cache
45  self.clearValidity()
46 
47  # Check if we already have the pre-fetched in the reader
48  for obj in self.reader.data:
49  if not obj.since() <= time < obj.until(): continue
50  self.setValidity(obj)
51 
52  # Did we find it?
53  if self.isValid(time):
54  return self.payload
55 
56  # Guess not, try reading directly from DB
57  self.reader.setIOVRange(time, time)
58  self.reader.readData()
59 
60  # Try once more to find the object
61  for obj in self.reader.data:
62  if not obj.since() <= time < obj.until(): continue
63  self.setValidity(obj)
64 
65  # Did we find it?
66  if self.isValid(time):
67  return self.payload
68 
69  return None
70 

◆ isValid()

def python.LumiDBCache.LumiDBCache.isValid (   self,
  time 
)

Definition at line 35 of file LumiDBCache.py.

35  def isValid(self, time):
36  return (self.validStartTime <= time < self.validEndTime)
37 

◆ setValidity()

def python.LumiDBCache.LumiDBCache.setValidity (   self,
  obj 
)

Definition at line 30 of file LumiDBCache.py.

30  def setValidity(self, obj):
31  self.validStartTime = obj.since()
32  self.validEndTime = obj.until()
33  self.payload = obj.payload()
34 

Member Data Documentation

◆ payload

python.LumiDBCache.LumiDBCache.payload

Definition at line 28 of file LumiDBCache.py.

◆ reader

python.LumiDBCache.LumiDBCache.reader

Definition at line 21 of file LumiDBCache.py.

◆ validEndTime

python.LumiDBCache.LumiDBCache.validEndTime

Definition at line 27 of file LumiDBCache.py.

◆ validStartTime

python.LumiDBCache.LumiDBCache.validStartTime

Definition at line 26 of file LumiDBCache.py.


The documentation for this class was generated from the following file:
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:214
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18