diff --git a/CHANGELOG.md b/CHANGELOG.md index 83f716322..44589726c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## Unreleased + +### Improvements +- Improve parsing OME TIFF channel names ([806](../../pull/806)) +- Improve handling when a file vanishes ([807](../../pull/807)) + ## Version 1.12.0 ### Features diff --git a/girder/girder_large_image/models/image_item.py b/girder/girder_large_image/models/image_item.py index ab2993530..7f6e835b3 100644 --- a/girder/girder_large_image/models/image_item.py +++ b/girder/girder_large_image/models/image_item.py @@ -220,13 +220,23 @@ def _loadTileSource(cls, item, **kwargs): # First try to use the tilesource we recorded as the preferred one. # This is faster than trying to find the best source each time. tileSource = girder_tilesource.AvailableGirderTileSources[sourceName](item, **kwargs) - except TileSourceError: + except TileSourceError as exc: # We could try any source # tileSource = girder_tilesource.getGirderTileSource(item, **kwargs) # but, instead, log that the original source no longer works are # reraise the exception logger.warning('The original tile source for item %s is not working' % item['_id']) - raise + try: + file = File().load(item['largeImage']['fileId'], force=True) + localPath = File().getLocalFilePath(file) + open(localPath, 'rb').read(1) + except IOError: + logger.warning( + 'Is the original data reachable and readable (it fails via %r)?', localPath) + raise IOError(localPath) from None + except Exception: + pass + raise exc return tileSource def getMetadata(self, item, **kwargs): diff --git a/girder/girder_large_image/web_client/package.json b/girder/girder_large_image/web_client/package.json index 993a0799a..c72aec026 100644 --- a/girder/girder_large_image/web_client/package.json +++ b/girder/girder_large_image/web_client/package.json @@ -177,7 +177,6 @@ "eslint-plugin-node": "^9.1.0", "eslint-plugin-promise": "^4.1.1", "eslint-plugin-standard": "^4.0.0", - "eslint-plugin-underscore": "0.0.10", "@girder/pug-lint-config": "^3.0.0-rc1", "pug-lint": "^2.6.0", "stylint": "^1.5.9" diff --git a/girder_annotation/girder_large_image_annotation/web_client/package.json b/girder_annotation/girder_large_image_annotation/web_client/package.json index 244c0a3fe..f9b89760e 100644 --- a/girder_annotation/girder_large_image_annotation/web_client/package.json +++ b/girder_annotation/girder_large_image_annotation/web_client/package.json @@ -174,7 +174,6 @@ "eslint-plugin-node": "^9.1.0", "eslint-plugin-promise": "^4.1.1", "eslint-plugin-standard": "^4.0.0", - "eslint-plugin-underscore": "0.0.10", "@girder/pug-lint-config": "^3.0.0-rc1", "pug-lint": "^2.6.0", "stylint": "^1.5.9" diff --git a/large_image/cache_util/cache.py b/large_image/cache_util/cache.py index 9c9bf6d36..790071061 100644 --- a/large_image/cache_util/cache.py +++ b/large_image/cache_util/cache.py @@ -191,10 +191,13 @@ def __call__(cls, *args, **kwargs): # noqa - N805 pass try: instance = super().__call__(*args, **kwargs) - except Exception: + except Exception as exc: with cacheLock: - del cache[key] - raise + try: + del cache[key] + except Exception: + pass + raise exc instance._classkey = key with cacheLock: cache[key] = instance diff --git a/utilities/converter/large_image_converter/__init__.py b/utilities/converter/large_image_converter/__init__.py index 860a2e775..53f045d30 100644 --- a/utilities/converter/large_image_converter/__init__.py +++ b/utilities/converter/large_image_converter/__init__.py @@ -738,7 +738,15 @@ def _is_multiframe(path): :returns: True if multiframe. """ _import_pyvips() - image = pyvips.Image.new_from_file(path) + try: + image = pyvips.Image.new_from_file(path) + except Exception: + try: + open(path, 'rb').read(1) + raise + except Exception: + logger.warning('Is the file reachable and readable? (%r)', path) + raise IOError(path) from None pages = 1 if 'n-pages' in image.get_fields(): pages = image.get_value('n-pages')