def initialize_name_mapping(self): from DQUtils.db import Databases, get_channel_ids_names f = Databases.get_folder("/TDAQ/EnabledResources/ATLAS/PIXEL/Modules", "COOLONL_TDAQ") cids, cnames, cmap = get_channel_ids_names(f) self.name_mapping = dict(zip(cids, cnames)) self.name_mapping_initialized = True
def generate_table(folder, channel, since, until): cool_folder = Databases.get_folder(folder) channelid = cool_folder.channelId(channel) cs = cool.ChannelSelection(channelid, channelid) print "Totals for channel '%s' in folder '%s'" % (channel, folder) iovs, info_runs = fetch_fixedup_folder_information(folder, since, until, cs) table = generate_lb_count_table(folder, iovs, info_runs) pprint_table(table, header_loc=2)
def test(): def filter_hello(line): if line.startswith("Data source lookup using"): return True print "Before with block.." with silence(filter_hello): from DQUtils.db import Databases f = Databases.get_folder("DQMFONL") print "Sensible stuff!" print "f =", f print "I am after the silence block"
def make_sct_mapping(): """ Generate a mapping for the channelids in /SCT/DCS/HV to DCSOFL output channel ids. The highest two bits can be used to determine the system. (see `subdets`) """ from DQUtils.db import Databases from DQUtils.channel_mapping import get_channel_ids_names f = Databases.get_folder("/SCT/DCS/HV", "COOLOFL_DCS/CONDBR2") cids, cnames, cmap = get_channel_ids_names(f) mapping = {} subdets = {0: 114, 1: 111, 2: 115} for cid in cids: # The highest-two bits of cid specify which DQ region we're in output_subdet = subdets[(cid >> 25) & 0x3] mapping.setdefault(output_subdet, []).append(cid) return mapping
db = DefectsDB(opts.db, read_only=False, tag=opts.defecttag) primary_names = DetStatusNames() with db.storage_buffer: print 'Populating old primary flags' ## for defect in primary_names.allNames(): ## #print defect ## try: ## print db.new_virtual_defect(0, defect, defect, ''), defect ## except DefectExistsError: ## if opts.ignoreold: ## print 'Defect', defect, 'already exists; ignoring' ## else: ## raise folder = Databases.get_folder(opts.origpridb, read_only=True) ids, names, cdict = get_channel_ids_names(folder) for defect in names: if defect in DEPRECATED_PRIMARY_FLAGS: print 'Skipping', defect, 'as it is deprecated' continue #print defect, folder.channelDescription(cdict[defect]) try: print db.new_virtual_defect(defect, defect, ''), defect except DefectExistsError: if opts.ignoreold: print 'Defect', defect, 'already exists; ignoring' else: raise print 'Populating old virtual flags'
def clear_lookup_line(): Databases.get_folder("SHIFTOFL") stdout.write("\x1B[A\x1B[K")