Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: print_exception() missing 2 required positional arguments: 'value' and 'tb' and Enabled concurrency with Gradio with Task_ID generations. #181

Closed
wants to merge 0 commits into from

Conversation

Kryst4lDem0ni4s
Copy link
Contributor

Improved the exception handling in HGraphConfig for API version retrieval.

Cause of error discovered:
The traceback.print_exception function requires two more positional arguments, value and tb, which are not provided in the calls from KG Builder.
i.e:

builder = KgBuilder(LLMs().get_chat_llm(), Embeddings().get_embedding(), get_hg_client())
File "C:\Users\Khwaish\.vscode\incubator-hugegraph-ai\hugegraph-llm\src\hugegraph_llm\utils\hugegraph_utils.py", line 39, in get_hg_client
return PyHugeClient(
File "C:\Users\Khwaish\.vscode\incubator-hugegraph-ai\.venv\lib\site-packages\pyhugegraph\client.py", line 59, in __init__
self.cfg = HGraphConfig(ip, port, user, pwd, graph, graphspace, timeout or (0.5, 15.0))
File "<string>", line 11, in __init__
File "C:\Users\Khwaish\.vscode\incubator-hugegraph-ai\.venv\lib\site-packages\pyhugegraph\utils\huge_config.py", line 66, in __post_init__
traceback.print_exception(e)

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 26, 2025
@dosubot dosubot bot added the bug Something isn't working label Feb 26, 2025
@imbajin
Copy link
Member

imbajin commented Feb 27, 2025

Thanks, the CI error may relate to here: 8c7dbaf (#179)

@imbajin imbajin changed the title fix: #180 print_exception() missing 2 required positional arguments: 'value' and 'tb' during demo run. fix: print_exception() missing 2 required positional arguments: 'value' and 'tb' Feb 27, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 28, 2025
@github-actions github-actions bot added the llm label Feb 28, 2025
@Kryst4lDem0ni4s
Copy link
Contributor Author

Changed:

log_path = "logs/llm-server.log"
    try:
        with open(log_path, "r", encoding='utf-8') as f:
            return ''.join(deque(f, maxlen=lines))
    except FileNotFoundError:
        log.critical("Log file not found: %s", log_path)
        return "LLM Server log file not found."

to

log_path = "logs/llm-server.log"
    try:
        with open(log_path, "r", encoding='utf-8') as f:
            data = f.read()
            return ''.join(deque(data, maxlen=lines))
    except FileNotFoundError:
        print(f"Log file not found: {log_path}")
        return "LLM Server log file not found."
    except UnicodeDecodeError as e:
        print(f"Decoding error occurred: {e}")
        # ignore the bad bytes and continue processing
        with open(log_path, "r", encoding='utf-8', errors='ignore') as f:
            data = f.read()
            return ''.join(deque(data, maxlen=lines))

in order to handle frequent unicode encoding errors during attempts to read logs.

Also added task ID generation for RAG functions, and enabled concurrency using Gradio Blocks in rag_block.py in rag_demo by creating a task ID generation decorator and used Gradio Blocks for concurrency control. Added logs for clear understanding. Issue: #176 #176

@Kryst4lDem0ni4s Kryst4lDem0ni4s changed the title fix: print_exception() missing 2 required positional arguments: 'value' and 'tb' fix: print_exception() missing 2 required positional arguments: 'value' and 'tb' and Enabled concurrency with Gradio with Task_ID generations. Feb 28, 2025
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working llm python-client size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] print_exception() missing 2 required positional arguments: 'value' and 'tb'
2 participants