This commit is contained in:
buua436 2025-12-09 18:01:34 +08:00
parent 1c7d0599f5
commit 2440939fa1
9 changed files with 12 additions and 0 deletions

View file

@ -150,6 +150,7 @@ class CommunityReportsExtractor(Extractor):
try:
await asyncio.gather(*tasks, return_exceptions=False)
except Exception as e:
logging.error(f"Error in community processing: {e}")
for t in tasks:
t.cancel()
await asyncio.gather(*tasks, return_exceptions=True)

View file

@ -145,6 +145,7 @@ class Extractor:
try:
await asyncio.gather(*tasks, return_exceptions=False)
except Exception as e:
logging.error(f"Error in worker: {str(e)}")
for t in tasks:
t.cancel()
await asyncio.gather(*tasks, return_exceptions=True)

View file

@ -286,6 +286,7 @@ async def run_graphrag_for_kb(
try:
await asyncio.gather(*tasks, return_exceptions=False)
except Exception as e:
logging.error(f"Error in asyncio.gather: {e}")
for t in tasks:
t.cancel()
await asyncio.gather(*tasks, return_exceptions=True)

View file

@ -531,6 +531,7 @@ async def set_graph(tenant_id: str, kb_id: str, embd_mdl, graph: nx.Graph, chang
try:
await asyncio.gather(*tasks, return_exceptions=False)
except Exception as e:
logging.error(f"Error in get_embedding_of_nodes: {e}")
for t in tasks:
t.cancel()
await asyncio.gather(*tasks, return_exceptions=True)
@ -549,6 +550,7 @@ async def set_graph(tenant_id: str, kb_id: str, embd_mdl, graph: nx.Graph, chang
try:
await asyncio.gather(*tasks, return_exceptions=False)
except Exception as e:
logging.error(f"Error in get_embedding_of_edges: {e}")
for t in tasks:
t.cancel()
await asyncio.gather(*tasks, return_exceptions=True)

View file

@ -14,6 +14,7 @@
# limitations under the License.
import asyncio
import logging
import random
import re
from copy import deepcopy
@ -183,6 +184,7 @@ class HierarchicalMerger(ProcessBase):
try:
await asyncio.gather(*tasks, return_exceptions=False)
except Exception as e:
logging.error(f"Error in image2id: {e}")
for t in tasks:
t.cancel()
await asyncio.gather(*tasks, return_exceptions=True)

View file

@ -752,6 +752,7 @@ async def run_toc_from_text(chunks, chat_mdl, callback=None):
try:
await asyncio.gather(*tasks, return_exceptions=False)
except Exception as e:
logging.error(f"Error generating TOC: {e}")
for t in tasks:
t.cancel()
await asyncio.gather(*tasks, return_exceptions=True)

View file

@ -209,6 +209,7 @@ class RecursiveAbstractiveProcessing4TreeOrganizedRetrieval:
try:
await asyncio.gather(*tasks, return_exceptions=False)
except Exception as e:
logging.error(f"Error in RAPTOR cluster processing: {e}")
for t in tasks:
t.cancel()
await asyncio.gather(*tasks, return_exceptions=True)

View file

@ -664,6 +664,7 @@ async def dispatch_tasks():
try:
await asyncio.gather(*tasks, return_exceptions=False)
except Exception as e:
logging.error(f"Error in dispatch_tasks: {e}")
for t in tasks:
t.cancel()
await asyncio.gather(*tasks, return_exceptions=True)

View file

@ -305,6 +305,7 @@ async def build_chunks(task, progress_callback):
try:
await asyncio.gather(*tasks, return_exceptions=False)
except Exception as e:
logging.error("Saving chunk {}/{}/{} got exception".format(task["location"], task["name"], d["id"]))
for t in tasks:
t.cancel()
await asyncio.gather(*tasks, return_exceptions=True)
@ -830,6 +831,7 @@ async def insert_es(task_id, task_tenant_id, task_dataset_id, chunks, progress_c
try:
await asyncio.gather(*tasks, return_exceptions=False)
except Exception as e:
logging.error(f"do_handle_task delete_image failed since task {task_id} is unknown.")
for t in tasks:
t.cancel()
await asyncio.gather(*tasks, return_exceptions=True)