DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
rename_duplicate_dals.DalCollector Class Reference

Public Member Functions

 __init__ (self, List[Configuration] configs)
 
 commit (self)
 
int __len__ (self)
 
DalGroup __getitem__ (self, int idx)
 

Public Attributes

 configs = configs
 
dict trees = {c: RelationshipCache(c) for c in configs}
 
list groups = [g for g in groups if len(g) > 1]
 

Detailed Description

Loads all configurations and finds duplicate DAL objects across them.

Definition at line 218 of file rename_duplicate_dals.py.

Constructor & Destructor Documentation

◆ __init__()

rename_duplicate_dals.DalCollector.__init__ ( self,
List[Configuration] configs )

Definition at line 221 of file rename_duplicate_dals.py.

221 def __init__(self, configs: List[Configuration]):
222 self.configs = configs
223
224 console.print("[blue]Building configuration trees…[/]")
225 self.trees = {c: RelationshipCache(c) for c in configs}
226
227 # Group all (dal, config) pairs by DAL repr
228 grouped: Dict[str, List[tuple]] = defaultdict(list)
229 for config in configs:
230 for dal in config.get_all_dals().values():
231 grouped[repr(dal)].append((dal, config))
232
233 # Keep only groups with more than one unique member
234 groups = [DalGroup(pairs, self.trees) for pairs in grouped.values()]
235 self.groups = [g for g in groups if len(g) > 1]
236
237 if self.groups:
238 self.groups = sort_groups_by_depth(self.groups, self.trees)
239

Member Function Documentation

◆ __getitem__()

DalGroup rename_duplicate_dals.DalCollector.__getitem__ ( self,
int idx )

Definition at line 247 of file rename_duplicate_dals.py.

247 def __getitem__(self, idx: int) -> DalGroup:
248 return self.groups[idx]
249
250
251# ----- CLI -----
252

◆ __len__()

int rename_duplicate_dals.DalCollector.__len__ ( self)

Definition at line 244 of file rename_duplicate_dals.py.

244 def __len__(self) -> int:
245 return len(self.groups)
246

◆ commit()

rename_duplicate_dals.DalCollector.commit ( self)

Definition at line 240 of file rename_duplicate_dals.py.

240 def commit(self):
241 for config in self.configs:
242 config.commit()
243

Member Data Documentation

◆ configs

rename_duplicate_dals.DalCollector.configs = configs

Definition at line 222 of file rename_duplicate_dals.py.

◆ groups

rename_duplicate_dals.DalCollector.groups = [g for g in groups if len(g) > 1]

Definition at line 235 of file rename_duplicate_dals.py.

◆ trees

dict rename_duplicate_dals.DalCollector.trees = {c: RelationshipCache(c) for c in configs}

Definition at line 225 of file rename_duplicate_dals.py.


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