chantilly icon indicating copy to clipboard operation
chantilly copied to clipboard

Error when POST a new model.

Open kevinsteger opened this issue 6 years ago • 4 comments

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 avatar Mar 29 '20 21:03 kevinsteger

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:

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.

kevinsteger avatar Mar 29 '20 21:03 kevinsteger

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.

MaxHalford avatar Mar 29 '20 21:03 MaxHalford

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

kevinsteger avatar Mar 29 '20 21:03 kevinsteger

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

MaxHalford avatar Mar 29 '20 21:03 MaxHalford