Fix linting
This commit is contained in:
@@ -769,7 +769,6 @@ class LightRAG:
|
|||||||
async with pipeline_status_lock:
|
async with pipeline_status_lock:
|
||||||
# Ensure only one worker is processing documents
|
# Ensure only one worker is processing documents
|
||||||
if not pipeline_status.get("busy", False):
|
if not pipeline_status.get("busy", False):
|
||||||
|
|
||||||
processing_docs, failed_docs, pending_docs = await asyncio.gather(
|
processing_docs, failed_docs, pending_docs = await asyncio.gather(
|
||||||
self.doc_status.get_docs_by_status(DocStatus.PROCESSING),
|
self.doc_status.get_docs_by_status(DocStatus.PROCESSING),
|
||||||
self.doc_status.get_docs_by_status(DocStatus.FAILED),
|
self.doc_status.get_docs_by_status(DocStatus.FAILED),
|
||||||
@@ -838,7 +837,7 @@ class LightRAG:
|
|||||||
split_by_character: str | None,
|
split_by_character: str | None,
|
||||||
split_by_character_only: bool,
|
split_by_character_only: bool,
|
||||||
pipeline_status: dict,
|
pipeline_status: dict,
|
||||||
pipeline_status_lock: asyncio.Lock
|
pipeline_status_lock: asyncio.Lock,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Process single document"""
|
"""Process single document"""
|
||||||
try:
|
try:
|
||||||
@@ -912,9 +911,7 @@ class LightRAG:
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Log error and update pipeline status
|
# Log error and update pipeline status
|
||||||
error_msg = (
|
error_msg = f"Failed to process document {doc_id}: {str(e)}"
|
||||||
f"Failed to process document {doc_id}: {str(e)}"
|
|
||||||
)
|
|
||||||
logger.error(error_msg)
|
logger.error(error_msg)
|
||||||
async with pipeline_status_lock:
|
async with pipeline_status_lock:
|
||||||
pipeline_status["latest_message"] = error_msg
|
pipeline_status["latest_message"] = error_msg
|
||||||
@@ -947,9 +944,10 @@ class LightRAG:
|
|||||||
# 3. iterate over batches
|
# 3. iterate over batches
|
||||||
total_batches = len(docs_batches)
|
total_batches = len(docs_batches)
|
||||||
for batch_idx, docs_batch in enumerate(docs_batches):
|
for batch_idx, docs_batch in enumerate(docs_batches):
|
||||||
|
|
||||||
current_batch = batch_idx + 1
|
current_batch = batch_idx + 1
|
||||||
log_message = f"Start processing batch {current_batch} of {total_batches}."
|
log_message = (
|
||||||
|
f"Start processing batch {current_batch} of {total_batches}."
|
||||||
|
)
|
||||||
logger.info(log_message)
|
logger.info(log_message)
|
||||||
pipeline_status["cur_batch"] = current_batch
|
pipeline_status["cur_batch"] = current_batch
|
||||||
pipeline_status["latest_message"] = log_message
|
pipeline_status["latest_message"] = log_message
|
||||||
@@ -964,7 +962,7 @@ class LightRAG:
|
|||||||
split_by_character,
|
split_by_character,
|
||||||
split_by_character_only,
|
split_by_character_only,
|
||||||
pipeline_status,
|
pipeline_status,
|
||||||
pipeline_status_lock
|
pipeline_status_lock,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -977,7 +975,6 @@ class LightRAG:
|
|||||||
pipeline_status["latest_message"] = log_message
|
pipeline_status["latest_message"] = log_message
|
||||||
pipeline_status["history_messages"].append(log_message)
|
pipeline_status["history_messages"].append(log_message)
|
||||||
|
|
||||||
|
|
||||||
# Check if there's a pending request to process more documents (with lock)
|
# Check if there's a pending request to process more documents (with lock)
|
||||||
has_pending_request = False
|
has_pending_request = False
|
||||||
async with pipeline_status_lock:
|
async with pipeline_status_lock:
|
||||||
|
Reference in New Issue
Block a user