Refactor: Migrate Solver Execution Logging to Python logging #107
Refactor: Migrate Solver Execution Logging to Python logging #107parthdagia05 wants to merge 2 commits intoEAPD-DRB:mainfrom
Conversation
|
You cannot write:
That pattern often fails keyword parsing and GitHub is not be able to recognize it's linked to Issue #14. You must write it simply, no markdown, in its own line:
Check on the right sidebar, under |
autibet
left a comment
There was a problem hiding this comment.
🔴 [P1] PR is not mergeable right now, and the conflict zone is safety-critical
GitHub reports PR #107 as:
mergeStateStatus: DIRTYmergeable: CONFLICTING
The conflict occurs in DataFileClass.run() around the CBC invocation.
In the PR snapshot, it uses:
subprocess.run('cbc ' + lpfile + ..., shell=True)
(API/Classes/Case/DataFileClass.py, around line 2165 in the PR branch).
On current main, this area has already been updated to use a resolved binary with an argv list (cbc_exec, no shell=True), which is safer and more portable.
Why this matters
Resolving this conflict incorrectly could reintroduce command-invocation regressions or security risks while attempting to address what is otherwise a logging-only change.
Suggested fix
- Rebase onto current
mainfirst. - Keep the current
mainsolver invocation logic unchanged. - Apply only the logging substitutions on top of that updated implementation.
…to logging - Replace informational print() calls with logger.info() - Replace exception print with logger.error(..., exc_info=True) - Configure logging in app.py using logging.basicConfig() - Preserve solver execution behavior and UI response No functional changes introduced. Refs EAPD-DRB#14
|
@autibet i have rebased on current main branch |
|
Closing this the v5.5 sync (#422) introduced the new logging setup, which supersedes most of what this PR proposed. Happy to follow up with smaller targeted improvements if any gaps remain. |
Closes #14
Overview
This PR replaces legacy
print()statements within theDataFileClass.run()method with Python’s nativeloggingmodule.As the project evolves toward cross-platform support and more complex solver workflows, transitioning from unformatted stdout to structured logging is essential for professional debugging, maintainability, and future-proofing.
Changes
1. Structured Logging in
DataFileClassprint()calls withlogger.info().print(ex)withlogger.error(..., exc_info=True). This captures the full stack trace in the server logs while maintaining a clean output for the end-user.DataFileClass)2. Centralized Configuration
Introduced a standardized logging configuration in
API/app.py: