Merge branch 'main' into feature/code-server-support-for-vscode-extension

This commit is contained in:
c-bata
2024-01-12 10:15:24 +09:00
8 changed files with 7979 additions and 8071 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
optuna-version: ['optuna==2.10.0', 'git+https://github.com/optuna/optuna.git']
optuna-version: ['git+https://github.com/optuna/optuna.git']
steps:
- uses: actions/checkout@v3
@@ -1,3 +1,6 @@
import os
import tempfile
from playwright.sync_api import Page
import pytest
@@ -20,3 +23,52 @@ def test_home(
title = element.text_content()
assert title is not None
assert title == "Optuna Dashboard (Wasm ver.)"
def test_load_storage(
page: Page,
server_url: str,
) -> None:
study_name = "single-objective"
url = f"{server_url}"
def create_storage_file(filename: str):
import optuna
storage = optuna.storages.RDBStorage(f"sqlite:///{filename}")
study = optuna.create_study(study_name=study_name, storage=storage)
def objective(trial: optuna.Trial) -> float:
x1 = trial.suggest_float("x1", 0, 10)
x2 = trial.suggest_float("x2", 0, 10)
return (x1 - 2) ** 2 + (x2 - 5) ** 2
study.optimize(objective, n_trials=100)
with tempfile.TemporaryDirectory() as dir:
with tempfile.NamedTemporaryFile() as fp:
filename = fp.name
path = os.path.join(dir, filename)
create_storage_file(filename)
page.goto(url)
with page.expect_file_chooser() as fc_info:
page.get_by_role(
"button",
name="Load an Optuna Storage Drag your SQLite3 file here or click to browse.",
).click()
file_chooser = fc_info.value
file_chooser.set_files(path)
page.get_by_role("link", name=study_name).click()
def count_components(page: Page, component_name: str):
component_count = page.evaluate(
f"""() => {{
const components = document.querySelectorAll('.{component_name}');
return components.length;
}}"""
)
return component_count
count = count_components(page, "MuiCard-root")
assert count == 4
+8 -1
View File
@@ -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:
+6 -6
View File
@@ -7334,9 +7334,9 @@
"dev": true
},
"node_modules/follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
"version": "1.15.4",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
"integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==",
"funding": [
{
"type": "individual",
@@ -20591,9 +20591,9 @@
"dev": true
},
"follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
"version": "1.15.4",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
"integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw=="
},
"for-each": {
"version": "0.3.3",
@@ -1,6 +1,6 @@
import * as plotly from "plotly.js-dist-min"
import React, { FC, useEffect, useState } from "react"
import { Typography, useTheme, Box, Card, CardContent } from "@mui/material"
import { Typography, useTheme, Box } from "@mui/material"
import init, { wasm_fanova_calculate } from "optuna"
import { plotlyDarkTemplate } from "../PlotlyDarkMode"
@@ -59,17 +59,15 @@ export const PlotImportance: FC<{ study: Study }> = ({ study }) => {
}, [nObjectives, importance, theme.palette.mode])
return (
<Card>
<CardContent>
<Typography
variant="h6"
sx={{ margin: "1em 0", fontWeight: theme.typography.fontWeightBold }}
>
Hyperparameter Importance
</Typography>
<Box id={plotDomId} sx={{ height: "450px" }} />
</CardContent>
</Card>
<>
<Typography
variant="h6"
sx={{ margin: "1em 0", fontWeight: theme.typography.fontWeightBold }}
>
Hyperparameter Importance
</Typography>
<Box id={plotDomId} sx={{ height: "450px" }} />
</>
)
}
@@ -1,6 +1,6 @@
import * as plotly from "plotly.js-dist-min"
import React, { FC, useEffect } from "react"
import { Box, Typography, useTheme, CardContent, Card } from "@mui/material"
import { Box, Typography, useTheme } from "@mui/material"
import { plotlyDarkTemplate } from "../PlotlyDarkMode"
const plotDomId = "graph-intermediate-values"
@@ -23,17 +23,15 @@ export const PlotIntermediateValues: FC<{
}, [trials, theme.palette.mode, false, includePruned, logScale])
return (
<Card>
<CardContent>
<Typography
variant="h6"
sx={{ margin: "1em 0", fontWeight: theme.typography.fontWeightBold }}
>
Intermediate values
</Typography>
<Box id={plotDomId} sx={{ height: "450px" }} />
</CardContent>
</Card>
<>
<Typography
variant="h6"
sx={{ margin: "1em 0", fontWeight: theme.typography.fontWeightBold }}
>
Intermediate values
</Typography>
<Box id={plotDomId} sx={{ height: "450px" }} />
</>
)
}
+7891 -8038
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -62,7 +62,7 @@
"@typescript-eslint/parser": "^5.59.1",
"mocha": "^10.2.0",
"typescript": "^5.0.4",
"@vscode/test-web": "^0.0.43",
"@vscode/test-web": "^0.0.50",
"ts-loader": "^9.4.2",
"webpack": "^5.81.0",
"webpack-cli": "^5.0.2",