Skip to content

Commit

Permalink
Also check dataset.deleted when determining if data can be displayed
Browse files Browse the repository at this point in the history
This is being called when serialing HDAs in the poller if the HDA is
expaneded.
When we purge via celery we set the HDA to deleted, flush and purge
async, so it is possible that the async task removes the dataset from
disk while the ORM object in the poller still is in non-purged state.

I think this fixes
https://sentry.galaxyproject.org/share/issue/0ae7a9d9ad564054bd11c9a43aa6994c/:
```
FileNotFoundError: [Errno 2] No such file or directory: ''
  File "galaxy/datatypes/interval.py", line 914, in get_estimated_display_viewport
    with compression_utils.get_fileobj(dataset.get_file_name()) as fh:
  File "galaxy/util/compression_utils.py", line 79, in get_fileobj
    return get_fileobj_raw(filename, mode, compressed_formats)[1]
  File "galaxy/util/compression_utils.py", line 139, in get_fileobj_raw
    return compressed_format, open(filename, mode, encoding="utf-8")
```
The error occurred at the same second as the last update to the
history_dataset_association.
  • Loading branch information
mvdbeek committed Jul 16, 2024
1 parent dc0ffcd commit 52b868e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/galaxy/datatypes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ def set_meta(
def displayable(self, dataset: DatasetProtocol) -> bool:
try:
return (
not dataset.dataset.purged
not dataset.deleted
and not dataset.dataset.purged
and dataset.has_data()
and dataset.state == dataset.states.OK
and dataset.metadata.columns > 0
Expand Down
5 changes: 5 additions & 0 deletions lib/galaxy/datatypes/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class HasCreatingJob(Protocol):
def creating_job(self): ...


class HasDeleted(Protocol):
deleted: bool


class HasExt(Protocol):
@property
def ext(self): ...
Expand Down Expand Up @@ -55,6 +59,7 @@ class HasExtraFilesAndMetadata(HasExtraFilesPath, HasMetadata, Protocol): ...

class DatasetProtocol(
HasCreatingJob,
HasDeleted,
HasExt,
HasExtraFilesPath,
HasFileName,
Expand Down
3 changes: 2 additions & 1 deletion lib/galaxy/datatypes/tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
def displayable(self, dataset: DatasetProtocol) -> bool:
try:
return (
not dataset.dataset.purged
not dataset.deleted
and not dataset.dataset.purged
and dataset.has_data()
and dataset.state == dataset.states.OK
and dataset.metadata.columns > 0
Expand Down

0 comments on commit 52b868e

Please sign in to comment.