online-ml / chantilly

🍦 Deployment tool for online machine learning models
BSD 3-Clause "New" or "Revised" License
97 stars 17 forks source link

Error when POST a new model. #9

Closed kevinsteger closed 4 years ago

kevinsteger commented 4 years ago

This is the error when posting a model:

Am I missing something required in the environment? Python 3.6?

127.0.0.1 - - [29/Mar/2020 21:29:41] "POST /api/init HTTP/1.1" 201 - [2020-03-29 21:29:41,320] ERROR in app: Exception on /api/model [POST] Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/local/lib/python3.6/dist-packages/app/api.py", line 107, in model name = db.add_model(model, name=name) File "/usr/local/lib/python3.6/dist-packages/app/db.py", line 69, in add_model name = _random_name() File "/usr/local/lib/python3.6/dist-packages/app/db.py", line 85, in _random_name adj = rng.choice(list(open(os.path.join(here, 'adjectives.txt')))) FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/dist-packages/app/adjectives.txt'

kevinsteger commented 4 years ago

and here is the code. trying to post a trained model.

`with open('model.dill', 'rb') as f: model = dill.load(f)

config = {'flavor': 'regression'}

s.post('http://localhost:5000/api/init', json=config)

r = s.post('http://localhost:5000/api/model', data=dill.dumps(model))

print (r.text) `

Output:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

500 Internal Server Error

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

MaxHalford commented 4 years ago

Fixed! We use somes files to generate random model names, to package them we need to include them in the MANIFEST.in file.

By the way I'll be releasing a stable version in the next few days. You're doing a lot of hard word testing things out, so big kudos to you.

kevinsteger commented 4 years ago

My pleasure, I really want to use this in our environment ASAP.

MaxHalford commented 4 years ago

@kevinsteger cool! I'll change the logging tomorrow.