fix: distribution downloading data do not show

This commit is contained in:
jialin
2025-07-04 16:45:15 +08:00
parent 6943571a6d
commit 3d93eda92d
2 changed files with 39 additions and 18 deletions
+31 -12
View File
@@ -26,7 +26,11 @@ import React, { useCallback, useEffect, useMemo } from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { MODEL_INSTANCE_API } from '../apis'; import { MODEL_INSTANCE_API } from '../apis';
import { InstanceStatusMap, InstanceStatusMapValue, status } from '../config'; import { InstanceStatusMap, InstanceStatusMapValue, status } from '../config';
import { ModelInstanceListItem } from '../config/types'; import {
DistributedServerItem,
DistributedServers,
ModelInstanceListItem
} from '../config/types';
import '../style/instance-item.less'; import '../style/instance-item.less';
const fieldList = [ const fieldList = [
@@ -146,14 +150,24 @@ const RenderRayactorDownloading = (props: {
}; };
const RenderWorkerDownloading = (props: { const RenderWorkerDownloading = (props: {
rayActors: any[]; distributed_servers?: DistributedServers;
workerList: WorkerListItem[]; workerList: WorkerListItem[];
instanceData: ModelInstanceListItem; instanceData: ModelInstanceListItem;
}) => { }) => {
const { rayActors, workerList, instanceData } = props; const { distributed_servers, workerList, instanceData } = props;
const { ray_actors = [], subordinate_workers = [] } =
distributed_servers || {};
let severList: DistributedServerItem[] = [];
if (ray_actors.length > 0) {
severList = ray_actors;
} else if (subordinate_workers.length > 0) {
severList = subordinate_workers;
}
if ( if (
instanceData.state !== InstanceStatusMap.Downloading || instanceData.state !== InstanceStatusMap.Downloading ||
!rayActors.length !severList.length
) { ) {
return null; return null;
} }
@@ -167,7 +181,7 @@ const RenderWorkerDownloading = (props: {
overlayClassName="light-downloading-tooltip" overlayClassName="light-downloading-tooltip"
title={ title={
<RenderRayactorDownloading <RenderRayactorDownloading
severList={rayActors} severList={severList}
workerList={workerList} workerList={workerList}
instanceData={instanceData} instanceData={instanceData}
></RenderRayactorDownloading> ></RenderRayactorDownloading>
@@ -179,7 +193,7 @@ const RenderWorkerDownloading = (props: {
size={16} size={16}
strokeColor="var(--ant-color-success)" strokeColor="var(--ant-color-success)"
percent={ percent={
_.find(rayActors, (item: any) => item.download_progress < 100) _.find(severList, (item: any) => item.download_progress < 100)
?.download_progress || 0 ?.download_progress || 0
} }
/> />
@@ -471,11 +485,14 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
); );
}; };
const renderDistributionInfo = (distributed_servers: Record<string, any>) => { const renderDistributionInfo = (distributed_servers: DistributedServers) => {
const { rpc_servers, ray_actors, subordinate_workers } = const {
distributed_servers; rpc_servers = [],
ray_actors = [],
subordinate_workers = []
} = distributed_servers || {};
let severList: any[] = []; let severList: DistributedServerItem[] = [];
if (rpc_servers?.length > 0) { if (rpc_servers?.length > 0) {
severList = rpc_servers; severList = rpc_servers;
@@ -626,7 +643,9 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
className="flex align-center" className="flex align-center"
> >
{renderOffloadInfo} {renderOffloadInfo}
{renderDistributionInfo(instanceData.distributed_servers || {})} {renderDistributionInfo(
instanceData.distributed_servers || ({} as DistributedServers)
)}
</span> </span>
</Col> </Col>
<Col span={4}> <Col span={4}>
@@ -639,7 +658,7 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
handleChildSelect={handleChildSelect} handleChildSelect={handleChildSelect}
/> />
<RenderWorkerDownloading <RenderWorkerDownloading
rayActors={instanceData.distributed_servers?.ray_actors || []} distributed_servers={instanceData.distributed_servers}
workerList={workerList} workerList={workerList}
instanceData={instanceData} instanceData={instanceData}
></RenderWorkerDownloading> ></RenderWorkerDownloading>
+8 -6
View File
@@ -74,12 +74,18 @@ interface ComputedResourceClaim {
vram: Record<string, number>; vram: Record<string, number>;
} }
interface DistributedServerItem { export interface DistributedServerItem {
pid: number; pid: number;
port: number; port: number;
worker_id: string; worker_id: string;
computed_resource_claim: ComputedResourceClaim; computed_resource_claim: ComputedResourceClaim;
} }
export interface DistributedServers {
rpc_servers: DistributedServerItem[];
ray_actors: DistributedServerItem[];
subordinate_workers: DistributedServerItem[];
}
export interface ModelInstanceListItem { export interface ModelInstanceListItem {
backend?: string; backend?: string;
backend_version?: string; backend_version?: string;
@@ -87,11 +93,7 @@ export interface ModelInstanceListItem {
huggingface_repo_id: string; huggingface_repo_id: string;
huggingface_filename: string; huggingface_filename: string;
ollama_library_model_name: string; ollama_library_model_name: string;
distributed_servers?: { distributed_servers?: DistributedServers;
rpc_servers: DistributedServerItem[];
ray_actors: DistributedServerItem[];
subordinate_workers: DistributedServerItem[];
};
computed_resource_claim?: ComputedResourceClaim; computed_resource_claim?: ComputedResourceClaim;
s3_address: string; s3_address: string;
worker_id: number; worker_id: number;