Consolidate DB access behind DatabaseInterface and add orchestrator#61
Open
thedeepaksengar wants to merge 3 commits into
Open
Consolidate DB access behind DatabaseInterface and add orchestrator#61thedeepaksengar wants to merge 3 commits into
thedeepaksengar wants to merge 3 commits into
Conversation
NathanGavenski
requested changes
Apr 21, 2026
Collaborator
NathanGavenski
left a comment
There was a problem hiding this comment.
Hey @thedeepaksengar great PR, let me know when you go through the comments so we can have a small meeting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consolidated leaked DB queries. There were 33 raw pymongo calls scattered
across 6 files (functions.py, custom_decorators.py, info.py, queue_manager.py,
ProVe_main_service.py, background_processing.py, ProVe_heuristic_service.py).
All of them now go through methods on MongoDBHandler. Added 16 new methods
(get_latest_status_by_qid, get_html_by_task_id, upsert_summary_by_id,
log_usage, etc). Also folded StatsDBHandler and TMPStatsDBHandler subclasses
back into MongoDBHandler since they were just the same class pointing at
different DB names — the new handler lazily opens the usage DBs on demand.
Added the DB orchestrator / interface layer. New
prove_shared/database/subpackage with:
interface.py— DatabaseInterface that MongoDBHandler (and the futurePostgreSQLHandler) implement
postgres.py— stub for the Postgres implementation, every method raisesNotImplementedError with notes on what the SQL equivalent should look like
orchestrator.py— DatabaseOrchestrator + get_database() factory, readsthe active backend from config.yaml
All 6 callers now do
db = get_database()instead ofMongoDBHandler().Switching DBs is config-only:
Review-feedback changes on top of the initial PR.
Added unit tests. 116 tests, all passing:
Bugs fixed along the way.