coralnet / pyspacer

Python based tools for spatial image analysis
MIT License
6 stars 2 forks source link

Raise different error class for image-download errors #50

Closed StephenChan closed 2 years ago

StephenChan commented 2 years ago

CoralNet sends admin emails whenever spacer jobs return with an error. This has included Deploy jobs where the user-provided image URL was unreachable. That is generally a user-error situation (e.g. didn't provide a public URL), not a spacer bug, so it's not particularly useful for us to get emails when that happens.

In this PR I tried to catch that particular case (without masking other types of errors) and raise a SpacerInputError when it happens. Then when CoralNet's vision backend gets a SpacerInputError back from spacer, it can realize "oh, this isn't a spacer bug, the issue was the inputs given to spacer, so I won't email the admins." I've got a CoralNet-repo PR lined up to complete that logic, though it won't actually work unless this spacer PR is merged into the master branch.

(In the meantime, I saw some assertTrue usages which seemed like they were meant to be assertEqual, so I made a second commit to change those. Let me know if I was mistaken here though.)

StephenChan commented 2 years ago

@beijbom Reminder. And the corresponding coralnet PR is here: https://github.com/beijbom/coralnet/pull/451