Fix linting
This commit is contained in:
parent
ba7b3cedb5
commit
8a293a2c07
1 changed files with 55 additions and 51 deletions
|
|
@ -11,7 +11,6 @@ Usage:
|
|||
|
||||
import asyncio
|
||||
import sys
|
||||
from typing import Optional
|
||||
from pathlib import Path
|
||||
|
||||
# Add parent directory to path for imports
|
||||
|
|
@ -38,25 +37,27 @@ async def check_lightrag_setup(rag_instance: LightRAG, verbose: bool = False) ->
|
|||
print("🔍 Checking LightRAG initialization status...\n")
|
||||
|
||||
# Check storage initialization status
|
||||
if not hasattr(rag_instance, '_storages_status'):
|
||||
if not hasattr(rag_instance, "_storages_status"):
|
||||
issues.append("LightRAG instance missing _storages_status attribute")
|
||||
elif rag_instance._storages_status != StoragesStatus.INITIALIZED:
|
||||
issues.append(f"Storages not initialized (status: {rag_instance._storages_status.name})")
|
||||
issues.append(
|
||||
f"Storages not initialized (status: {rag_instance._storages_status.name})"
|
||||
)
|
||||
else:
|
||||
print("✅ Storage status: INITIALIZED")
|
||||
|
||||
# Check individual storage components
|
||||
storage_components = [
|
||||
('full_docs', 'Document storage'),
|
||||
('text_chunks', 'Text chunks storage'),
|
||||
('entities_vdb', 'Entity vector database'),
|
||||
('relationships_vdb', 'Relationship vector database'),
|
||||
('chunks_vdb', 'Chunks vector database'),
|
||||
('doc_status', 'Document status tracker'),
|
||||
('llm_response_cache', 'LLM response cache'),
|
||||
('full_entities', 'Entity storage'),
|
||||
('full_relations', 'Relation storage'),
|
||||
('chunk_entity_relation_graph', 'Graph storage')
|
||||
("full_docs", "Document storage"),
|
||||
("text_chunks", "Text chunks storage"),
|
||||
("entities_vdb", "Entity vector database"),
|
||||
("relationships_vdb", "Relationship vector database"),
|
||||
("chunks_vdb", "Chunks vector database"),
|
||||
("doc_status", "Document status tracker"),
|
||||
("llm_response_cache", "LLM response cache"),
|
||||
("full_entities", "Entity storage"),
|
||||
("full_relations", "Relation storage"),
|
||||
("chunk_entity_relation_graph", "Graph storage"),
|
||||
]
|
||||
|
||||
if verbose:
|
||||
|
|
@ -69,7 +70,7 @@ async def check_lightrag_setup(rag_instance: LightRAG, verbose: bool = False) ->
|
|||
storage = getattr(rag_instance, component)
|
||||
if storage is None:
|
||||
warnings.append(f"Storage {component} is None (might be optional)")
|
||||
elif hasattr(storage, '_storage_lock'):
|
||||
elif hasattr(storage, "_storage_lock"):
|
||||
if storage._storage_lock is None:
|
||||
issues.append(f"Storage {component} not initialized (lock is None)")
|
||||
elif verbose:
|
||||
|
|
@ -80,10 +81,13 @@ async def check_lightrag_setup(rag_instance: LightRAG, verbose: bool = False) ->
|
|||
# Check pipeline status
|
||||
try:
|
||||
from lightrag.kg.shared_storage import get_namespace_data
|
||||
|
||||
get_namespace_data("pipeline_status")
|
||||
print("✅ Pipeline status: INITIALIZED")
|
||||
except KeyError:
|
||||
issues.append("Pipeline status not initialized - call initialize_pipeline_status()")
|
||||
issues.append(
|
||||
"Pipeline status not initialized - call initialize_pipeline_status()"
|
||||
)
|
||||
except Exception as e:
|
||||
issues.append(f"Error checking pipeline status: {str(e)}")
|
||||
|
||||
|
|
@ -99,7 +103,9 @@ async def check_lightrag_setup(rag_instance: LightRAG, verbose: bool = False) ->
|
|||
print(" await rag.initialize_storages()")
|
||||
print(" from lightrag.kg.shared_storage import initialize_pipeline_status")
|
||||
print(" await initialize_pipeline_status()")
|
||||
print("\n📚 Documentation: https://github.com/HKUDS/LightRAG#important-initialization-requirements")
|
||||
print(
|
||||
"\n📚 Documentation: https://github.com/HKUDS/LightRAG#important-initialization-requirements"
|
||||
)
|
||||
|
||||
if warnings and verbose:
|
||||
print("\n⚠️ Warnings (might be normal):")
|
||||
|
|
@ -147,24 +153,22 @@ async def demo():
|
|||
|
||||
# Cleanup
|
||||
import shutil
|
||||
|
||||
shutil.rmtree("./test_diagnostic", ignore_errors=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Check LightRAG initialization status"
|
||||
parser = argparse.ArgumentParser(description="Check LightRAG initialization status")
|
||||
parser.add_argument(
|
||||
"--demo", action="store_true", help="Run a demonstration with a test instance"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--demo",
|
||||
"--verbose",
|
||||
"-v",
|
||||
action="store_true",
|
||||
help="Run a demonstration with a test instance"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--verbose", "-v",
|
||||
action="store_true",
|
||||
help="Show detailed diagnostic information"
|
||||
help="Show detailed diagnostic information",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue