def get_hdbpp_databases(active=True): #archivers=[],dbs={}): """ Method to obtain list of dbs/archivers; it allows to match any archiver list against existing dbs. This method can be used in cached mode executed like: dbs = get_hdbpp_databases() for a in archivers: db = get_hdbpp_databases(a,dbs).keys()[0] """ schemas = pta.Schemas.load() hdbpp = sorted(k for k in schemas if fn.clsearch('hdbpp', str(schemas[k]))) if active: r = [] for h in hdbpp: try: if fn.check_device(pta.api(h).manager): r.append(h) except: pass return r else: return hdbpp
def apply_search(self): signs = "==|=|<|>" txt = str(self.search.text() or '*') if fandango.clsearch(signs, txt): t = fandango.re.split(signs, txt, 1)[0] txt, formula = t, txt.replace(t, '') else: formula = '' txt = txt.replace(' ', '*').strip() txt = self.preffix + txt + self.suffix model = fandango.get_matching_attributes(txt) if self.labels and '/' in txt: dev, attr = txt.rsplit('/', 1) model.extend( fandango.tango.get_matching_device_attribute_labels( dev, attr).keys()) if formula and model: nm = [] for m in model: try: f = '%s %s' % (fandango.read_attribute(m), formula) if eval(f): nm.append(m) except: pass model = nm self.form.setModel(model)
def get_partition_time_by_name(self, partition): m = fn.clsearch('[0-9].*', partition) if m: d = fn.str2time(m.group(), cad='%Y%m%d') return d else: return fn.END_OF_TIME
def get_all_databases(regexp='*'): """ Return all registered HDB++ databases """ managers = HDBpp.get_all_managers() dbs = [HDBpp.get_db_config(m) for m in managers] dbs = [d for d in dbs if fn.clsearch(regexp, str(d))] return [t[0] for t in dbs]
def get_all_databases(regexp='*'): """ Return all registered HDB++ databases """ managers = HDBpp.get_all_managers() dbs = [HDBpp.get_db_config(m) for m in managers] dbs = [d for d in dbs if fn.clsearch(regexp,str(d))] return [t[0] for t in dbs]
def get_archived_attributes(self, search=''): #print('get_archived_attributes(%s)'%str(search)) attrs = [] archs = get_device_property(self.manager, 'ArchiverList') #self.get_manager().ArchiverList self.get_archivers_attributes(archs, full=False, from_db=False) for d, dattrs in self.dedicated.items(): for a in dattrs: self.attributes[a].archiver = d if not search or fn.clsearch(search, a): attrs.append(a) return attrs
def get_attribute_indexes(self, table): index = None if fn.isSequence(table): aid, tid, table = table else: if '[' in table: try: index = int(fn.clsearch('\[([0-9]+)\]', table).groups()[0]) table = table.split('[')[0] except: pass aid, tid, table = self.get_attr_id_type_table(table) return aid, tid, table, index
def get_archived_attributes(self,search=''): """ It gets attributes currently assigned to archiver and updates internal attribute/archiver index. DONT USE Manager.AttributeSearch, it is limited to 1024 attrs! """ #print('get_archived_attributes(%s)'%str(search)) attrs = [] [self.get_archiver_attributes(d,from_db=True) for d in self.get_archivers()] for d,dattrs in self.dedicated.items(): for a in dattrs: self.attributes[a].archiver = d if not search or fn.clsearch(search,a): attrs.append(a) return attrs
def get_subscribed_attributes(self, search=''): """ It gets attributes currently assigned to subscribers and updates internal attribute/archiver index. DONT USE Manager.AttributeSearch, it is limited to 1024 attrs! """ #print('get_archived_attributes(%s)'%str(search)) attrs = [] self.get_att_conf_table() [ self.get_archiver_attributes(d, from_db=True) for d in self.get_subscribers() ] for d, dattrs in self.dedicated.items(): for a in dattrs: if a not in self.attributes: self.get_attr_id_type_table(a) self.attributes[a].archiver = d if not search or fn.clsearch(search, a): attrs.append(a) return attrs