From 52b868ed4904d5c34597f2bebca02f931d33b9ae Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 16 Jul 2024 15:48:49 +0200 Subject: [PATCH 1/2] Also check dataset.deleted when determining if data can be displayed 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. --- lib/galaxy/datatypes/interval.py | 3 ++- lib/galaxy/datatypes/protocols.py | 5 +++++ lib/galaxy/datatypes/tabular.py | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/datatypes/interval.py b/lib/galaxy/datatypes/interval.py index 923be082b95d..c681dafb8c1c 100644 --- a/lib/galaxy/datatypes/interval.py +++ b/lib/galaxy/datatypes/interval.py @@ -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 diff --git a/lib/galaxy/datatypes/protocols.py b/lib/galaxy/datatypes/protocols.py index 5bc07c20c9f2..ac4e3de166ca 100644 --- a/lib/galaxy/datatypes/protocols.py +++ b/lib/galaxy/datatypes/protocols.py @@ -16,6 +16,10 @@ class HasCreatingJob(Protocol): def creating_job(self): ... +class HasDeleted(Protocol): + deleted: bool + + class HasExt(Protocol): @property def ext(self): ... @@ -55,6 +59,7 @@ class HasExtraFilesAndMetadata(HasExtraFilesPath, HasMetadata, Protocol): ... class DatasetProtocol( HasCreatingJob, + HasDeleted, HasExt, HasExtraFilesPath, HasFileName, diff --git a/lib/galaxy/datatypes/tabular.py b/lib/galaxy/datatypes/tabular.py index 8bfde1202c31..d55b31fc1fc8 100644 --- a/lib/galaxy/datatypes/tabular.py +++ b/lib/galaxy/datatypes/tabular.py @@ -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 From 38859d9db8be114a3c1a3a1262e541c55a332aef Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 16 Jul 2024 17:28:08 +0200 Subject: [PATCH 2/2] Simplify and fix `useDatatypesMapper` The problem was that we'd immediately return if `createMapper` had previously been called in another calling stack. I think we don't need to do any error handling here, and the loading state can simply be `datatypesMapperStore.loading`. Fixes https://github.com/galaxyproject/galaxy/issues/18549 --- client/src/composables/datatypesMapper.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/client/src/composables/datatypesMapper.ts b/client/src/composables/datatypesMapper.ts index 706381102ea5..28b2551b08c2 100644 --- a/client/src/composables/datatypesMapper.ts +++ b/client/src/composables/datatypesMapper.ts @@ -11,19 +11,11 @@ export function useDatatypesMapper() { const datatypes: Ref = ref([]); async function getDatatypesMapper() { - try { - await datatypesMapperStore.createMapper(); - datatypesMapper.value = datatypesMapperStore.datatypesMapper; - if (datatypesMapperStore.datatypesMapper) { - datatypes.value = datatypesMapperStore.datatypesMapper.datatypes; - } - } catch (e) { - console.error("unable to create datatypes mapper\n", e); - } finally { - datatypesMapperLoading.value = false; - } - if (!datatypesMapperStore.datatypesMapper) { - throw Error("Error creating datatypesMapper"); + await datatypesMapperStore.createMapper(); + datatypesMapperLoading.value = datatypesMapperStore.loading; + datatypesMapper.value = datatypesMapperStore.datatypesMapper; + if (datatypesMapperStore.datatypesMapper) { + datatypes.value = datatypesMapperStore.datatypesMapper.datatypes; } }