From 212f73ba08ce251ac490df241c7e11ab43fa3555 Mon Sep 17 00:00:00 2001 From: Radu Carpa Date: Fri, 24 Nov 2023 17:04:54 +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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/rucio/core/rse.py b/lib/rucio/core/rse.py index 4b47d22f47..e9d5d6005b 100644 --- a/lib/rucio/core/rse.py +++ b/lib/rucio/core/rse.py @@ -29,7 +29,7 @@ from rucio.common import exception, utils from rucio.common.cache import make_region_memcached -from rucio.common.config import get_lfn2pfn_algorithm_default, config_get_bool +from rucio.common.config import get_lfn2pfn_algorithm_default from rucio.common import types from rucio.common.utils import CHECKSUM_KEY, GLOBALLY_SUPPORTED_CHECKSUMS, Availability from rucio.core.rse_counter import add_counter, get_counter @@ -159,8 +159,7 @@ 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: + if len(rse_id_to_data) < 4: # 4 was selected without particular reason as "seems good enough" for rse_data in rse_id_to_data.values(): rse_data.ensure_loaded( load_name=load_name, @@ -224,7 +223,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 +280,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]):