### What problem does this PR solve? ### Type of change - [x] Refactoringtags/v0.16.0
| ck_idx = [i + start for i in range(len(lbls)) if lbls[i] == c] | ck_idx = [i + start for i in range(len(lbls)) if lbls[i] == c] | ||||
| threads.append(executor.submit(summarize, ck_idx, lock)) | threads.append(executor.submit(summarize, ck_idx, lock)) | ||||
| wait(threads, return_when=ALL_COMPLETED) | wait(threads, return_when=ALL_COMPLETED) | ||||
| for th in threads: | |||||
| if isinstance(th.result(), Exception): | |||||
| raise th.result() | |||||
| logging.debug(str([t.result() for t in threads])) | logging.debug(str([t.result() for t in threads])) | ||||
| assert len(chunks) - end == n_clusters, "{} vs. {}".format(len(chunks) - end, n_clusters) | assert len(chunks) - end == n_clusters, "{} vs. {}".format(len(chunks) - end, n_clusters) |
| except Exception: | except Exception: | ||||
| pass | pass | ||||
| logging.debug("handle_task got TaskCanceledException", exc_info=True) | logging.debug("handle_task got TaskCanceledException", exc_info=True) | ||||
| except Exception: | |||||
| except Exception as e: | |||||
| with mt_lock: | with mt_lock: | ||||
| FAILED_TASKS += 1 | FAILED_TASKS += 1 | ||||
| CURRENT_TASK = None | CURRENT_TASK = None | ||||
| try: | try: | ||||
| set_progress(task["id"], prog=-1, msg="handle_task got exception, please check log") | |||||
| set_progress(task["id"], prog=-1, msg=f"[Exception]: {e}") | |||||
| except Exception: | except Exception: | ||||
| pass | pass | ||||
| logging.exception(f"handle_task got exception for task {json.dumps(task)}") | logging.exception(f"handle_task got exception for task {json.dumps(task)}") |