diff --git a/src/DIRAC/ConfigurationSystem/Client/Helpers/Resources.py b/src/DIRAC/ConfigurationSystem/Client/Helpers/Resources.py index 5da01db8321..7039091feb1 100644 --- a/src/DIRAC/ConfigurationSystem/Client/Helpers/Resources.py +++ b/src/DIRAC/ConfigurationSystem/Client/Helpers/Resources.py @@ -200,29 +200,31 @@ def getSiteGrid(site): def getQueue(site, ce, queue): """Get parameters of the specified queue""" grid = site.split(".")[0] + + # Get CE parameters result = gConfig.getOptionsDict(f"/Resources/Sites/{grid}/{site}/CEs/{ce}") if not result["OK"]: return result - resultDict = result["Value"] + ceDict = result["Value"] + + tags = set(fromChar(ceDict.get("Tag")) or []) + requiredTags = set(fromChar(ceDict.get("RequiredTag")) or []) - # Get queue defaults + # Get queue parameters result = gConfig.getOptionsDict(f"/Resources/Sites/{grid}/{site}/CEs/{ce}/Queues/{queue}") if not result["OK"]: return result - resultDict.update(result["Value"]) - - # Handle tag lists for the queue - for tagFieldName in ("Tag", "RequiredTag"): - tags = [] - ceTags = resultDict.get(tagFieldName) - if ceTags: - tags = fromChar(ceTags) - queueTags = resultDict.get(tagFieldName) - if queueTags: - queueTags = fromChar(queueTags) - tags = list(set(tags + queueTags)) - if tags: - resultDict[tagFieldName] = tags + queueDict = result["Value"] + + # Union the sets to combine tags and required tags from CE and queue + tags = tags.union(set(fromChar(queueDict.get("Tag")) or [])) + requiredTags = requiredTags.union(set(fromChar(queueDict.get("RequiredTag")) or [])) + + resultDict = {**ceDict, **queueDict} + if tags: + resultDict["Tag"] = list(tags) + if requiredTags: + resultDict["RequiredTag"] = list(requiredTags) resultDict["Queue"] = queue return S_OK(resultDict) diff --git a/src/DIRAC/ConfigurationSystem/Client/Helpers/test/Test_Helpers.py b/src/DIRAC/ConfigurationSystem/Client/Helpers/test/Test_Helpers.py index 59d304f7ca9..6a60f64006c 100644 --- a/src/DIRAC/ConfigurationSystem/Client/Helpers/test/Test_Helpers.py +++ b/src/DIRAC/ConfigurationSystem/Client/Helpers/test/Test_Helpers.py @@ -200,5 +200,5 @@ def test_getQueue(): "LocalCEType": "Pool/Singularity", "OS": "linux_AlmaLinux_9.4.2104", } - + assert sorted(result["Value"].pop("Tag")) == sorted(expectedDict.pop("Tag")) assert result["Value"] == expectedDict