From 8a0835e54995ff4669aa057e9790d71e4f5d9077 Mon Sep 17 00:00:00 2001 From: Anke Koke Date: Fri, 17 May 2024 16:26:05 +0200 Subject: [PATCH] fix: reload of old exps in dashboard --- niceml/experiments/experimentinfo.py | 11 +++++++++-- niceml/experiments/experimentmanager.py | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/niceml/experiments/experimentinfo.py b/niceml/experiments/experimentinfo.py index a7c1bf1..f550fe1 100644 --- a/niceml/experiments/experimentinfo.py +++ b/niceml/experiments/experimentinfo.py @@ -51,9 +51,16 @@ def as_save_dict(self) -> dict: LAST_MODIFIED_KEY: self.last_modified, } - def is_modified(self, other: "ExperimentInfo") -> bool: + def is_modified( + self, other: "ExperimentInfo", ignore_missing_timestamp: Optional[bool] = True + ) -> bool: """Checks if the other experiment info is modified""" - return self.last_modified != other.last_modified + if self.last_modified != other.last_modified: + if ignore_missing_timestamp: + if self.last_modified is None or other.last_modified is None: + return False + return True + return False def load_exp_info( diff --git a/niceml/experiments/experimentmanager.py b/niceml/experiments/experimentmanager.py index 3d0a8c9..74db34e 100644 --- a/niceml/experiments/experimentmanager.py +++ b/niceml/experiments/experimentmanager.py @@ -103,7 +103,7 @@ def is_exp_modified(self, exp_info: ExperimentInfo) -> bool: if exp_info.short_id not in self.exp_dict_short_id: return True exp = self.get_exp_by_id(exp_info.short_id) - return exp.exp_info.is_modified(exp_info) + return exp_info.is_modified(exp.exp_info) def get_datasets(self) -> List[str]: """Returns a list of all datasets used in the experiments"""