pytorch/serve

Custom Exceptions Are Ignored By Workflow

Open

#2,456 创建于 2023年7月11日

在 GitHub 查看
 (0 评论) (3 反应) (0 负责人)Java (3,844 star) (790 fork)batch import
help wantedtriagedworkflowx

描述

I have a workflow and defined custom exceptions in model handlers for error handling. For an example exception, I have got desired error response when I send request directly to the model in the workflow, using API predictions/workflowName__modelName. The problem is when sending to workflow, exception code and message replaced with fixed code, which is 500, and message: "Error executing ModelName". How can I configure workflow to make it return the same exception that the model raises.

What I implemented in model handler: "download".

try:
    _, image_file = get_image_from_url(url)
except Exception as e:
    raise PredictionException(f'Error downloading image. Error: {e}.', 501)

What I got from requesting directly to the model (predictions/workflowName__download). This is what I want to see when I requested to workflow.

{
    "code": 501,
    "type": "InternalServerException",
    "message": "Error downloading image. Error: Not Found Image URL https://example_url"
}

What workflow returns.

{
    "code": 500,
    "type": "InternalServerException",
    "message": "Error executing download"
}

贡献者指南

Custom Exceptions Are Ignored By Workflow · pytorch/serve#2456 | Good First Issue