Use skip_table_creation when using Optuna v3 or later

This commit is contained in:
c-bata
2022-12-26 11:59:52 +09:00
parent 5abdcbd029
commit f4bff0fcfd
2 changed files with 4 additions and 6 deletions
+2
View File
@@ -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
+2 -6
View File
@@ -11,7 +11,7 @@ from optuna.storages import BaseStorage
from optuna.storages import RDBStorage
from . import __version__
from ._app import create_app
from ._app import create_app, get_storage
from ._sql_profiler import register_profiler_view
@@ -97,11 +97,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):