Skip to content

Commit

Permalink
Do not track private object sources in quota source mapping
Browse files Browse the repository at this point in the history
Uploading a dataset to a private object store will not be counted
against the default quota source now.
  • Loading branch information
davelopez committed Dec 16, 2024
1 parent 9c29c90 commit 9debd5d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/galaxy/objectstore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9debd5d

Please # to comment.