Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image loading error handling #474

Merged
merged 4 commits into from
May 13, 2024

Conversation

will-moore
Copy link
Member

@will-moore will-moore commented Apr 24, 2024

Fixes #473

This improves the error handling for loading image data when you first open iviewer.

Previously we only handled 404 Image not found, but if any JSON data was returned, even with exceptions, then these were ignored and the viewer would silently fail.

I have handled the possible Errors etc that are reported by the python error handling at various stages, such as ConcurrencyException and other catch-all exceptions:

Screenshot 2024-04-24 at 16 51 31

Screenshot 2024-04-24 at 16 52 33

To test, you need to generate or find broken images (or missing pyramids etc).

Most of the testing I've done has been by artificially adding errors at particular points in the python code.

The json response from imageMarshal() may contain 'Exception' message but no pixel_size
@will-moore will-moore requested a review from pwalczysko April 25, 2024 14:19
@pwalczysko
Copy link
Member

I have removed renamed a file in ManagedRepo and then opened the image in iviewer.

I get

Screenshot 2024-04-26 at 15 31 02

@pwalczysko
Copy link
Member

pwalczysko commented Apr 26, 2024

With an image without pyramids I get

Screenshot 2024-04-26 at 16 00 22

Interestingly, on Preview, there is no warning either (I realize this is for another PR) but it would be useful too, cf https://www.openmicroscopy.org/qa2/qa/feedback/41603/

if (response.ConcurrencyException) {
Ui.showModalMessage(`<p>Image is not currently viewable</p>
<pre>ConcurrencyException</pre>
<small>A pyramid of zoom levels is not available. Generation may be in progress if this is enabled on your server.</small>`, "OK");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<small>A pyramid of zoom levels is not available. Generation may be in progress if this is enabled on your server.</small>`, "OK");
<small>A pyramid of zoom levels is not available. Please contact your administrator, see https://omero.readthedocs.io/en/stable/sysadmins/limitations.html#large-images.</small>`, "OK");

I realize this ^^^ is not ideal suggestion, but I am against making of false hopes - as we do not recommend pyramid generation to be enabled, we should not assume (as the present comment does) that "waiting it out" is a good/default option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit of a side track... but those docs don't describe how to enable/disable pyramid generation. Do we have install docs that recommend and describe how to disable pyramid generation? This is likely to have an effect on how likely it is for a particular server to have pyramids disabled, since the default is still to be enabled, right?
Also those docs should mention https://www.glencoesoftware.com/products/ngff-converter/ .

Unfortunately it's not possible for a client to know if pyramids are disabled, since this gives a SecurityViolation:

conn.getConfigService().getConfigValue("omero.server.nodedescriptor")

How about.
"A pyramid of zoom levels is not available. Please contact your administrator if this does not resolve itself. See Limitations: Large Images"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property is actually "omero.server.nodedescriptors" and has been made user-visible since OMERO 5.6.6. Older versions of the server will definitely throw a SecurityViolation.

Note this is not necessarily the only way to disable the PixelData service e.g. you might have modified your templates manually but I think this is by far the option that is the most usable from an API perspective and the documentation should mostly likely document this workflow if any.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbesson Thanks for catching my typo!
When connected to nightshade I get:

>>> conn.getConfigService().getConfigValue("omero.server.nodedescriptors")
''

Which would indicate that pyramid generation is enabled there?
For outreach server I get

'master:Blitz-0,Indexer-0,Processor-0,Storm,Tables-0'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An empty value (default) means all services are enabled via configuration - see https://omero.readthedocs.io/en/stable/sysadmins/config.html#omero-server-nodedescriptors

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Since clients can access this, I'll load it from iviewer so we can show a more useful error message for ConcurrencyException. It probably makes sense that we do something similar in webclient too, but most useful would be the Importer, since you need to know at import time if you're importing a Big Image without pyramids.

@pwalczysko
Copy link
Member

How to elicit no channel data loaded error ?

Copy link
Member

@pwalczysko pwalczysko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one reformulation request and a question about testing setup, thank you

@will-moore
Copy link
Member Author

will-moore commented Apr 26, 2024

The no channel data is designed to handle the response returned from https://github.com/ome/omero-web/blob/e1b1355ebd4f9de8b855dd2c55f59d86c061a81b/omeroweb/webgateway/marshal.py#L257

The code comment says Will happen if an image has bad or missing pixel data but I don't know if that's still true or how to trigger it.
I can create that exception by adding test = "fail" + 1 into the try/except block above:

Screenshot 2024-04-26 at 17 06 27

@will-moore
Copy link
Member Author

will-moore commented Apr 29, 2024

With that last commit, we try to load the omero.server.nodedescriptors config from the server.
If we can load it and it is set and it doesn't contain "PixelData", then we know that pyramid creation is disabled and the error with ConcurrencyException should look like this (EDIT: updated to include the commit below):

Screenshot 2024-05-02 at 09 42 46

Otherwise it's probable that we can generate pyramids (unless this is disabled on an older server that doesn't allow us to query it), so we show this:

Screenshot 2024-04-29 at 16 12 40

@pwalczysko
Copy link
Member

Screenshot 2024-05-02 at 13 22 41
Screenshot 2024-05-02 at 13 02 10

With a "large" image without pyramids, I am having the two messages if pyramid gen is a) disabled (first screenshot) or b) enabled (second screenshot). Lgtm

@pwalczysko
Copy link
Member

I understand that #474 (comment) is very hard to elicit and was never encountered, actually the error is being caught for completeness sake.

Lgtm in total.

@will-moore will-moore merged commit 2ca5f15 into ome:master May 13, 2024
1 check passed
@will-moore will-moore changed the title Img data error handling Image data error handling May 13, 2024
@will-moore will-moore changed the title Image data error handling Image loading error handling May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle errors loading image metadata imgData JSON
3 participants