DiamondLightSource / mx-bluesky

Bluesky plans, plan stubs, and utilities for MX beamlines
https://diamondlightsource.github.io/mx-bluesky/
Apache License 2.0
0 stars 2 forks source link

Pin too long/short should be logged as warn, not error #427

Open DominicOram opened 1 year ago

DominicOram commented 1 year ago

Currently when the pin is too long/short this gets logged into graylog as an error, not a warning (e.g. level 3). This makes it harder to see legitimate errors in the logs. They should be warnings.

rtuck99 commented 9 months ago

Not sure where this warning vs error level issue is coming from exactly - the code in main.py in hyperion is already logging this inside wait_on_queue() as a warning.

               except WarningException as exception:
                    hyperion.log.LOGGER.warning("Warning Exception", exc_info=True)
                    self.current_status = ErrorStatusAndMessage(exception)

Also the code in GDA in hyperion_full_grid_scan.py wait_for_hyperion_to_finish seems to just log this as a plain message with no exception info

                    if response["exception_type"] in HYPERION_WARN_EXCEPTIONS:
                        self.update("Warning from Hyperion: %s" % (response["message"]))

So possibly this issue is already fixed?

dperl-dls commented 9 months ago

These do somehow end up as errors in graylog - should double check

DominicOram commented 9 months ago

This is still happening, see for example https://graylog2.diamond.ac.uk/messages/logs_8509/bde69790-87cf-11ee-873a-1866dafae8e4. I think this is fundamentally because bluesky treats all exceptions as errors and logs them as such. We might be able to fix this with some contingency wrapper stuff but maybe it's hinting that exceptions for flow control are bad? Either way bigger than a good first issue and not high priority so I'm going to unassign people and move it back into the backlog

DominicOram commented 6 months ago

Would using a StopIteration instead make the RE not treat it as an error?