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

Add appropriate response to Models().SKModel().load_model('<model_id>', connection_object) when non-existent model is specified. #29

Open
vc1492a opened this issue Sep 11, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@vc1492a
Copy link
Owner

vc1492a commented Sep 11, 2018

Currently, calling Models().SKModel().load_model() results in a KeyError if the ID of a non-existent model is specified, see below:

WARNING:root:<Response [404]>
{'description': 'Error retrieving model from Elasticsearch.'}
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-10-8aa4cd950881> in <module>()
      1 for m in list_models():
----> 2     model = Models().SKModel().load_model('bbe4830f5eb24a73a299b720eef58ccd', s)
      3     print(model)
      4 
      5 

~/Files/Projects/5X/PRS Form Recommender/api/src/henosis/Henosis/model.py in load_model(self, model_id, server_config)
    344             print(model_info)
    345 
--> 346             self.id = model_info['models']['id']
    347             self.deployed = model_info['models']['deployed']
    348             self.call_count = model_info['models']['callCount']

KeyError: 'models'

The aim here is to improve the response to the error, e.g. something along the lines of 'Specified model ID not present in Henosis instance.' and by also electing to not attempt to load the model if an error occurs in the API (currently, an error presented in the API response does not stop Henosis from attempting to return a model object).

@vc1492a vc1492a added bug Something isn't working enhancement New feature or request and removed enhancement New feature or request labels Sep 11, 2018
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

1 participant