Skip to content

Commit

Permalink
Merge pull request #18559 from mvdbeek/dataset_new_check
Browse files Browse the repository at this point in the history
[24.1] Also fail ``ensure_dataset_on_disk`` if dataset is in new state
  • Loading branch information
mvdbeek authored Jul 18, 2024
2 parents e4a5eef + 95965de commit 20cc846
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/galaxy/managers/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,16 @@ def serialize_dataset_association_roles(self, trans, dataset_assoc):

def ensure_dataset_on_disk(self, trans, dataset):
# Not a guarantee data is really present, but excludes a lot of expected cases
if not dataset.dataset:
raise exceptions.InternalServerError("Item has no associated dataset.")
if dataset.purged or dataset.dataset.purged:
raise exceptions.ItemDeletionException("The dataset you are attempting to view has been purged.")
elif dataset.deleted and not (trans.user_is_admin or self.is_owner(dataset, trans.get_user())):
raise exceptions.ItemDeletionException("The dataset you are attempting to view has been deleted.")
elif dataset.state == Dataset.states.UPLOAD:
raise exceptions.Conflict("Please wait until this dataset finishes uploading before attempting to view it.")
elif dataset.state == Dataset.states.NEW:
raise exceptions.Conflict("The dataset you are attempting to view is new and has no data.")
elif dataset.state == Dataset.states.DISCARDED:
raise exceptions.ItemDeletionException("The dataset you are attempting to view has been discarded.")
elif dataset.state == Dataset.states.DEFERRED:
Expand Down

0 comments on commit 20cc846

Please sign in to comment.