def get_rses_with_attribute(key): """ Return all RSEs with a certain attribute. :param key: The key for the attribute. :returns: List of rse dictionaries """ return rse_module.get_rses_with_attribute(key=key)
def get_rses_with_attribute(key, session=None): """ Return all RSEs with a certain attribute. :param key: The key for the attribute. :param session: The database session in use. :returns: List of rse dictionaries """ return rse_module.get_rses_with_attribute(key=key, session=session)
def resolve_elements(self, session): """ Inherited from :py:func:`BaseExpressionElement.resolve_elements` """ rse_list = get_rses_with_attribute(key=self.key, session=session) if not rse_list: return (set(), {}) output = [] rse_dict = {} for rse in rse_list: try: if float(get_rse_attribute(key=self.key, rse_id=rse['id'], session=session)[0]) > float(self.value): rse_dict[rse['id']] = rse output.append(rse['id']) except ValueError: continue return (set(output), rse_dict)