Merge pull request #375 from c-bata/enhance-artifact-backend-support

Fix bug of custom user widgets and enhance artifact support.
This commit is contained in:
Masashi Shibata authored and GitHub committed 2023-01-27 17:46:08 +09:00
commit 433f1770c9
3 files changed
+30 -8

No files matched your search

+10 -4
View File
@@ -516,19 +516,25 @@ def get_storage(storage: Union[str, BaseStorage]) -> BaseStorage:
def run_server(
storage: Union[str, BaseStorage], host: str = "localhost", port: int = 8080
storage: Union[str, BaseStorage],
host: str = "localhost",
port: int = 8080,
artifact_backend: Optional[ArtifactBackend] = None,
) -> None:
"""Start running optuna-dashboard and blocks until the server terminates.
This function uses wsgiref module which is not intended for the production
use. If you want to run optuna-dashboard more secure and/or more fast,
please use WSGI server like Gunicorn or uWSGI via `wsgi()` function.
"""
app = create_app(get_storage(storage))
app = create_app(get_storage(storage), artifact_backend=artifact_backend)
run(app, host=host, port=port)
def wsgi(storage: Union[str, BaseStorage]) -> WSGIApplication:
def wsgi(
storage: Union[str, BaseStorage],
artifact_backend: Optional[ArtifactBackend] = None,
) -> WSGIApplication:
"""This function exposes WSGI interface for people who want to run on the
production-class WSGI servers like Gunicorn or uWSGI.
"""
return create_app(get_storage(storage))
return create_app(get_storage(storage), artifact_backend=artifact_backend)
@@ -175,11 +175,23 @@ export const ObjectiveForm: FC<{
{getObjectiveName(i)} - {widget.description}
</FormLabel>
<RadioGroup row defaultValue={widget.values.at(0)}>
{widget.choices.map((c, i) => (
{widget.choices.map((c, j) => (
<FormControlLabel
key={c}
value={widget.values.at(i)}
control={<Radio />}
control={
<Radio
checked={value === widget.values.at(j)}
onChange={(e) => {
const selected = widget.values.at(j)
if (e.target.checked) {
setValue(
i,
selected === undefined ? null : selected
)
}
}}
/>
}
label={c}
/>
))}
@@ -194,6 +206,10 @@ export const ObjectiveForm: FC<{
</FormLabel>
<Box sx={{ padding: theme.spacing(0, 2) }}>
<Slider
onChange={(e) => {
// @ts-ignore
setValue(i, e.target.value as number)
}}
defaultValue={widget.min}
min={widget.min}
max={widget.max}
@@ -60,7 +60,7 @@ export const StudyDetailBeta: FC<{
}, [])
useEffect(() => {
if (reloadInterval < 0 || page === "trialTable" || page === "trialList") {
if (reloadInterval < 0 || page === "trialTable") {
return
}
const intervalId = setInterval(function () {