pytorch/serve

Custom Exceptions Are Ignored By Workflow

Open

#2 456 ouverte le 11 juil. 2023

Voir sur GitHub
 (0 commentaires) (3 réactions) (0 assignés)Java (790 forks)batch import
help wantedtriagedworkflowx

Métriques du dépôt

Stars
 (3 844 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

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

Guide contributeur