From 7bc67e9bf972a64dcfa26b78fbafa084c4ef2da0 Mon Sep 17 00:00:00 2001 From: nabenabe0928 Date: Wed, 6 Dec 2023 13:36:43 +0100 Subject: [PATCH] Apply flake8 --- optuna_dashboard/_storage.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/optuna_dashboard/_storage.py b/optuna_dashboard/_storage.py index edaa53b91..223927a44 100644 --- a/optuna_dashboard/_storage.py +++ b/optuna_dashboard/_storage.py @@ -1,7 +1,5 @@ from __future__ import annotations -from datetime import datetime -from datetime import timedelta import threading import typing @@ -21,13 +19,12 @@ # In-memory trials cache trials_cache_lock = threading.Lock() trials_cache: dict[int, list[FrozenTrial]] = {} -trials_last_fetched_at: dict[int, datetime] = {} def _is_study_updated(storage: BaseStorage, trials: list[FrozenTrial]) -> bool: max_trial_id = 0 if trials is None else max([t._trial_id for t in trials], default=0) try: - # Another trial that did not exist is found in the database. + # If another trial that did not exist is found in the database, nothing will be raised. storage.get_trial(trial_id=max_trial_id + 1) return True except KeyError: @@ -51,7 +48,6 @@ def get_trials(storage: BaseStorage, study_id: int) -> list[FrozenTrial]: trials = sorted(trials, key=lambda t: t.number) with trials_cache_lock: - trials_last_fetched_at[study_id] = datetime.now() trials_cache[study_id] = trials return trials