mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
Add CLI option to use artifact
This commit is contained in:
@@ -68,6 +68,8 @@ optional arguments:
|
||||
--host HOST hostname (default: 127.0.0.1)
|
||||
--server {wsgiref,gunicorn}
|
||||
server (default: auto)
|
||||
--artifact-dir ARTIFACT_DIR
|
||||
directory to store artifact files
|
||||
--version, -v show program's version number and exit
|
||||
--quiet, -q quiet
|
||||
```
|
||||
|
||||
@@ -13,6 +13,7 @@ from bottle import run
|
||||
from optuna.storages import BaseStorage
|
||||
from optuna.storages import RDBStorage
|
||||
|
||||
from optuna_dashboard.artifact.file_system import FileSystemBackend
|
||||
from . import __version__
|
||||
from ._app import create_app
|
||||
from ._app import get_storage
|
||||
@@ -94,13 +95,22 @@ def main() -> None:
|
||||
default="auto",
|
||||
choices=SERVER_CHOICES,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--artifact-dir",
|
||||
help="directory to store artifact files",
|
||||
default=None,
|
||||
)
|
||||
parser.add_argument("--version", "-v", action="version", version=__version__)
|
||||
parser.add_argument("--quiet", "-q", help="quiet", action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
storage: BaseStorage
|
||||
storage = get_storage(args.storage)
|
||||
app = create_app(storage, debug=DEBUG)
|
||||
|
||||
artifact_backend = None
|
||||
if args.artifact_dir is not None:
|
||||
artifact_backend = FileSystemBackend(args.artifact_dir)
|
||||
app = create_app(storage, artifact_backend=artifact_backend, debug=DEBUG)
|
||||
|
||||
if DEBUG and isinstance(storage, RDBStorage):
|
||||
app = register_profiler_view(app, storage)
|
||||
|
||||
Reference in New Issue
Block a user