|
|
|
|
@ -28,6 +28,7 @@ import {
|
|
|
|
|
message
|
|
|
|
|
} from 'antd';
|
|
|
|
|
import _ from 'lodash';
|
|
|
|
|
import moment from 'moment';
|
|
|
|
|
import React, { useCallback, useState } from 'react';
|
|
|
|
|
import { useHotkeys } from 'react-hotkeys-hook';
|
|
|
|
|
import {
|
|
|
|
|
@ -41,23 +42,6 @@ import { Filesystem, GPUDeviceItem, ListItem } from '../config/types';
|
|
|
|
|
import AddWorker from './add-worker';
|
|
|
|
|
import UpdateLabels from './update-labels';
|
|
|
|
|
|
|
|
|
|
const nodes = [
|
|
|
|
|
{
|
|
|
|
|
taskName: 'qwen3-0.6b-hhf',
|
|
|
|
|
cpu: 2,
|
|
|
|
|
memory: 0,
|
|
|
|
|
gpuMemory: '12GB',
|
|
|
|
|
createdAt: '2025-08-12 15:24:54'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
taskName: 'qwen2.5-vl-7b-instruct-test-uds',
|
|
|
|
|
cpu: 2,
|
|
|
|
|
memory: 10,
|
|
|
|
|
gpuMemory: '24GB',
|
|
|
|
|
createdAt: '2025-08-12 15:24:54'
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const { Column } = Table;
|
|
|
|
|
|
|
|
|
|
const fieldList = [
|
|
|
|
|
@ -230,6 +214,8 @@ const Workers: React.FC = () => {
|
|
|
|
|
enabled: !open
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
console.log(dataSource.dataList, 'data');
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<PageContainer
|
|
|
|
|
@ -274,15 +260,36 @@ const Workers: React.FC = () => {
|
|
|
|
|
key={dataSource.dataList?.map((e) => e.id)?.join('、') || 0}
|
|
|
|
|
expandable={{
|
|
|
|
|
defaultExpandAllRows: true,
|
|
|
|
|
expandedRowRender: (record) => (
|
|
|
|
|
rowExpandable: (record) => record?.model_instances?.length > 0,
|
|
|
|
|
expandedRowRender: (record: any) => (
|
|
|
|
|
<Flex style={{ padding: '8px 0' }} vertical={true} gap={10}>
|
|
|
|
|
{nodes.map((node, index) => (
|
|
|
|
|
{record?.model_instances?.map((node: any, index: number) => (
|
|
|
|
|
<Row key={index}>
|
|
|
|
|
<Col flex="1">任务名称:{node.taskName}</Col>
|
|
|
|
|
<Col flex="1">分配CPU:{node.cpu}核</Col>
|
|
|
|
|
<Col flex="1">分配内存:{node.memory}</Col>
|
|
|
|
|
<Col flex="1">分配显存:{node.gpuMemory}</Col>
|
|
|
|
|
<Col flex="1">创建时间:{node.createdAt}</Col>
|
|
|
|
|
<Col flex="1">任务名称:{node.name}</Col>
|
|
|
|
|
<Col flex="1">
|
|
|
|
|
分配内存:
|
|
|
|
|
{convertFileSize(
|
|
|
|
|
node?.computed_resource_claim?.ram || 0
|
|
|
|
|
)}
|
|
|
|
|
</Col>
|
|
|
|
|
<Col flex="1">
|
|
|
|
|
分配显存:{' '}
|
|
|
|
|
{convertFileSize(
|
|
|
|
|
(
|
|
|
|
|
Object.values(
|
|
|
|
|
node?.computed_resource_claim?.vram || {}
|
|
|
|
|
) as number[]
|
|
|
|
|
).reduce((acc, curr) => acc + curr, 0)
|
|
|
|
|
)}
|
|
|
|
|
</Col>
|
|
|
|
|
<Col flex="1">
|
|
|
|
|
创建时间:
|
|
|
|
|
{node?.last_restart_time
|
|
|
|
|
? moment(node?.last_restart_time).format(
|
|
|
|
|
'YYYY-MM-DD HH:mm:ss'
|
|
|
|
|
)
|
|
|
|
|
: '--'}
|
|
|
|
|
</Col>
|
|
|
|
|
<Col flex="61px">
|
|
|
|
|
<Button type="link" href="#/models/deployments">
|
|
|
|
|
管理
|
|
|
|
|
@ -292,19 +299,20 @@ const Workers: React.FC = () => {
|
|
|
|
|
))}
|
|
|
|
|
</Flex>
|
|
|
|
|
),
|
|
|
|
|
expandIcon: ({ expanded, onExpand, record }) => (
|
|
|
|
|
<Button
|
|
|
|
|
type="text"
|
|
|
|
|
size="small"
|
|
|
|
|
onClick={(e) => onExpand(record, e)}
|
|
|
|
|
>
|
|
|
|
|
<IconFont
|
|
|
|
|
type="icon-down"
|
|
|
|
|
rotate={expanded ? 0 : -90}
|
|
|
|
|
style={{ fontSize: '12px' }}
|
|
|
|
|
></IconFont>
|
|
|
|
|
</Button>
|
|
|
|
|
)
|
|
|
|
|
expandIcon: ({ expanded, onExpand, record }) =>
|
|
|
|
|
record?.model_instances?.length > 0 ? (
|
|
|
|
|
<Button
|
|
|
|
|
type="text"
|
|
|
|
|
size="small"
|
|
|
|
|
onClick={(e) => onExpand(record, e)}
|
|
|
|
|
>
|
|
|
|
|
<IconFont
|
|
|
|
|
type="icon-down"
|
|
|
|
|
rotate={expanded ? 0 : -90}
|
|
|
|
|
style={{ fontSize: '12px' }}
|
|
|
|
|
/>
|
|
|
|
|
</Button>
|
|
|
|
|
) : null
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Column
|
|
|
|
|
|