mirror of
https://github.com/sandronator/finetuning_aufgabe4.git
synced 2026-09-04 00:26:06 +02:00
The Manager previously called setupBoth() on every test step, which dropped both PostgreSQL and MariaDB tables and re-imported the full DBLP TSVs (~9 reloads across 2 DBs in a single run, even though only PostgreSQL was used). Now data is loaded once via load_data_postgres() and only the indexes are swapped between tests via apply_indexes_postgres(). A reset_postgres(config, reload_data=False) helper lets callers force a full reload when needed -- used after 'cl-both' tests, since CLUSTER physically reorders the table and dropping the index alone does not restore the original layout. Also fixes two bugs found while reading the code: - baseStrategy.run iterated 'self.queries' instead of '.items()', which would crash on the first unpack. - main.py was missing an execute() call after the Aufgabe 3 'cl-both' setup, silently skipping that test. Co-Authored-By: Claude Opus 4.7 <[email protected]>
20 lines
621 B
Python
20 lines
621 B
Python
from baseStrategy import BaseStrategy
|
|
import setup
|
|
|
|
class Manager:
|
|
def __init__(self, strategy: BaseStrategy, ):
|
|
self.strategy = strategy
|
|
|
|
def setStrategy(self, strategy: BaseStrategy):
|
|
self.strategy = strategy
|
|
|
|
def setQueries(self, queries: dict[str, str]):
|
|
self.strategy.set_queries(queries)
|
|
|
|
# Only Postgresql and MariaDb available at the moment
|
|
def setup_db(self, index_config, reload_data=False):
|
|
setup.reset_postgres(index_config, reload_data=reload_data)
|
|
|
|
def execute(self):
|
|
self.strategy.run()
|
|
|