Conversation
| self.build_index() | ||
| search = self.search_index | ||
| del self.search_index # can't pickle Annoy | ||
| except Exception as e: |
There was a problem hiding this comment.
is there a specific exn we can zero in on here for the expected case to OK?
| del self.search_index # can't pickle Annoy | ||
| except Exception as e: | ||
| logger.exception(e) | ||
| logger.warn( |
There was a problem hiding this comment.
should this be import warnings; ... ? i'm not that versed on python, but to enable structured unit testing, safer sw, etc
| search = self.search_index | ||
| del self.search_index # can't pickle Annoy | ||
| except Exception as e: | ||
| logger.exception(e) |
| cls.build_index() | ||
| try: | ||
| cls.build_index() | ||
| except Exception as e: |
There was a problem hiding this comment.
is there a way for us to know whether to build the index or not vs just doing it, e.g., not hasattr(...) or x is None?
current form is unclear how to maintain and handle otherwise
| cls.build_index() | ||
| except Exception as e: | ||
| logger.exception(e) | ||
| logger.warn("Could not build index, run g.build_index() to build it later") |
There was a problem hiding this comment.
Can we detect the expected-to-fail scenario ahead of time, skip building in that scenario, and still raise for unexpected errors? This seems to catch too many exn cases otherwise and thus is known-wrong..
|
ci failed due to spurious pypi bugs, kicked it off again |
| logger.warn( | ||
| "Could not build index, saving without it. Run g.build_index() to build it later" | ||
| ) | ||
| search = None |
There was a problem hiding this comment.
Can we detect the expected-to-fail scenario ahead of time, skip building in that scenario, and still raise for unexpected errors? This seems to catch too many exn cases otherwise and thus is known-wrong..
lmeyerov
left a comment
There was a problem hiding this comment.
Exn swallowing logic is unsafe, should instead avoid builds in known-bad scenarios, allowing it to still raise in unexpected scenarios
Originally saving was specific to having an in memory index.
Change allows saving when an index has not been built.