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

Refactor history module db manager #161

Merged
merged 4 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autosubmit_api/autosubmit_legacy/job/job_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def get_job_times_collection(basic_config: APIBasicConfig, allJobs, expid, job_t
job_data = None
try:
experiment_history = ExperimentHistoryDirector(ExperimentHistoryBuilder(expid)).build_reader_experiment_history()
job_data = experiment_history.manager.get_all_last_job_data_dcs() if experiment_history.is_header_ready() else None
job_data = experiment_history.manager.get_all_last_job_data_dcs()
except Exception:
print(traceback.print_exc())
# Result variables
Expand Down
23 changes: 0 additions & 23 deletions autosubmit_api/builders/experiment_history_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ def __init__(self, expid: str):
def generate_experiment_history_db_manager(self):
pass

@abstractmethod
def initialize_experiment_history_db_manager(self):
pass

@abstractmethod
def generate_logger(self):
pass
Expand All @@ -35,11 +31,6 @@ def generate_experiment_history_db_manager(self):
self._validate_basic_config()
self.experiment_history_db_manager = ExperimentHistoryDbManager(self.expid, self.basic_config)

def initialize_experiment_history_db_manager(self):
if not self.experiment_history_db_manager:
raise Exception("Experiment Database Manager is missing")
self.experiment_history_db_manager.initialize()

def generate_logger(self):
self._validate_basic_config()
self.logger = Logging(self.expid, self.basic_config)
Expand All @@ -48,9 +39,6 @@ def make_experiment_history(self) -> ExperimentHistory:
self._validate_basic_config()
if not self.experiment_history_db_manager:
raise Exception("Experiment Database Manager is missing")
else:
if not self.experiment_history_db_manager.my_database_exists():
raise Exception("Job/Runs database does not exist")
if not self.logger:
raise Exception("Logging is missing.")
return ExperimentHistory(self.expid, self.basic_config, self.experiment_history_db_manager, self.logger)
Expand All @@ -59,17 +47,6 @@ class ExperimentHistoryDirector(object):
def __init__(self, builder: Builder):
self.builder = builder

def build_current_experiment_history(self, basic_config: Optional[APIBasicConfig] = None) -> ExperimentHistory:
""" Builds ExperimentHistory updated to current version. """
if basic_config:
self.builder.set_basic_config(basic_config)
else:
self.builder.generate_basic_config()
self.builder.generate_experiment_history_db_manager()
self.builder.initialize_experiment_history_db_manager()
self.builder.generate_logger()
return self.builder.make_experiment_history()

def build_reader_experiment_history(self, basic_config: Optional[APIBasicConfig] = None) -> ExperimentHistory:
""" Buids ExperimentHistory that doesn't update to current version automatically. """
if basic_config:
Expand Down
1 change: 0 additions & 1 deletion autosubmit_api/experiment/common_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ def get_experiment_data(expid: str) -> Dict[str, Any]:
if experiment_run and experiment_run.total > 0:
result["total_jobs"] = experiment_run.total
result["completed_jobs"] = experiment_run.completed
result["db_historic_version"] = experiment_history.manager.db_version
except Exception as exc:
logger.warning((traceback.format_exc()))
logger.warning(
Expand Down
97 changes: 0 additions & 97 deletions autosubmit_api/history/database_managers/database_manager.py

This file was deleted.

Loading
Loading