Belle II Software light-2406-ragdoll
LocalMetadataComparison Class Reference

Public Member Functions

def __init__ (self, filename, globaltag, payloads)
 
def check (self, exp, run)
 

Static Public Member Functions

def create_cpp_metadataprovider (filename, globaltags)
 

Protected Attributes

 _globaltag
 Globaltag.
 
 _payloads
 Payloads.
 
 _localpy
 Local metadata provider, python version.
 
 _localcpp
 Local metadata provider, C++ version.
 

Detailed Description

Simple class to obtain all valid payloads matching a given set of names for
a given experiment and run and compare the python and the C++
implementation.

Definition at line 21 of file local_metadata_provider.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  filename,
  globaltag,
  payloads 
)
Create the local metadata providers for the given globaltag and payload names

Definition at line 43 of file local_metadata_provider.py.

43 def __init__(self, filename, globaltag, payloads):
44 """Create the local metadata providers for the given globaltag and payload names"""
45
46 self._globaltag = globaltag
47
48 self._payloads = payloads
49
50 self._localpy = LocalMetadataProvider(filename)
51
52 self._localcpp = self.create_cpp_metadataprovider(filename, [globaltag])
53

Member Function Documentation

◆ check()

def check (   self,
  exp,
  run 
)
Check if the c++ and python version return the same payload revisions
If not raise a ValueError, if yes return the list of payloads and their
revision valid for the given exp,run

Definition at line 54 of file local_metadata_provider.py.

54 def check(self, exp, run):
55 """Check if the c++ and python version return the same payload revisions
56 If not raise a ValueError, if yes return the list of payloads and their
57 revision valid for the given exp,run"""
58 from_py = [(p.name, p.revision) for p in self._localpy.get_all_iovs(self._globaltag, exp=exp, run=run)
59 if p.name in self._payloads]
60 info = ROOT.std.vector("Belle2::Conditions::PayloadMetadata")()
61 for name in self._payloads:
62 info.push_back(Belle2.Conditions.PayloadMetadata(name, False))
63 self._localcpp.getPayloads(exp, run, info)
64 from_cpp = [(p.name, p.revision) for p in info
65 if p.revision > 0]
66 from_py.sort()
67 from_cpp.sort()
68 if from_py != from_cpp:
69 raise ValueError(f"Payloads not equal: {from_py} != {from_cpp}")
70 return from_py
71
72
Simple struct to group all information necessary for a single payload.

◆ create_cpp_metadataprovider()

def create_cpp_metadataprovider (   filename,
  globaltags 
)
static
Jump through some hoops to create a C++ instance of the local metadata
provider so that we can check the framework implementation and compare
it to the python version

Definition at line 28 of file local_metadata_provider.py.

28 def create_cpp_metadataprovider(filename, globaltags):
29 """
30 Jump through some hoops to create a C++ instance of the local metadata
31 provider so that we can check the framework implementation and compare
32 it to the python version
33 """
34 states = ROOT.std.set("string")()
35 states.insert("PUBLISHED")
36 tags = ROOT.std.vector("string")()
37 for tag in globaltags:
38 tags.push_back(tag)
39 localcpp = Belle2.Conditions.LocalMetadataProvider(filename, states)
40 localcpp.setTags(tags)
41 return localcpp
42
Class to obtain metadata of all valid payloads from a local SQLite file instead of the central server...

Member Data Documentation

◆ _globaltag

_globaltag
protected

Globaltag.

Definition at line 46 of file local_metadata_provider.py.

◆ _localcpp

_localcpp
protected

Local metadata provider, C++ version.

Definition at line 52 of file local_metadata_provider.py.

◆ _localpy

_localpy
protected

Local metadata provider, python version.

Definition at line 50 of file local_metadata_provider.py.

◆ _payloads

_payloads
protected

Payloads.

Definition at line 48 of file local_metadata_provider.py.


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