pyobs / pyobs-core

Core packages for pyobs
Other
10 stars 3 forks source link

Added exception handler image processor decorator #328

Open GermanHydrogen opened 8 months ago

GermanHydrogen commented 8 months ago

This is an alternative suggestion to implementing the exception handling in the image processor base class. Doing this in the base class would introduce two new attributes suppress_exception: bool which toggles the exception handling and error_header: Optional[str] which defines the error header flat. This introduces the problem that the error_header attribute can be set without the suppress_exception attribute being true, which could lead to errors in config management. The alternative decorator approach removes the need for the first attribute. A config with this could look like this


[...]
pipeline:

  - class: pyobs.images.processors.detection.SepSourceDetection
  - class: pyobs.image.processors.ExceptionHandler
      processor:
        class: pyobs.images.processors.astrometry.AstrometryDotNet
          url: ...
          radius: 5
      error_header: "WCSERR"
[...]

I'm open to feedback.

thusser commented 8 months ago

Hmm, not a bad idea... But that moves error handling in the config file, which I find weird... The config also gets a lot more complex with this. What about adding that functionality to the ImageProcessor base class?