bisect-kit: bisector should not raise exception when show status
BUG=None
TEST=unittest
Change-Id: I0a71a17ce21aaa7f08f19d5e3f1325e2dc62884b
Reviewed-on: https://chromium-review.googlesource.com/1406769
Commit-Ready: Kuang-che Wu <kcwu@chromium.org>
Tested-by: Kuang-che Wu <kcwu@chromium.org>
Reviewed-by: Chung-yih Wang <cywang@chromium.org>
diff --git a/bisect_kit/cli.py b/bisect_kit/cli.py
index 5d43577..6a450e5 100644
--- a/bisect_kit/cli.py
+++ b/bisect_kit/cli.py
@@ -492,9 +492,13 @@
def cmd_view(self, opts):
"""Shows remaining candidates."""
- self.strategy.rebuild()
- # Rebuild twice in order to re-estimate noise.
- self.strategy.rebuild()
+ try:
+ self.strategy.rebuild()
+ # Rebuild twice in order to re-estimate noise.
+ self.strategy.rebuild()
+ except errors.VerificationFailed:
+ # Do nothing, go ahead to show existing information anyway.
+ pass
old_idx, new_idx = self.strategy.get_range()
old, new = map(self.states.idx2rev, [old_idx, new_idx])
@@ -515,9 +519,10 @@
interesting_indexes = set(range(len(summary['rev_info'])))
else:
interesting_indexes = set([old_idx, new_idx])
- for i, p in enumerate(self.strategy.prob):
- if p > 0.05:
- interesting_indexes.add(i)
+ if self.strategy.prob:
+ for i, p in enumerate(self.strategy.prob):
+ if p > 0.05:
+ interesting_indexes.add(i)
self.domain.fill_candidate_summary(summary, interesting_indexes)
@@ -588,7 +593,11 @@
self.states.rev2idx(self.config['new']),
confidence=self.config['confidence'],
observation=self.config['noisy'])
- self.strategy.rebuild()
+ try:
+ self.strategy.rebuild()
+ except errors.VerificationFailed:
+ # Do nothing, go ahead to show existing information anyway.
+ pass
left, right = self.strategy.get_range()
estimated_noise = self.strategy.get_noise_observation()