-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptuna-monitor.py
More file actions
32 lines (22 loc) · 793 Bytes
/
optuna-monitor.py
File metadata and controls
32 lines (22 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from dataclasses import dataclass
from waitress import serve
from optuna.storages import RDBStorage
from optuna_dashboard import wsgi
from cxml_lib.logger import Paths
@dataclass
class Args:
port: int = 8080
def main(args: Args):
print("Starting Optuna dashboard...")
print(f"Using port: {args.port}")
filename = Paths().app_log_dir / "optuna/storage.db"
if not filename.exists():
raise FileNotFoundError(f"Database file not found: {filename}")
db_url = f"sqlite:///{str(filename)}"
print(f"Using database URL: {db_url}")
storage = RDBStorage(db_url)
app = wsgi(storage)
print(f"Optuna dashboard is running on http://localhost:{args.port}")
serve(app, port=args.port, url_scheme="http")
if __name__ == "__main__":
main(Args())