Kevin Hu commited on
Commit
4ac524c
·
1 Parent(s): a5ad625

Show the errors out. (#4305)

Browse files

### What problem does this PR solve?


### Type of change

- [x] Refactoring

Files changed (2) hide show
  1. rag/raptor.py +3 -0
  2. rag/svr/task_executor.py +2 -2
rag/raptor.py CHANGED
@@ -127,6 +127,9 @@ class RecursiveAbstractiveProcessing4TreeOrganizedRetrieval:
127
  ck_idx = [i + start for i in range(len(lbls)) if lbls[i] == c]
128
  threads.append(executor.submit(summarize, ck_idx, lock))
129
  wait(threads, return_when=ALL_COMPLETED)
 
 
 
130
  logging.debug(str([t.result() for t in threads]))
131
 
132
  assert len(chunks) - end == n_clusters, "{} vs. {}".format(len(chunks) - end, n_clusters)
 
127
  ck_idx = [i + start for i in range(len(lbls)) if lbls[i] == c]
128
  threads.append(executor.submit(summarize, ck_idx, lock))
129
  wait(threads, return_when=ALL_COMPLETED)
130
+ for th in threads:
131
+ if isinstance(th.result(), Exception):
132
+ raise th.result()
133
  logging.debug(str([t.result() for t in threads]))
134
 
135
  assert len(chunks) - end == n_clusters, "{} vs. {}".format(len(chunks) - end, n_clusters)
rag/svr/task_executor.py CHANGED
@@ -526,12 +526,12 @@ def handle_task():
526
  except Exception:
527
  pass
528
  logging.debug("handle_task got TaskCanceledException", exc_info=True)
529
- except Exception:
530
  with mt_lock:
531
  FAILED_TASKS += 1
532
  CURRENT_TASK = None
533
  try:
534
- set_progress(task["id"], prog=-1, msg="handle_task got exception, please check log")
535
  except Exception:
536
  pass
537
  logging.exception(f"handle_task got exception for task {json.dumps(task)}")
 
526
  except Exception:
527
  pass
528
  logging.debug("handle_task got TaskCanceledException", exc_info=True)
529
+ except Exception as e:
530
  with mt_lock:
531
  FAILED_TASKS += 1
532
  CURRENT_TASK = None
533
  try:
534
+ set_progress(task["id"], prog=-1, msg=f"[Exception]: {e}")
535
  except Exception:
536
  pass
537
  logging.exception(f"handle_task got exception for task {json.dumps(task)}")