diff --git a/react-ui/src/app.tsx b/react-ui/src/app.tsx index 65b4440a..857d2650 100644 --- a/react-ui/src/app.tsx +++ b/react-ui/src/app.tsx @@ -245,6 +245,9 @@ export const antd: RuntimeAntdConfig = (memo) => { linkColor: 'rgba(29, 29, 32, 0.7)', separatorColor: 'rgba(29, 29, 32, 0.7)', }; + memo.theme.components.Tree = { + directoryNodeSelectedBg: 'rgba(22, 100, 255, 0.7)', + }; memo.theme.cssVar = true; // memo.theme.hashed = false; diff --git a/react-ui/src/enums/index.ts b/react-ui/src/enums/index.ts index bdfe9e00..afba79b8 100644 --- a/react-ui/src/enums/index.ts +++ b/react-ui/src/enums/index.ts @@ -129,3 +129,23 @@ export const hyperParameterOptimizedModeOptions = [ { label: '越大越好', value: hyperParameterOptimizedMode.Max }, { label: '越小越好', value: hyperParameterOptimizedMode.Min }, ]; + +// 超参数 Trail 运行状态 +export enum HyperParameterTrailStatus { + PENDING = 'PENDING', // 挂起 + RUNNING = 'RUNNING', // 运行中 + TERMINATED = 'TERMINATED', // 成功 + ERROR = 'ERROR', // 错误 + PAUSED = 'PAUSED', // 暂停 + RESTORING = 'RESTORING', // 恢复中 +} + +// 自动 Trail 运行状态 +export enum AutoMLTrailStatus { + TIMEOUT = 'TIMEOUT', // 超时 + SUCCESS = 'SUCCESS', // 成功 + FAILURE = 'FAILURE', // 失败 + CRASHED = 'CRASHED', // 崩溃 + STOP = 'STOP', // 停止 + CANCELLED = 'CANCELLED', // 取消 +} diff --git a/react-ui/src/pages/AutoML/Instance/index.tsx b/react-ui/src/pages/AutoML/Instance/index.tsx index 677cc791..2ccde91f 100644 --- a/react-ui/src/pages/AutoML/Instance/index.tsx +++ b/react-ui/src/pages/AutoML/Instance/index.tsx @@ -186,7 +186,7 @@ function AutoMLInstance() { }, { key: TabKeys.History, - label: 'Trial 列表', + label: '试验列表', icon: , children: ( = { + [AutoMLTrailStatus.SUCCESS]: { + label: '成功', + color: themes.successColor, + icon: '/assets/images/experiment-status/success-icon.png', + }, + [AutoMLTrailStatus.TIMEOUT]: { + label: '超时', + color: themes.pendingColor, + icon: '/assets/images/experiment-status/pending-icon.png', + }, + [AutoMLTrailStatus.FAILURE]: { + label: '失败', + color: themes.errorColor, + icon: '/assets/images/experiment-status/fail-icon.png', + }, + [AutoMLTrailStatus.CRASHED]: { + label: '崩溃', + color: themes.errorColor, + icon: '/assets/images/experiment-status/fail-icon.png', + }, + [AutoMLTrailStatus.CANCELLED]: { + label: '取消', + color: themes.abortColor, + icon: '/assets/images/experiment-status/omitted-icon.png', + }, + [AutoMLTrailStatus.STOP]: { + label: '停止', + color: themes.textColor, + icon: '/assets/images/experiment-status/omitted-icon.png', + }, +}; + +function TrialStatusCell(status?: AutoMLTrailStatus | null) { + if (status === null || status === undefined) { + return --; + } + return ( +
+ {/* */} + + {statusInfo[status] ? statusInfo[status].label : status} + +
+ ); +} + +export default TrialStatusCell; diff --git a/react-ui/src/pages/Experiment/Comparison/index.tsx b/react-ui/src/pages/Experiment/Comparison/index.tsx index b900842c..2a75467c 100644 --- a/react-ui/src/pages/Experiment/Comparison/index.tsx +++ b/react-ui/src/pages/Experiment/Comparison/index.tsx @@ -77,7 +77,7 @@ function ExperimentComparison() { }; // 对比按钮 click - const hanldeComparisonClick = () => { + const handleComparisonClick = () => { if (selectedRowKeys.length < 2) { message.error('请至少选择两项进行对比'); return; @@ -202,7 +202,7 @@ function ExperimentComparison() { return (
-
diff --git a/react-ui/src/pages/HyperParameter/Instance/index.tsx b/react-ui/src/pages/HyperParameter/Instance/index.tsx index d38b0ee6..21f5dfe3 100644 --- a/react-ui/src/pages/HyperParameter/Instance/index.tsx +++ b/react-ui/src/pages/HyperParameter/Instance/index.tsx @@ -191,7 +191,7 @@ function HyperParameterInstance() { }, { key: TabKeys.History, - label: 'Trial 列表', + label: '寻优列表', icon: , children: , }, diff --git a/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.less b/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.less index 8e3e29a2..04160e95 100644 --- a/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.less +++ b/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.less @@ -8,7 +8,8 @@ border-radius: 10px; &__table { - height: 100%; + height: calc(100% - 52px); + margin-top: 20px; } :global { @@ -43,16 +44,31 @@ &__best-tag { margin-left: 8px; padding: 1px 10px; - color: @primary-color; + color: @success-color; font-weight: normal; font-size: 13px; - background-color: .addAlpha(@primary-color, 0.1) []; - border: 1px solid .addAlpha(@primary-color, 0.5) []; + background-color: .addAlpha(@success-color, 0.1) []; + // border: 1px solid .addAlpha(@success-color, 0.5) []; border-radius: 2px; } } .table-best-row { - color: @primary-color; + color: @success-color; font-weight: bold; } + +.trail-result { + :global { + .ant-tree-node-selected { + .trail-result__icon { + color: white; + } + } + + .trail-result__icon { + margin-left: 8px; + color: @primary-color; + } + } +} diff --git a/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx b/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx index 41a897d1..0263bd69 100644 --- a/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx +++ b/react-ui/src/pages/HyperParameter/components/ExperimentHistory/index.tsx @@ -1,23 +1,33 @@ +import InfoGroup from '@/components/InfoGroup'; import KFIcon from '@/components/KFIcon'; -import { HyperParameterFileList, HyperParameterTrialList } from '@/pages/HyperParameter/types'; +import TrialStatusCell from '@/pages/HyperParameter/components/TrialStatusCell'; +import { HyperParameterFile, HyperParameterTrial } from '@/pages/HyperParameter/types'; +import { getExpMetricsReq } from '@/services/hyperParameter'; import { downLoadZip } from '@/utils/downloadfile'; +import { to } from '@/utils/promise'; import tableCellRender, { TableCellValueType } from '@/utils/table'; -import { Button, Table, Tooltip, type TableProps } from 'antd'; +import { App, Button, Table, Tooltip, Tree, type TableProps, type TreeDataNode } from 'antd'; import classNames from 'classnames'; +import { useState } from 'react'; import styles from './index.less'; +const { DirectoryTree } = Tree; + type ExperimentHistoryProps = { - trialList?: HyperParameterTrialList[]; + trialList?: HyperParameterTrial[]; }; function ExperimentHistory({ trialList = [] }: ExperimentHistoryProps) { - const first: HyperParameterTrialList | undefined = trialList[0]; + const [selectedRowKeys, setSelectedRowKeys] = useState([]); + const { message } = App.useApp(); + + const first: HyperParameterTrial | undefined = trialList[0]; const config: Record = first?.config ?? {}; const metricAnalysis: Record = first?.metric_analysis ?? {}; const paramsNames = Object.keys(config); const metricNames = Object.keys(metricAnalysis); - const trialColumns: TableProps['columns'] = [ + const trialColumns: TableProps['columns'] = [ { title: '序号', dataIndex: 'index', @@ -55,7 +65,7 @@ function ExperimentHistory({ trialList = [] }: ExperimentHistoryProps) { dataIndex: 'status', key: 'status', width: 120, - render: tableCellRender(false), + render: TrialStatusCell, }, ]; @@ -105,7 +115,7 @@ function ExperimentHistory({ trialList = [] }: ExperimentHistoryProps) { }); } - const fileColumns: TableProps['columns'] = [ + const fileColumns: TableProps['columns'] = [ { title: '文件名称', dataIndex: 'name', @@ -124,7 +134,7 @@ function ExperimentHistory({ trialList = [] }: ExperimentHistoryProps) { dataIndex: 'option', width: 160, key: 'option', - render: (_: any, record: HyperParameterFileList) => { + render: (_: any, record: HyperParameterFile) => { return (