pytorch/serve

Custom Exceptions Are Ignored By Workflow

Open

#2456 aperta il 11 lug 2023

Vedi su GitHub
 (0 commenti) (3 reazioni) (0 assegnatari)Java (790 fork)batch import
help wantedtriagedworkflowx

Metriche repository

Star
 (3844 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor