From 2be4b54b6717cd6939fc3bc93d00b868c3e5b656 Mon Sep 17 00:00:00 2001 From: Radu Carpa Date: Wed, 22 Nov 2023 15:25:56 +0100 Subject: [PATCH] Core & Internals: fix bulk rse loading - settings_by_id will not have any entry for RSEs which don't have attributes from RSE_SETTINGS set. This resulted in an attribute error. - name loading was getting AttributeError when some RSEs already had their name loaded. - remove code for non-temp-table workflow --- lib/rucio/core/rse.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/lib/rucio/core/rse.py b/lib/rucio/core/rse.py index 4b47d22f473..fd68243078b 100644 --- a/lib/rucio/core/rse.py +++ b/lib/rucio/core/rse.py @@ -159,20 +159,6 @@ def bulk_load(rse_id_to_data: "dict[str, RseData]", load_name=False, load_column Given a dict of RseData objects indexed by rse_id, ensure that the desired fields are initialised in all objects from the input. """ - use_temp_tables = config_get_bool('core', 'use_temp_tables', default=True, session=session) - if not use_temp_tables or len(rse_id_to_data) < 4: - for rse_data in rse_id_to_data.values(): - rse_data.ensure_loaded( - load_name=load_name, - load_columns=load_columns, - load_attributes=load_attributes, - load_info=load_info, - load_usage=load_usage, - load_limits=load_limits, - session=session - ) - return - rse_ids_to_load = set() for rse_id, rse_data in rse_id_to_data.items(): anything_to_load = any(( @@ -224,7 +210,7 @@ def bulk_load(rse_id_to_data: "dict[str, RseData]", load_name=False, load_column session=session)) for rse_id, db_rse in db_rses_by_id.items(): rse_data = rse_id_to_data[rse_id] - settings = rse_data._attributes if rse_data._attributes is not None else settings_by_id[rse_id] + settings = rse_data._attributes if rse_data._attributes is not None else settings_by_id.get(rse_id, {}) columns = _format_get_rse(db_rse=db_rse, rse_attributes=settings, session=session) rse_data._columns = columns rse_data._name = columns['rse'] @@ -281,8 +267,8 @@ def bulk_load(rse_id_to_data: "dict[str, RseData]", load_name=False, load_column if load_name: # The name could have been loaded already (when loading columns or info). Skip loading if it's known. if not load_columns and not load_info: - for rse_id, rse_data in rse_id_to_data.items(): - rse_data._name = db_rses_by_id[rse_id].rse + for rse_id in rse_ids_to_load: + rse_id_to_data[rse_id]._name = db_rses_by_id[rse_id].rse class RseCollection(Generic[T]):