chore: export action for benchmark item
This commit is contained in:
@@ -2,7 +2,7 @@ import { createFromIconfontCN } from '@ant-design/icons';
|
|||||||
// import './iconfont/iconfont.js';
|
// import './iconfont/iconfont.js';
|
||||||
|
|
||||||
const IconFont = createFromIconfontCN({
|
const IconFont = createFromIconfontCN({
|
||||||
scriptUrl: '//at.alicdn.com/t/c/font_4613488_pxk0gz02dig.js'
|
scriptUrl: '//at.alicdn.com/t/c/font_4613488_lqs6kytf9t8.js'
|
||||||
});
|
});
|
||||||
|
|
||||||
export default IconFont;
|
export default IconFont;
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import DropdownButtons from '@/components/drop-down-buttons';
|
import DropdownButtons from '@/components/drop-down-buttons';
|
||||||
import {
|
import IconFont from '@/components/icon-font';
|
||||||
DeleteOutlined,
|
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
|
||||||
DownloadOutlined,
|
|
||||||
PlusOutlined
|
|
||||||
} from '@ant-design/icons';
|
|
||||||
import { Button, Space } from 'antd';
|
import { Button, Space } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
@@ -30,7 +27,9 @@ const RightActions: React.FC<RightActionsProps> = ({
|
|||||||
{
|
{
|
||||||
label: 'common.button.export',
|
label: 'common.button.export',
|
||||||
key: 'export',
|
key: 'export',
|
||||||
icon: <DownloadOutlined />
|
icon: (
|
||||||
|
<IconFont type="icon-export" style={{ lineHeight: 1, fontSize: 16 }} />
|
||||||
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'common.button.delete',
|
label: 'common.button.delete',
|
||||||
|
|||||||
@@ -30,6 +30,13 @@ const actionList = [
|
|||||||
],
|
],
|
||||||
icon: <IconFont type="icon-logs" />
|
icon: <IconFont type="icon-logs" />
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'export',
|
||||||
|
label: 'common.button.export',
|
||||||
|
icon: (
|
||||||
|
<IconFont type="icon-export" style={{ lineHeight: 1, fontSize: 16 }} />
|
||||||
|
)
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'common.button.downloadLog',
|
label: 'common.button.downloadLog',
|
||||||
key: 'download',
|
key: 'download',
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import ViewLogsModal from './components/view-logs-modal';
|
|||||||
import DetailContext from './config/detail-context';
|
import DetailContext from './config/detail-context';
|
||||||
import { BenchmarkListItem } from './config/types';
|
import { BenchmarkListItem } from './config/types';
|
||||||
import useViewLogs from './hooks/use-view-logs';
|
import useViewLogs from './hooks/use-view-logs';
|
||||||
|
import { useExportBenchmark } from './services/use-export-benchmark';
|
||||||
import useQueryBenchmarkList from './services/use-query-benchmarks';
|
import useQueryBenchmarkList from './services/use-query-benchmarks';
|
||||||
import useQueryDetail from './services/use-query-detail';
|
import useQueryDetail from './services/use-query-detail';
|
||||||
import useStopBenchmark from './services/use-stop-benchmark';
|
import useStopBenchmark from './services/use-stop-benchmark';
|
||||||
@@ -30,6 +31,7 @@ const Details: React.FC = () => {
|
|||||||
const { openViewLogsModal, closeViewLogsModal, openViewLogsModalStatus } =
|
const { openViewLogsModal, closeViewLogsModal, openViewLogsModalStatus } =
|
||||||
useViewLogs();
|
useViewLogs();
|
||||||
const { handleStopBenchmark } = useStopBenchmark();
|
const { handleStopBenchmark } = useStopBenchmark();
|
||||||
|
const { exportData } = useExportBenchmark();
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const name = searchParams.get('name');
|
const name = searchParams.get('name');
|
||||||
const id = searchParams.get('id');
|
const id = searchParams.get('id');
|
||||||
@@ -89,6 +91,8 @@ const Details: React.FC = () => {
|
|||||||
openViewLogsModal(row);
|
openViewLogsModal(row);
|
||||||
} else if (val === 'stop') {
|
} else if (val === 'stop') {
|
||||||
handleStopBenchmark(row.id);
|
handleStopBenchmark(row.id);
|
||||||
|
} else if (val === 'export') {
|
||||||
|
exportData([row.id]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,33 @@ import styled from 'styled-components';
|
|||||||
import { BenchmarkStatus, BenchmarkStatusLabelMap } from '../config';
|
import { BenchmarkStatus, BenchmarkStatusLabelMap } from '../config';
|
||||||
import { BenchmarkListItem as ListItem } from '../config/types';
|
import { BenchmarkListItem as ListItem } from '../config/types';
|
||||||
|
|
||||||
|
const allFields = [
|
||||||
|
'cluster_id',
|
||||||
|
'model_name',
|
||||||
|
'dataset_name',
|
||||||
|
'profile',
|
||||||
|
'gpu_summary',
|
||||||
|
'state',
|
||||||
|
'request_rate',
|
||||||
|
'request_latency_mean',
|
||||||
|
'tokens_per_second_mean',
|
||||||
|
'time_to_first_token_mean',
|
||||||
|
'time_per_output_token_mean',
|
||||||
|
'inter_token_latency_mean',
|
||||||
|
'requests_per_second_mean',
|
||||||
|
'input_tokens_per_second_mean',
|
||||||
|
'output_tokens_per_second_mean',
|
||||||
|
'total_requests',
|
||||||
|
'successful_requests',
|
||||||
|
'failed_requests',
|
||||||
|
'request_concurrency',
|
||||||
|
'created_at'
|
||||||
|
];
|
||||||
|
|
||||||
|
const fieldSortPos: Record<string, number> = Object.fromEntries(
|
||||||
|
allFields.map((field, index) => [field, index + 1])
|
||||||
|
);
|
||||||
|
|
||||||
const SubTitleWrapper = styled.span.attrs({
|
const SubTitleWrapper = styled.span.attrs({
|
||||||
className: 'sub-title'
|
className: 'sub-title'
|
||||||
})`
|
})`
|
||||||
@@ -68,31 +95,16 @@ const useColumnSettings = (options: {
|
|||||||
subTitle: `${intl.formatMessage({ id: 'benchmark.table.avg' })} (ms)`
|
subTitle: `${intl.formatMessage({ id: 'benchmark.table.avg' })} (ms)`
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
pos: 11,
|
|
||||||
dataIndex: 'request_latency_mean',
|
dataIndex: 'request_latency_mean',
|
||||||
path: 'request_latency_mean',
|
path: 'request_latency_mean',
|
||||||
unit: 'ms',
|
unit: 'ms',
|
||||||
sorter: tableSorter(1),
|
sorter: tableSorter(1),
|
||||||
render: (value: number) => round(value, 2)
|
render: (value: number) => round(value, 2)
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: 'TPS',
|
|
||||||
pos: 12,
|
|
||||||
dataIndex: 'tokens_per_second_mean',
|
|
||||||
path: 'tokens_per_second_mean',
|
|
||||||
unit: 'Tokens/s',
|
|
||||||
sorter: tableSorter(1),
|
|
||||||
render: (text: number) => (
|
|
||||||
<AutoTooltip ghost minWidth={20}>
|
|
||||||
{_.round(text, 2)}
|
|
||||||
</AutoTooltip>
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: renderTitle('TTFT', {
|
title: renderTitle('TTFT', {
|
||||||
subTitle: `${intl.formatMessage({ id: 'benchmark.table.avg' })} (ms)`
|
subTitle: `${intl.formatMessage({ id: 'benchmark.table.avg' })} (ms)`
|
||||||
}),
|
}),
|
||||||
pos: 13,
|
|
||||||
sorter: tableSorter(1),
|
sorter: tableSorter(1),
|
||||||
dataIndex: 'time_to_first_token_mean',
|
dataIndex: 'time_to_first_token_mean',
|
||||||
path: 'time_to_first_token_mean',
|
path: 'time_to_first_token_mean',
|
||||||
@@ -107,7 +119,6 @@ const useColumnSettings = (options: {
|
|||||||
title: renderTitle('TPOT', {
|
title: renderTitle('TPOT', {
|
||||||
subTitle: `${intl.formatMessage({ id: 'benchmark.table.avg' })} (ms)`
|
subTitle: `${intl.formatMessage({ id: 'benchmark.table.avg' })} (ms)`
|
||||||
}),
|
}),
|
||||||
pos: 14,
|
|
||||||
sorter: tableSorter(1),
|
sorter: tableSorter(1),
|
||||||
dataIndex: 'time_per_output_token_mean',
|
dataIndex: 'time_per_output_token_mean',
|
||||||
path: 'time_per_output_token_mean',
|
path: 'time_per_output_token_mean',
|
||||||
@@ -122,7 +133,6 @@ const useColumnSettings = (options: {
|
|||||||
title: renderTitle('ITL', {
|
title: renderTitle('ITL', {
|
||||||
subTitle: `${intl.formatMessage({ id: 'benchmark.table.avg' })} (ms)`
|
subTitle: `${intl.formatMessage({ id: 'benchmark.table.avg' })} (ms)`
|
||||||
}),
|
}),
|
||||||
pos: 15,
|
|
||||||
sorter: tableSorter(1),
|
sorter: tableSorter(1),
|
||||||
dataIndex: 'inter_token_latency_mean',
|
dataIndex: 'inter_token_latency_mean',
|
||||||
path: 'inter_token_latency_mean',
|
path: 'inter_token_latency_mean',
|
||||||
@@ -131,7 +141,6 @@ const useColumnSettings = (options: {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'RPS',
|
title: 'RPS',
|
||||||
pos: 16,
|
|
||||||
dataIndex: 'requests_per_second_mean',
|
dataIndex: 'requests_per_second_mean',
|
||||||
sorter: tableSorter(1),
|
sorter: tableSorter(1),
|
||||||
render: (text: string) => (
|
render: (text: string) => (
|
||||||
@@ -140,6 +149,23 @@ const useColumnSettings = (options: {
|
|||||||
</AutoTooltip>
|
</AutoTooltip>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: renderTitle(
|
||||||
|
`${intl.formatMessage({ id: 'benchmark.detail.throughput.totalToken' })}`,
|
||||||
|
{
|
||||||
|
subTitle: '(Tokens/s)'
|
||||||
|
}
|
||||||
|
),
|
||||||
|
dataIndex: 'tokens_per_second_mean',
|
||||||
|
path: 'tokens_per_second_mean',
|
||||||
|
unit: 'Tokens/s',
|
||||||
|
sorter: tableSorter(1),
|
||||||
|
render: (text: number) => (
|
||||||
|
<AutoTooltip ghost minWidth={20}>
|
||||||
|
{_.round(text, 2)}
|
||||||
|
</AutoTooltip>
|
||||||
|
)
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: renderTitle(
|
title: renderTitle(
|
||||||
`${intl.formatMessage({
|
`${intl.formatMessage({
|
||||||
@@ -149,7 +175,6 @@ const useColumnSettings = (options: {
|
|||||||
subTitle: '(Tokens/s)'
|
subTitle: '(Tokens/s)'
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
pos: 17,
|
|
||||||
dataIndex: 'input_tokens_per_second_mean',
|
dataIndex: 'input_tokens_per_second_mean',
|
||||||
path: 'input_tokens_per_second_mean',
|
path: 'input_tokens_per_second_mean',
|
||||||
unit: 'Tokens/s',
|
unit: 'Tokens/s',
|
||||||
@@ -168,7 +193,6 @@ const useColumnSettings = (options: {
|
|||||||
subTitle: '(Tokens/s)'
|
subTitle: '(Tokens/s)'
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
pos: 18,
|
|
||||||
dataIndex: 'output_tokens_per_second_mean',
|
dataIndex: 'output_tokens_per_second_mean',
|
||||||
path: 'output_tokens_per_second_mean',
|
path: 'output_tokens_per_second_mean',
|
||||||
unit: 'Tokens/s',
|
unit: 'Tokens/s',
|
||||||
@@ -182,8 +206,6 @@ const useColumnSettings = (options: {
|
|||||||
title: renderTitle(
|
title: renderTitle(
|
||||||
intl.formatMessage({ id: 'benchmark.detail.requests.total' })
|
intl.formatMessage({ id: 'benchmark.detail.requests.total' })
|
||||||
),
|
),
|
||||||
pos: 19,
|
|
||||||
key: 'total_requests',
|
|
||||||
dataIndex: 'total_requests',
|
dataIndex: 'total_requests',
|
||||||
path: 'total_requests',
|
path: 'total_requests',
|
||||||
precision: 0,
|
precision: 0,
|
||||||
@@ -198,8 +220,6 @@ const useColumnSettings = (options: {
|
|||||||
title: renderTitle(
|
title: renderTitle(
|
||||||
intl.formatMessage({ id: 'benchmark.detail.requests.success' })
|
intl.formatMessage({ id: 'benchmark.detail.requests.success' })
|
||||||
),
|
),
|
||||||
pos: 20,
|
|
||||||
key: 'total_requests',
|
|
||||||
dataIndex: 'successful_requests',
|
dataIndex: 'successful_requests',
|
||||||
path: ['raw_metrics', 'benchmarks', '0'],
|
path: ['raw_metrics', 'benchmarks', '0'],
|
||||||
render: (value: number) =>
|
render: (value: number) =>
|
||||||
@@ -213,8 +233,6 @@ const useColumnSettings = (options: {
|
|||||||
title: renderTitle(
|
title: renderTitle(
|
||||||
intl.formatMessage({ id: 'benchmark.detail.requests.failed' })
|
intl.formatMessage({ id: 'benchmark.detail.requests.failed' })
|
||||||
),
|
),
|
||||||
pos: 21,
|
|
||||||
key: 'total_requests',
|
|
||||||
dataIndex: 'failed_requests',
|
dataIndex: 'failed_requests',
|
||||||
path: ['raw_metrics', 'benchmarks', '0'],
|
path: ['raw_metrics', 'benchmarks', '0'],
|
||||||
render: (value: number) =>
|
render: (value: number) =>
|
||||||
@@ -229,8 +247,6 @@ const useColumnSettings = (options: {
|
|||||||
id: 'benchmark.detail.requests.concurrency'
|
id: 'benchmark.detail.requests.concurrency'
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
pos: 22,
|
|
||||||
key: 'request_concurrency',
|
|
||||||
dataIndex: 'request_concurrency',
|
dataIndex: 'request_concurrency',
|
||||||
path: ['raw_metrics', 'benchmarks', '0'],
|
path: ['raw_metrics', 'benchmarks', '0'],
|
||||||
render: (value: number) =>
|
render: (value: number) =>
|
||||||
@@ -252,22 +268,12 @@ const useColumnSettings = (options: {
|
|||||||
</AutoTooltip>
|
</AutoTooltip>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// title: renderTitle(intl.formatMessage({ id: 'resources.worker' })),
|
|
||||||
// pos: 2,
|
|
||||||
// dataIndex: 'worker_id',
|
|
||||||
// render: (text: string) => (
|
|
||||||
// <AutoTooltip ghost minWidth={20}>
|
|
||||||
// {text}
|
|
||||||
// </AutoTooltip>
|
|
||||||
// )
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
title: renderTitle(
|
title: renderTitle(
|
||||||
intl.formatMessage({ id: 'benchmark.detail.modelName' })
|
intl.formatMessage({ id: 'benchmark.detail.modelName' })
|
||||||
),
|
),
|
||||||
pos: 3,
|
|
||||||
dataIndex: 'model_name',
|
dataIndex: 'model_name',
|
||||||
|
sorter: tableSorter(1),
|
||||||
render: (text: string) => (
|
render: (text: string) => (
|
||||||
<AutoTooltip ghost minWidth={20}>
|
<AutoTooltip ghost minWidth={20}>
|
||||||
{text}
|
{text}
|
||||||
@@ -276,7 +282,6 @@ const useColumnSettings = (options: {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: renderTitle(intl.formatMessage({ id: 'benchmark.table.dataset' })),
|
title: renderTitle(intl.formatMessage({ id: 'benchmark.table.dataset' })),
|
||||||
pos: 4,
|
|
||||||
dataIndex: 'dataset_name',
|
dataIndex: 'dataset_name',
|
||||||
render: (text: string) => (
|
render: (text: string) => (
|
||||||
<AutoTooltip ghost minWidth={20}>
|
<AutoTooltip ghost minWidth={20}>
|
||||||
@@ -286,7 +291,6 @@ const useColumnSettings = (options: {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: renderTitle(intl.formatMessage({ id: 'benchmark.form.profile' })),
|
title: renderTitle(intl.formatMessage({ id: 'benchmark.form.profile' })),
|
||||||
pos: 5,
|
|
||||||
dataIndex: 'profile',
|
dataIndex: 'profile',
|
||||||
render: (text: string) => (
|
render: (text: string) => (
|
||||||
<AutoTooltip ghost minWidth={20}>
|
<AutoTooltip ghost minWidth={20}>
|
||||||
@@ -296,7 +300,6 @@ const useColumnSettings = (options: {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: renderTitle(intl.formatMessage({ id: 'benchmark.table.gpu' })),
|
title: renderTitle(intl.formatMessage({ id: 'benchmark.table.gpu' })),
|
||||||
pos: 6,
|
|
||||||
dataIndex: 'gpu_summary',
|
dataIndex: 'gpu_summary',
|
||||||
render: (text: string) => (
|
render: (text: string) => (
|
||||||
<AutoTooltip ghost minWidth={20}>
|
<AutoTooltip ghost minWidth={20}>
|
||||||
@@ -306,7 +309,6 @@ const useColumnSettings = (options: {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: renderTitle(intl.formatMessage({ id: 'common.table.status' })),
|
title: renderTitle(intl.formatMessage({ id: 'common.table.status' })),
|
||||||
pos: 7,
|
|
||||||
width: 120,
|
width: 120,
|
||||||
dataIndex: 'state',
|
dataIndex: 'state',
|
||||||
render: (value: number, record: ListItem) => (
|
render: (value: number, record: ListItem) => (
|
||||||
@@ -332,7 +334,6 @@ const useColumnSettings = (options: {
|
|||||||
title: renderTitle(
|
title: renderTitle(
|
||||||
intl.formatMessage({ id: 'benchmark.table.requestRate' })
|
intl.formatMessage({ id: 'benchmark.table.requestRate' })
|
||||||
),
|
),
|
||||||
pos: 8,
|
|
||||||
dataIndex: 'request_rate',
|
dataIndex: 'request_rate',
|
||||||
render: (text: string) => (
|
render: (text: string) => (
|
||||||
<AutoTooltip ghost minWidth={20}>
|
<AutoTooltip ghost minWidth={20}>
|
||||||
@@ -342,7 +343,6 @@ const useColumnSettings = (options: {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: renderTitle(intl.formatMessage({ id: 'common.table.createTime' })),
|
title: renderTitle(intl.formatMessage({ id: 'common.table.createTime' })),
|
||||||
pos: 23,
|
|
||||||
dataIndex: 'created_at',
|
dataIndex: 'created_at',
|
||||||
sorter: tableSorter(6),
|
sorter: tableSorter(6),
|
||||||
render: (value: string) => (
|
render: (value: string) => (
|
||||||
@@ -368,7 +368,10 @@ const useColumnSettings = (options: {
|
|||||||
selectedColumns.includes(col.dataIndex as string)
|
selectedColumns.includes(col.dataIndex as string)
|
||||||
);
|
);
|
||||||
// Sort by pos
|
// Sort by pos
|
||||||
selected.sort((a, b) => (a.pos || 0) - (b.pos || 0));
|
selected.sort(
|
||||||
|
(a, b) =>
|
||||||
|
(fieldSortPos[a.dataIndex] || 0) - (fieldSortPos[b.dataIndex] || 0)
|
||||||
|
);
|
||||||
return selected;
|
return selected;
|
||||||
}, [selectedColumns, clusterList]);
|
}, [selectedColumns, clusterList]);
|
||||||
|
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ const Benchmark: React.FC = () => {
|
|||||||
openViewLogsModal(row);
|
openViewLogsModal(row);
|
||||||
} else if (val === 'stop') {
|
} else if (val === 'stop') {
|
||||||
handleStopBenchmark(row.id);
|
handleStopBenchmark(row.id);
|
||||||
|
} else if (val === 'export') {
|
||||||
|
exportData([row.id]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user