bihealth / sodar-server

SODAR: System for Omics Data Access and Retrieval
https://github.com/bihealth/sodar-server
MIT License
14 stars 3 forks source link

Return proper REST API view status codes for project lock exceptions #1847

Closed mikkonie closed 1 month ago

mikkonie commented 11 months ago

It seems we raise the same locking exception in TaskflowAPI.run_flow() regardless whether the lock is active or if there's an unexpected problem, such as the Redis server being misconfigured or unavailable.

This is a problem because in e.g. ZoneSubmitMoveAPIView, we should return a different status based on what type of locking exception was encountered. The response should be 503 if the project is simply locked, or 500 if e.g. a Redis error occurs. Right now, we return APIException with the status of 500 in any case.

As this is a slightly breaking change for the REST API, I'm tentatively setting this for the v1.0 milestone.

This is related to #1842 and #1844.

mikkonie commented 1 month ago

Done, albeit with a somewhat ugly hack. Exception handling in taskflow should be improved in the future, see #1505.