pytorch/serve

Custom Exceptions Are Ignored By Workflow

Open

#2.456 aberto em 11 de jul. de 2023

Ver no GitHub
 (0 comments) (3 reactions) (0 assignees)Java (790 forks)batch import
help wantedtriagedworkflowx

Métricas do repositório

Stars
 (3.844 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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"
}

Guia do colaborador