Fix CI errors

This commit is contained in:
c-bata
2024-03-22 19:44:00 +09:00
parent fa45d6bdb9
commit d2a135d474
8 changed files with 28 additions and 13 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
venv
.venv
standalone_app
vscode
vscode
tslib
@@ -51,6 +51,9 @@ jobs:
working-directory: rustlib
run: wasm-pack build --target web
- name: Build tslib
run: make tslib
- name: Build standalone_app
working-directory: standalone_app
run: |
+2
View File
@@ -33,6 +33,8 @@ jobs:
- name: Build rustlib
working-directory: rustlib
run: wasm-pack build --target web
- name: Build tslib
run: make tslib
- name: Build standalone_app
working-directory: standalone_app
run: |
+8 -2
View File
@@ -12,14 +12,19 @@ STANDALONE_SRC := $(shell find ./standalone_app/src -name '*.ts' -o -name '*.tsx
$(RUSTLIB_OUT): rustlib/src/*.rs rustlib/Cargo.toml
cd rustlib && wasm-pack build --target web
vscode/assets/bundle.js: $(RUSTLIB_OUT) $(STANDALONE_SRC)
vscode/assets/bundle.js: $(RUSTLIB_OUT) $(STANDALONE_SRC) tslib
cd standalone_app && npm install && npm run build:vscode
$(DASHBOARD_TS_OUT): $(DASHBOARD_TS_SRC)
cd optuna_dashboard && npm install && npm run build:$(MODE)
.PHONY: tslib
tslib:
cd tslib/types && npm i && npm run build
cd tslib/storage && npm i && npm run build
.PHONY: serve-browser-app
serve-browser-app: $(RUSTLIB_OUT)
serve-browser-app: tslib $(RUSTLIB_OUT)
cd standalone_app && npm run watch
.PHONY: vscode-extension
@@ -46,5 +51,6 @@ fmt:
.PHONY: clean
clean:
rm -rf tslib/types/pkg tslib/storage/pkg
rm -rf optuna_dashboard/public/ doc/_build/
rm -rf rustlib/pkg standalone_app/public/ vscode/assets/ vscode/*.vsix
+5 -2
View File
@@ -7,11 +7,14 @@
"standalone_app/src/**/*.ts",
"standalone_app/src/**/*.tsx",
"vscode/src/**/*.ts",
"vscode/src/**/*.tsx"
"vscode/src/**/*.tsx",
"tslib/**/*.ts",
"tslib/**/*.tsx"
],
"ignore": [
"optuna_dashboard/ts/components/PlotlyColorTemplates.ts",
"standalone_app/src/PlotlyDarkMode.ts"
"standalone_app/src/PlotlyDarkMode.ts",
"tslib/**/pkg/*"
]
},
"javascript": {
+1 -1
View File
@@ -3,7 +3,7 @@
"fmt": "biome format --write . && biome check standalone_app vscode --apply",
"lint": "npm run lint:eslint && npm run lint:biome",
"lint:eslint": "eslint . --ext .ts,.tsx --max-warnings 0",
"lint:biome": "biome format . && biome ci standalone_app vscode"
"lint:biome": "biome format . && biome ci standalone_app vscode tslib"
},
"devDependencies": {
"@biomejs/biome": "1.5.3",
@@ -1,6 +1,6 @@
import React, { FC, createContext, useState } from "react"
import { JournalFileStorage } from "@optuna/storage"
import { SQLite3Storage } from "@optuna/storage"
import React, { FC, createContext, useState } from "react"
export const StorageContext = createContext<{
storage: OptunaStorage | null
+6 -6
View File
@@ -73,7 +73,7 @@ interface JournalOpSetTrialUserAttr extends JournalOpBase {
user_attr: { [key: string]: any } // eslint-disable-line @typescript-eslint/no-explicit-any
}
const trialStateNumToTrialState = (state: number): TrialState => {
const trialStateNumToTrialState = (state: number): Optuna.TrialState => {
switch (state) {
case 0:
return "Running"
@@ -90,7 +90,7 @@ const trialStateNumToTrialState = (state: number): TrialState => {
}
}
const parseDistribution = (distribution: string): Distribution => {
const parseDistribution = (distribution: string): Optuna.Distribution => {
const distributionJson = JSON.parse(distribution)
if (distributionJson.name === "IntDistribution") {
return {
@@ -114,13 +114,13 @@ const parseDistribution = (distribution: string): Distribution => {
}
class JournalStorage {
private studies: Study[] = []
private studies: Optuna.Study[] = []
private nextStudyId = 0
private studyIdToTrialIDs: Map<number, number[]> = new Map()
private trialIdToStudyId: Map<number, number> = new Map()
private trialID = 0
public getStudies(): Study[] {
public getStudies(): Optuna.Study[] {
for (const study of this.studies) {
const unionUserAttrs: Set<string> = new Set()
const unionSearchSpace: Set<string> = new Set()
@@ -187,7 +187,7 @@ class JournalStorage {
return
}
const params: TrialParam[] =
const params: Optuna.TrialParam[] =
log.params === undefined || log.distributions === undefined
? []
: Object.entries(log.params).map(([name, value]) => {
@@ -254,7 +254,7 @@ class JournalStorage {
this.trialID++
}
private getStudyAndTrial(trial_id: number): [Study?, Trial?] {
private getStudyAndTrial(trial_id: number): [Optuna.Study?, Optuna.Trial?] {
const study = this.studies.find(
(item) => item.study_id === this.trialIdToStudyId.get(trial_id)
)