chore: create cluster ux
This commit is contained in:
@@ -1,64 +1,17 @@
|
||||
import ScrollerModal from '@/components/scroller-modal';
|
||||
import {
|
||||
AppleOutlined,
|
||||
LinuxOutlined,
|
||||
WindowsOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { TabsProps } from 'antd';
|
||||
import React from 'react';
|
||||
import MacOS from './add-worker-macos';
|
||||
import ContainerInstall from './container-install';
|
||||
|
||||
type ViewModalProps = {
|
||||
open: boolean;
|
||||
token: string;
|
||||
onCancel: () => void;
|
||||
};
|
||||
|
||||
const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||
const { open, onCancel } = props || {};
|
||||
const { open, onCancel, token = '${token}' } = props || {};
|
||||
const intl = useIntl();
|
||||
const [token, setToken] = React.useState('');
|
||||
const [activeKey, setActiveKey] = React.useState('container');
|
||||
|
||||
const items: TabsProps['items'] = [
|
||||
{
|
||||
key: 'container',
|
||||
label: 'Linux',
|
||||
icon: <LinuxOutlined />,
|
||||
children: <ContainerInstall token={token} />
|
||||
},
|
||||
{
|
||||
key: 'macos',
|
||||
label: 'macOS',
|
||||
icon: <AppleOutlined />,
|
||||
children: (
|
||||
<MacOS
|
||||
token={token}
|
||||
platform={{
|
||||
os: 'macOS',
|
||||
downloadurl: 'https://gpustack.ai/',
|
||||
supportVersions: 'resource.register.maos.support'
|
||||
}}
|
||||
/>
|
||||
)
|
||||
},
|
||||
{
|
||||
key: 'windows',
|
||||
label: 'Windows',
|
||||
icon: <WindowsOutlined />,
|
||||
children: (
|
||||
<MacOS
|
||||
token={token}
|
||||
platform={{
|
||||
os: 'Windows',
|
||||
downloadurl: 'https://gpustack.ai/',
|
||||
supportVersions: 'resource.register.windows.support'
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<ScrollerModal
|
||||
|
||||
@@ -42,7 +42,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||
return commandCode?.registerWorker({
|
||||
server: origin,
|
||||
tag: tag,
|
||||
token: '${token}',
|
||||
token: props.token || '${token}',
|
||||
workerip: '${workerip}'
|
||||
});
|
||||
}, [versionInfo, activeKey, props.token, npuKey]);
|
||||
@@ -53,38 +53,8 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||
|
||||
return (
|
||||
<div className="container-install">
|
||||
<ul className="notes">
|
||||
<li>
|
||||
{intl.formatMessage(
|
||||
{ id: 'resources.worker.current.version' },
|
||||
{ version: versionInfo.version }
|
||||
)}
|
||||
</li>
|
||||
<li>
|
||||
<span
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: intl.formatMessage({
|
||||
id: 'resources.worker.driver.install'
|
||||
})
|
||||
}}
|
||||
></span>
|
||||
</li>
|
||||
</ul>
|
||||
<h3 className="font-size-14 font-600">
|
||||
1.{' '}
|
||||
<span
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: intl.formatMessage({ id: 'resources.worker.add.step1' })
|
||||
}}
|
||||
></span>
|
||||
</h3>
|
||||
<HighlightCode
|
||||
code={addWorkerGuide.container.getToken}
|
||||
theme="dark"
|
||||
lang="bash"
|
||||
></HighlightCode>
|
||||
<h3 className="m-t-10 font-size-14 font-600">
|
||||
2. {intl.formatMessage({ id: 'resources.worker.add.step2' })}{' '}
|
||||
1. {intl.formatMessage({ id: 'resources.worker.add.step2' })}{' '}
|
||||
<span
|
||||
className="font-size-12"
|
||||
style={{ color: 'var(--ant-color-text-tertiary)' }}
|
||||
@@ -146,7 +116,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||
></HighlightCode>
|
||||
)}
|
||||
<h3 className="m-b-0 m-t-10 font-size-14 font-600">
|
||||
3. {intl.formatMessage({ id: 'resources.worker.add.step3' })}
|
||||
2. {intl.formatMessage({ id: 'resources.worker.add.step3' })}
|
||||
</h3>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -22,14 +22,14 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
mac: {
|
||||
getToken: 'cat /var/lib/gpustack/token',
|
||||
registerWorker(params: { server: string; token: string }) {
|
||||
return `curl -sfL https://get.gpustack.ai | sh -s - --server-url ${params.server} --token ${params.token}`;
|
||||
return `curl -sfL https://get.gpustack.ai | sh -s - --server-url ${params.server} --registration ${params.token}`;
|
||||
}
|
||||
},
|
||||
win: {
|
||||
getToken:
|
||||
'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw',
|
||||
registerWorker(params: { server: string; token: string }) {
|
||||
return `Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } --server-url '${params.server}' --token '${params.token}'"`;
|
||||
return `Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } --server-url '${params.server}' --registration '${params.token}'"`;
|
||||
}
|
||||
},
|
||||
cuda: {
|
||||
@@ -41,11 +41,14 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
token: string;
|
||||
workerip: string;
|
||||
}) {
|
||||
return `docker run -d \\
|
||||
--net=host \\
|
||||
-v /var/lib/gpustack:/var/lib/gpustack \\
|
||||
--privileged gpustack/gpustack:xxxx \\
|
||||
--registration ${params.token}`;
|
||||
return `docker run -d --name gpustack \\
|
||||
--restart=unless-stopped \\
|
||||
--gpus all \\
|
||||
--network=host \\
|
||||
--ipc=host \\
|
||||
-v gpustack-data:/var/lib/gpustack \\
|
||||
gpustack/gpustack:${params.tag} \\
|
||||
--server-url ${params.server} --registration ${params.token} --worker-ip ${params.workerip}`;
|
||||
}
|
||||
},
|
||||
npu: {
|
||||
@@ -73,7 +76,7 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
--ipc=host \\
|
||||
-v gpustack-data:/var/lib/gpustack \\
|
||||
gpustack/gpustack:${params.tag} \\
|
||||
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
|
||||
--server-url ${params.server} --registration ${params.token} --worker-ip ${params.workerip}`;
|
||||
}
|
||||
},
|
||||
npu310p: {
|
||||
@@ -101,7 +104,7 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
--ipc=host \\
|
||||
-v gpustack-data:/var/lib/gpustack \\
|
||||
gpustack/gpustack:${params.tag}-310p \\
|
||||
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
|
||||
--server-url ${params.server} --registration ${params.token} --worker-ip ${params.workerip}`;
|
||||
}
|
||||
},
|
||||
musa: {
|
||||
@@ -119,7 +122,7 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
--ipc=host \\
|
||||
-v gpustack-data:/var/lib/gpustack \\
|
||||
gpustack/gpustack:${params.tag} \\
|
||||
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
|
||||
--server-url ${params.server} --registration ${params.token} --worker-ip ${params.workerip}`;
|
||||
}
|
||||
},
|
||||
cpu: {
|
||||
@@ -136,7 +139,7 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
--network=host \\
|
||||
-v gpustack-data:/var/lib/gpustack \\
|
||||
gpustack/gpustack:${params.tag} \\
|
||||
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
|
||||
--server-url ${params.server} --registration ${params.token} --worker-ip ${params.workerip}`;
|
||||
}
|
||||
},
|
||||
rocm: {
|
||||
@@ -157,7 +160,7 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
--security-opt seccomp=unconfined \\
|
||||
-v gpustack-data:/var/lib/gpustack \\
|
||||
gpustack/gpustack:${params.tag} \\
|
||||
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
|
||||
--server-url ${params.server} --registration ${params.token} --worker-ip ${params.workerip}`;
|
||||
}
|
||||
},
|
||||
dcu: {
|
||||
@@ -180,7 +183,7 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
--security-opt seccomp=unconfined \\
|
||||
-v gpustack-data:/var/lib/gpustack \\
|
||||
gpustack/gpustack:${params.tag} \\
|
||||
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
|
||||
--server-url ${params.server} --registration ${params.token} --worker-ip ${params.workerip}`;
|
||||
}
|
||||
},
|
||||
corex: {
|
||||
@@ -201,7 +204,7 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
--ipc=host \\
|
||||
-v gpustack-data:/var/lib/gpustack \\
|
||||
gpustack/gpustack:${params.tag} \\
|
||||
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
|
||||
--server-url ${params.server} --registration ${params.token} --worker-ip ${params.workerip}`;
|
||||
}
|
||||
},
|
||||
container: {
|
||||
@@ -216,8 +219,8 @@ export const containerInstallOptions = [
|
||||
{ label: 'Ascend CANN', value: 'npu' },
|
||||
{ label: 'Hygon DTK', value: 'dcu' },
|
||||
{ label: 'Moore Threads MUSA', value: 'musa' },
|
||||
{ label: 'Iluvatar Corex', value: 'corex' },
|
||||
{ label: 'CPU', value: 'cpu' }
|
||||
{ label: 'Iluvatar Corex', value: 'corex' }
|
||||
// { label: 'CPU', value: 'cpu' }
|
||||
];
|
||||
|
||||
export const ModelfileStateMap = {
|
||||
|
||||
Reference in New Issue
Block a user