lablup / backend.ai

Backend.AI is a streamlined, container-based computing cluster platform that hosts popular computing/ML frameworks and diverse programming languages, with pluggable heterogeneous accelerator support including CUDA GPU, ROCm GPU, TPU, IPU and other NPUs.
https://www.backend.ai
GNU Lesser General Public License v3.0
502 stars 151 forks source link

Wrap `UnknownImageReference` as `ObjectNotFound` instead of `InternalServerError` #392

Closed achimnol closed 2 years ago

achimnol commented 2 years ago

Do what the title says in the manager's session creation routines, with sensible error messages.

studioego commented 2 years ago

Hmm, For the first time, I define UnknownImageReference exception

studioego commented 2 years ago

I have a question. I watched Manager's Exception class codes. It defines both error_type and error_title. I have no about UnknownImageReference's error_type and error_title.

Is the URL of error_type already defined? @achimnol

achimnol commented 2 years ago

I have a question. I watched Manager's Exception class codes. It defines both error_type and error_title. I have no about UnknownImageReference's error_type and error_title.

Is the URL of error_type already defined? @achimnol

Our error response in the JSON format follows the RFC 7807 style. The URLs used in the error_type field (e.g., https://api.backend.ai/probs/...) is just an arbitrary identifier and not real URLs. In the client side, it is referred to implemented error-specific display of the additional data field using suffix matches (e.g., .endswith('/invalid-api-params) in the client SDK).

There is no "big hidden" reason to choose RFC 7807, but it's just to have a commonly referrable standard which describes the background on behalf of me.

studioego commented 2 years ago

For the first time, I think that add error_type on Manager, client-py and webserver.

Error type : /unknown-image-reference Error title: Unknown Image Reference

Example of invalid-api-params codes

studioego commented 2 years ago

Ooops, I checked UnknownImageReference from backend.ai's common repo. UnknownImageReference is already defined backend.ai-common repo https://github.com/lablup/backend.ai-common/blob/0c42db25eb6650265d5aed71ed5dc597445b6fac/src/ai/backend/common/exception.py#L13 So, I changed the manager exception definition. UnknownImageReference to UnknownImageReferenceError

achimnol commented 2 years ago

Changed it to use ObjectNotFound error introduced with #378.

studioego commented 2 years ago

It is already finished. So I close the issue.