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

Improve error handling #799

Merged
merged 1 commit into from
Aug 16, 2019
Merged

Conversation

dtaniwaki
Copy link
Contributor

I found a confusing error message while I was trying to create a new model with the Seldon image. My code raised an exception but the flask app prints an AttributeError first and my error next because my error occurred in the error handling of predict_raw call.

2019-08-14 10:19:22,603 - flask.app:log_exception:1780 - ERROR:  Exception on /predict [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/seldon_core/seldon_methods.py", line 35, in predict
    return user_model.predict_raw(request)
AttributeError: 'MnistClassifier' object has no attribute 'predict_raw'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2311, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1834, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
...

Could you consider merging this improvement?

Copy link
Contributor

@axsaucedo axsaucedo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution @dtaniwaki, this makes sense! I've added a request to remove the 2nd catch block

print(client_response)
return construct_response_json(user_model, False, request, client_response)
pass
except e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to catch the exception

@dtaniwaki dtaniwaki force-pushed the improve-error-handling branch from 131747b to 6bdae28 Compare August 16, 2019 13:06
@dtaniwaki
Copy link
Contributor Author

@axsaucedo I updated the code. Please check it again.

@axsaucedo axsaucedo merged commit 5d092cc into SeldonIO:master Aug 16, 2019
@axsaucedo
Copy link
Contributor

Great, thanks @dtaniwaki

@dtaniwaki dtaniwaki deleted the improve-error-handling branch August 16, 2019 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants