Skip to content

Commit

Permalink
Merge pull request #320 from c-bata/skip-table-creation
Browse files Browse the repository at this point in the history
Use `skip_table_creation` when using Optuna v3 or later
  • Loading branch information
c-bata committed Dec 26, 2022
2 parents 5abdcbd + ad1fbcd commit bd99630
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions optuna_dashboard/_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ def get_storage(storage: Union[str, BaseStorage]) -> BaseStorage:
raise ValueError(
"RedisStorage is unsupported from Optuna v3.1 or Optuna Dashboard v0.8.0"
)
elif version.parse(optuna_ver) >= version.Version("v3.0.0"):
return RDBStorage(storage, skip_compatibility_check=True, skip_table_creation=True)
else:
return RDBStorage(storage, skip_compatibility_check=True)
return storage
Expand Down
7 changes: 2 additions & 5 deletions optuna_dashboard/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from . import __version__
from ._app import create_app
from ._app import get_storage
from ._sql_profiler import register_profiler_view


Expand Down Expand Up @@ -97,11 +98,7 @@ def main() -> None:
args = parser.parse_args()

storage: BaseStorage
if args.storage.startswith("redis"):
raise ValueError("RedisStorage is unsupported from Optuna v3.1 or Optuna Dashboard v0.8.0")
else:
storage = RDBStorage(args.storage, skip_compatibility_check=True)

storage = get_storage(args.storage)
app = create_app(storage, debug=DEBUG)

if DEBUG and isinstance(storage, RDBStorage):
Expand Down

0 comments on commit bd99630

Please sign in to comment.