Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise HTTPException in train function never changes status from 'running' #123

Open
BorjaEst opened this issue Oct 1, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@BorjaEst
Copy link

BorjaEst commented Oct 1, 2023

Description

Some raised exceptions in the train function, do not change the status of the training.

Steps to Reproduce

Consider the following api.py for the demo example:

from aiohttp.web import HTTPException

def get_metadata():
    return {"status": "All ok"}

def get_train_args():
    return {}

def train(**kwargs):
    raise HTTPException(reason="Some error")

After calling:

curl -X 'POST' \
  'http://127.0.0.1:5000/v2/models/demo_app/train/' \
  -H 'accept: application/json' \
  -d ''

The server replies:

{
  "date": "2023-10-01 10:02:05.370140",
  "args": {},
  "uuid": "2631a11696c44cfea4a16d7095c64205",
  "status": "running"
}

However, after calling GET:

curl -X 'GET' \
  'http://127.0.0.1:5000/v2/models/demo_app/train/' \
  -H 'accept: application/json'

returns:

[
  {
    "date": "2023-10-01 10:02:05.370140",
    "args": {},
    "uuid": "2631a11696c44cfea4a16d7095c64205",
    "status": "running"
  }
]

Which is clearly not possible that status is running as an exception was raised.

Expected behavior:

It should be described http exceptions cannot be used in the documentation.
There should be some protection mechanisms to avoid the usage of this exceptions.
At worse, the GET method train should return:

[
  {
    "date": "2023-10-01 10:06:58.097097",
    "args": {},
    "uuid": "0fd0d21a8457482d885ee50d5aeed364",
    "status": "error",
    "message": "Some error"
  }
]

Ideally, the POST method train should return:

500 Internal Server Error

Versions

$ pip show deepaas
Name: deepaas
Version: 2.2.0
....
Location: /home/borja/miniconda3/envs/demo/lib/python3.10/site-packages
Requires: aiohttp, aiohttp-apispec, jsonschema, marshmallow, oslo.config, oslo.log, pbr, six, stevedore, typer, webargs, werkzeug
Required-by: demo-app
@alvarolopez alvarolopez added the bug Something isn't working label Oct 2, 2023
@alvarolopez alvarolopez removed this from the 3.0.0 - Improve model loading milestone Dec 19, 2023
@alvarolopez alvarolopez added this to the 4.0.0 - Dask integration milestone Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants