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

Fix journal storage handling in windows #742

Merged
merged 2 commits into from
Jan 9, 2024
Merged
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
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