Skip to content

Commit

Permalink
[WIP] Implement quota tracking options per ObjectStore.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Sep 25, 2020
1 parent 8509c32 commit b42fda2
Show file tree
Hide file tree
Showing 19 changed files with 831 additions and 170 deletions.
8 changes: 6 additions & 2 deletions lib/galaxy/jobs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1722,13 +1722,17 @@ def fail():
tool=self.tool, stdout=job.stdout, stderr=job.stderr)

collected_bytes = 0
quota_source_info = None
# Once datasets are collected, set the total dataset size (includes extra files)
for dataset_assoc in job.output_datasets:
if not dataset_assoc.dataset.dataset.purged:
# assume all datasets in a job get written to the same objectstore
quota_source_info = dataset_assoc.dataset.dataset.quota_source_info
collected_bytes += dataset_assoc.dataset.set_total_size()

if job.user:
job.user.adjust_total_disk_usage(collected_bytes)
user = job.user
if user and collected_bytes > 0 and quota_source_info is not None and quota_source_info.use:
user.adjust_total_disk_usage(collected_bytes, quota_source_info.label)

# Empirically, we need to update job.user and
# job.workflow_invocation_step.workflow_invocation in separate
Expand Down
5 changes: 3 additions & 2 deletions lib/galaxy/managers/hdas.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ def purge(self, hda, flush=True):
quota_amount_reduction = hda.quota_amount(user)
super().purge(hda, flush=flush)
# decrease the user's space used
if quota_amount_reduction:
user.adjust_total_disk_usage(-quota_amount_reduction)
quota_source_info = hda.dataset.quota_source_info
if quota_amount_reduction and quota_source_info.use:
user.adjust_total_disk_usage(-quota_amount_reduction, quota_source_info.label)
return hda

# .... states
Expand Down
Loading

0 comments on commit b42fda2

Please sign in to comment.