From 8bef42f3634ec5fd10b2a647ab89a2b82144341f Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Mon, 16 Dec 2024 17:34:51 +0100 Subject: [PATCH] Do not track private object sources in quota source mapping --- lib/galaxy/objectstore/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/objectstore/__init__.py b/lib/galaxy/objectstore/__init__.py index 4a4d639bf927..063bf8447d0e 100644 --- a/lib/galaxy/objectstore/__init__.py +++ b/lib/galaxy/objectstore/__init__.py @@ -1756,12 +1756,16 @@ def __init__(self, source=DEFAULT_QUOTA_SOURCE, enabled=DEFAULT_QUOTA_ENABLED): self.default_quota_source = source self.default_quota_enabled = enabled self.info = QuotaSourceInfo(self.default_quota_source, self.default_quota_enabled) + # Private sources are provided by the user and the quota is not tracked + self.private_source_info = QuotaSourceInfo(label=None, use=False) self.backends = {} self._labels = None - def get_quota_source_info(self, object_store_id): + def get_quota_source_info(self, object_store_id: Optional[str]) -> QuotaSourceInfo: if object_store_id in self.backends: return self.backends[object_store_id].get_quota_source_info(object_store_id) + elif self._is_private_source(object_store_id): + return self.private_source_info else: return self.info @@ -1809,6 +1813,9 @@ def ids_per_quota_source(self, include_default_quota_source=False): quota_sources[quota_source_label].append(object_id) return quota_sources + def _is_private_source(self, object_store_id: Optional[str]) -> bool: + return object_store_id is not None and object_store_id.startswith("user_objects://") + class ObjectCreationProblem(Exception): pass