Skip to content

Commit

Permalink
Merge pull request #742 from hrntsm/fix-journal-storage-handling-in-w…
Browse files Browse the repository at this point in the history
…indonws

Fix journal storage handling in windows
  • Loading branch information
c-bata authored Jan 9, 2024
2 parents 6b05c98 + 02999c7 commit 0da1b9d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion optuna_dashboard/_storage_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,17 @@ def get_journal_file_storage(file_path: str) -> JournalStorage:
if version.parse(optuna_ver) < version.Version("v3.1.0"):
raise ValueError("JournalRedisStorage is available from Optuna v3.1.0")

from optuna.storages import JournalFileOpenLock
from optuna.storages import JournalFileStorage
from optuna.storages import JournalStorage

return JournalStorage(JournalFileStorage(file_path=file_path))
storage: JournalStorage
if os.name == "nt":
lock_obj = JournalFileOpenLock(file_path)
storage = JournalStorage(JournalFileStorage(file_path=file_path, lock_obj=lock_obj))
else:
storage = JournalStorage(JournalFileStorage(file_path=file_path))
return storage


def get_journal_redis_storage(redis_url: str) -> JournalStorage:
Expand Down

0 comments on commit 0da1b9d

Please sign in to comment.