Belle II Software light-2406-ragdoll
TestingPayloadEntry Class Reference

Public Member Functions

def __init__ (self, line, basedir)
 
def normalize (self, name=None, root_version=61408)
 
def checksum (self)
 
def __repr__ (self)
 
def __eq__ (self, other)
 
def __le__ (self, other)
 
def __lt__ (self, other)
 
def __hash__ (self)
 
def iov_tuple (self)
 
def iov_str (self)
 

Public Attributes

 revision
 revision stored in the file
 
 module
 module name
 
 filename
 filename
 
 firstRun
 experiment/run of the first run
 
 finalRun
 experiment/run of the final run
 
 payload
 payload id, to be filled later
 
 iov
 iov id, to be filled later
 

Private Attributes

 __checksum
 variable for checksum, calculated on first access
 
 __id
 object to uniquely identify this entry (payload + iov)
 

Detailed Description

Class to keep information about an entry in the testing payloads storage file

Definition at line 25 of file testing_payloads.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  line,
  basedir 
)
Create new entry from line in testing payloads storage file

Definition at line 28 of file testing_payloads.py.

28 def __init__(self, line, basedir):
29 """Create new entry from line in testing payloads storage file"""
30 try:
31 name, revision, iov = line.split()
32 except ValueError:
33 raise ValueError("line must be of the form 'dbstore/<payloadname> <revision> "
34 "<firstExp>,<firstRun>,<finalExp>,<finalRun>'")
35
36
37 self.revision = revision
38
39 try:
40
41 self.module = name.split("/")[1]
42 except IndexError:
43 raise ValueError("payload name must be of the form dbstore/<payloadname>")
44
45 try:
46 iov = [int(e) for e in iov.split(",")]
47 except ValueError:
48 raise ValueError("experiment and run numbers must be integers")
49
50 if len(iov) != 4:
51 raise ValueError("IoV needs to be four values (firstExp,firstRun,finalExp,finalRun)")
52
53
54 self.filename = os.path.join(basedir, f"dbstore_{self.module}_rev_{self.revision}.root")
55
56 self.firstRun = {"exp": iov[0], "run": iov[1]}
57
58 self.finalRun = {"exp": iov[2], "run": iov[3]}
59
60 self.__checksum = None
61
62 self.__id = (self.module,) + tuple(iov)
63
64 self.payload = None
65
66 self.iov = None
67

Member Function Documentation

◆ __eq__()

def __eq__ (   self,
  other 
)
Compare to other entries, only consider package, module and iov for equality

Definition at line 84 of file testing_payloads.py.

84 def __eq__(self, other):
85 """Compare to other entries, only consider package, module and iov for equality"""
86 return self.__id == other.__id
87

◆ __hash__()

def __hash__ (   self)
Provide hash function to be able to create a set

Definition at line 96 of file testing_payloads.py.

96 def __hash__(self):
97 """Provide hash function to be able to create a set"""
98 return hash(self.__id)
99

◆ __le__()

def __le__ (   self,
  other 
)
Compare to other entries, only consider package, module and iov for equality

Definition at line 88 of file testing_payloads.py.

88 def __le__(self, other):
89 """Compare to other entries, only consider package, module and iov for equality"""
90 return self.__id <= other.__id
91

◆ __lt__()

def __lt__ (   self,
  other 
)
Compare to other entries, only consider package, module and iov for equality

Definition at line 92 of file testing_payloads.py.

92 def __lt__(self, other):
93 """Compare to other entries, only consider package, module and iov for equality"""
94 return self.__id < other.__id
95

◆ __repr__()

def __repr__ (   self)
Convert to useful string representation

Definition at line 80 of file testing_payloads.py.

80 def __repr__(self):
81 """Convert to useful string representation"""
82 return repr(self.__id + (self.filename,))
83

◆ checksum()

def checksum (   self)
Return checksum, calculated on first access

Definition at line 74 of file testing_payloads.py.

74 def checksum(self):
75 """Return checksum, calculated on first access"""
76 if self.__checksum is None:
77 self.__checksum = file_checksum(self.filename)
78 return self.__checksum
79

◆ iov_str()

def iov_str (   self)
String representation of IoV

Definition at line 105 of file testing_payloads.py.

105 def iov_str(self):
106 """String representation of IoV"""
107 return f"{self.firstRun['exp']}/{self.firstRun['run']} - {self.finalRun['exp']}/{self.finalRun['run']}"
108
109

◆ iov_tuple()

def iov_tuple (   self)
Return a tuple with the valid exp,run range

Definition at line 101 of file testing_payloads.py.

101 def iov_tuple(self):
102 """Return a tuple with the valid exp,run range"""
103 return self.firstRun['exp'], self.firstRun['run'], self.finalRun['exp'], self.finalRun['run']
104

◆ normalize()

def normalize (   self,
  name = None,
  root_version = 61408 
)
Normalize the root file to have the same checksum for the same content

Definition at line 68 of file testing_payloads.py.

68 def normalize(self, name=None, root_version=61408):
69 """Normalize the root file to have the same checksum for the same content"""
70 normalize_file(self.filename, in_place=True, name=name, root_version=root_version)
71 self.__checksum = file_checksum(self.filename)
72

Member Data Documentation

◆ __checksum

__checksum
private

variable for checksum, calculated on first access

Definition at line 60 of file testing_payloads.py.

◆ __id

__id
private

object to uniquely identify this entry (payload + iov)

Definition at line 62 of file testing_payloads.py.

◆ filename

filename

filename

Definition at line 54 of file testing_payloads.py.

◆ finalRun

finalRun

experiment/run of the final run

Definition at line 58 of file testing_payloads.py.

◆ firstRun

firstRun

experiment/run of the first run

Definition at line 56 of file testing_payloads.py.

◆ iov

iov

iov id, to be filled later

Definition at line 66 of file testing_payloads.py.

◆ module

module

module name

Definition at line 41 of file testing_payloads.py.

◆ payload

payload

payload id, to be filled later

Definition at line 64 of file testing_payloads.py.

◆ revision

revision

revision stored in the file

Definition at line 37 of file testing_payloads.py.


The documentation for this class was generated from the following file: