fix: update command of adding worker
This commit is contained in:
@@ -68,8 +68,12 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
|
||||
'clusters.addworker.checkEnv': 'Check Environment',
|
||||
'clusters.addworker.specifyArgs': 'Specify Arguments',
|
||||
'clusters.addworker.runCommand': 'Run Command',
|
||||
'clusters.addworker.specifyWorkerIP': 'Specify Worker IP',
|
||||
'clusters.addworker.detectWorkerIP': 'Auto-detect Worker IP',
|
||||
'clusters.addworker.specifyWorkerIP':
|
||||
'Specify Worker IP <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.detectWorkerIP':
|
||||
'Auto-detect Worker IP <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.externalIP.tips':
|
||||
'Specify an external IP if the worker is in a VPC or private network.',
|
||||
'clusters.addworker.enterWorkerIP': 'Enter worker IP',
|
||||
'clusters.addworker.enterWorkerIP.error': 'Please enter the worker IP.',
|
||||
'clusters.addworker.extraVolume': 'Additional Volume Mount',
|
||||
@@ -78,7 +82,8 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
|
||||
'If you want to customize the model cache directory, you can specify the path to mount it.',
|
||||
'clusters.addworker.configSummary': 'Configuration Summary',
|
||||
'clusters.addworker.gpuVendor': 'GPU Vendor',
|
||||
'clusters.addworker.workerIP': 'Worker IP',
|
||||
'clusters.addworker.workerIP':
|
||||
'Worker IP <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.notSpecified': 'Not Specified',
|
||||
'clusters.addworker.autoDetect': 'Auto-detect',
|
||||
'clusters.addworker.extraVolume.holder':
|
||||
|
||||
@@ -68,8 +68,12 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
|
||||
'clusters.addworker.checkEnv': 'Check Environment',
|
||||
'clusters.addworker.specifyArgs': 'Specify Arguments',
|
||||
'clusters.addworker.runCommand': 'Run Command',
|
||||
'clusters.addworker.specifyWorkerIP': 'Specify Worker IP',
|
||||
'clusters.addworker.detectWorkerIP': 'Auto-detect Worker IP',
|
||||
'clusters.addworker.specifyWorkerIP':
|
||||
'Specify Worker IP <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.externalIP.tips':
|
||||
'Specify an external IP if the worker is in a VPC or private network.',
|
||||
'clusters.addworker.detectWorkerIP':
|
||||
'Auto-detect Worker IP <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.enterWorkerIP': 'Enter worker IP',
|
||||
'clusters.addworker.enterWorkerIP.error': 'Please enter the worker IP.',
|
||||
'clusters.addworker.extraVolume': 'Additional Volume Mount',
|
||||
@@ -78,7 +82,8 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
|
||||
'If you want to customize the model cache directory, you can specify the path to mount it.',
|
||||
'clusters.addworker.configSummary': 'Configuration Summary',
|
||||
'clusters.addworker.gpuVendor': 'GPU Vendor',
|
||||
'clusters.addworker.workerIP': 'Worker IP',
|
||||
'clusters.addworker.workerIP':
|
||||
'Worker IP <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.notSpecified': 'Not Specified',
|
||||
'clusters.addworker.autoDetect': 'Auto-detect',
|
||||
'clusters.addworker.extraVolume.holder':
|
||||
@@ -171,7 +176,7 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
|
||||
// 61. 'clusters.addworker.extraVolume': 'Additional Volume Mount',
|
||||
// 62. 'clusters.addworker.configSummary': 'Configuration Summary',
|
||||
// 63. 'clusters.addworker.gpuVendor': 'GPU Vendor',
|
||||
// 64. 'clusters.addworker.workerIP': 'Worker IP',
|
||||
// 64. 'clusters.addworker.workerIP': 'Worker IP <span class="text-tertiary">{type}</span>',
|
||||
// 65. 'clusters.addworker.notSpecified': 'Not Specified',
|
||||
// 66. 'clusters.addworker.autoDetect': 'Auto-detect',
|
||||
// 67. 'clusters.addworker.extraVolume.holder': 'e.g. /data/models (path must start with /)'
|
||||
@@ -191,5 +196,6 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
|
||||
// 78. 'clusters.addworker.dataVolume.tips': 'Specify a data storage path for GPUStack.',
|
||||
// 79. 'clusters.table.ip.internal': 'Internal',
|
||||
// 80. 'clusters.table.ip.external': 'External',
|
||||
// 81. 'clusters.form.serverUrl.tips': 'Specify the server URL accessible from your cloud provider.'
|
||||
// 81. 'clusters.form.serverUrl.tips': 'Specify the server URL accessible from your cloud provider.',
|
||||
// 82. 'clusters.addworker.externalIP.tips': 'Specify an external IP if the worker is in a VPC or private network.',
|
||||
// ========== End of To-Do List ==========
|
||||
|
||||
@@ -68,8 +68,12 @@ export default {
|
||||
'clusters.addworker.checkEnv': 'Проверить окружение',
|
||||
'clusters.addworker.specifyArgs': 'Указать аргументы',
|
||||
'clusters.addworker.runCommand': 'Выполнить команду',
|
||||
'clusters.addworker.specifyWorkerIP': 'Указать IP воркера',
|
||||
'clusters.addworker.detectWorkerIP': 'Автоопределение IP воркера',
|
||||
'clusters.addworker.specifyWorkerIP':
|
||||
'Указать IP воркера <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.externalIP.tips':
|
||||
'Specify an external IP if the worker is in a VPC or private network.',
|
||||
'clusters.addworker.detectWorkerIP':
|
||||
'Автоопределение IP воркера <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.enterWorkerIP': 'Введите IP воркера',
|
||||
'clusters.addworker.enterWorkerIP.error': 'Пожалуйста, введите IP воркера.',
|
||||
'clusters.addworker.extraVolume': 'Дополнительное монтирование тома',
|
||||
@@ -78,7 +82,8 @@ export default {
|
||||
'If you want to customize the model cache directory, you can specify the path to mount it.',
|
||||
'clusters.addworker.configSummary': 'Сводка конфигурации',
|
||||
'clusters.addworker.gpuVendor': 'Производитель GPU',
|
||||
'clusters.addworker.workerIP': 'IP воркера',
|
||||
'clusters.addworker.workerIP':
|
||||
'IP воркера <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.notSpecified': 'Не указано',
|
||||
'clusters.addworker.autoDetect': 'Автоопределение',
|
||||
'clusters.addworker.extraVolume.holder':
|
||||
@@ -123,4 +128,5 @@ export default {
|
||||
// 10. 'clusters.table.ip.internal': 'Internal',
|
||||
// 11. 'clusters.table.ip.external': 'External',
|
||||
// 12. 'clusters.form.serverUrl.tips': 'Specify the server URL accessible from your cloud provider.'
|
||||
// 13. 'clusters.addworker.specifyWorkerIP': 'Specify Worker IP <span class="text-tertiary">{type}</span>',
|
||||
// ================================================================
|
||||
|
||||
@@ -66,8 +66,12 @@ export default {
|
||||
'clusters.addworker.checkEnv': '检查环境',
|
||||
'clusters.addworker.specifyArgs': '指定参数',
|
||||
'clusters.addworker.runCommand': '运行指令',
|
||||
'clusters.addworker.specifyWorkerIP': '指定 Worker IP',
|
||||
'clusters.addworker.detectWorkerIP': '自动检测 Worker IP',
|
||||
'clusters.addworker.specifyWorkerIP':
|
||||
'指定 Worker IP <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.detectWorkerIP':
|
||||
'自动检测 Worker IP <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.externalIP.tips':
|
||||
'当 worker 位于 VPC 或私有网络时,需要指定外部 IP。',
|
||||
'clusters.addworker.enterWorkerIP': '输入节点 IP',
|
||||
'clusters.addworker.enterWorkerIP.error': '请输入节点 IP',
|
||||
'clusters.addworker.extraVolume': '额外卷挂载',
|
||||
@@ -76,7 +80,8 @@ export default {
|
||||
'如果你想自定义模型缓存目录,可以指定路径进行挂载。',
|
||||
'clusters.addworker.configSummary': '配置摘要',
|
||||
'clusters.addworker.gpuVendor': 'GPU 厂商',
|
||||
'clusters.addworker.workerIP': '节点 IP',
|
||||
'clusters.addworker.workerIP':
|
||||
'节点 IP <span class="text-tertiary">{type}</span>',
|
||||
'clusters.addworker.notSpecified': '未指定',
|
||||
'clusters.addworker.autoDetect': '自动检测',
|
||||
'clusters.addworker.extraVolume.holder':
|
||||
|
||||
@@ -54,6 +54,7 @@ const ClusterCreate = () => {
|
||||
image: string;
|
||||
server_url: string;
|
||||
cluster_id: number;
|
||||
[key: string]: any;
|
||||
}>({
|
||||
token: '',
|
||||
image: '',
|
||||
|
||||
@@ -9,15 +9,18 @@ type ViewModalProps = {
|
||||
cacheDir?: string;
|
||||
containerName?: string;
|
||||
gpustackDataVolume?: string;
|
||||
advertisAddress?: string;
|
||||
registrationInfo: {
|
||||
token: string;
|
||||
image: string;
|
||||
server_url: string;
|
||||
[key: string]: any;
|
||||
};
|
||||
};
|
||||
|
||||
const AddWorkerCommand: React.FC<ViewModalProps> = ({
|
||||
registrationInfo,
|
||||
advertisAddress,
|
||||
workerIP,
|
||||
modelDir,
|
||||
cacheDir,
|
||||
@@ -29,9 +32,11 @@ const AddWorkerCommand: React.FC<ViewModalProps> = ({
|
||||
const commandCode = addWorkerGuide['all'];
|
||||
return commandCode
|
||||
?.registerWorker({
|
||||
registrationInfo,
|
||||
gpu: currentGPU || '',
|
||||
server: registrationInfo.server_url || origin,
|
||||
tag: '',
|
||||
advertisAddress: advertisAddress,
|
||||
workerIP: workerIP,
|
||||
modelDir: modelDir,
|
||||
cacheDir: cacheDir,
|
||||
@@ -50,7 +55,8 @@ const AddWorkerCommand: React.FC<ViewModalProps> = ({
|
||||
modelDir,
|
||||
cacheDir,
|
||||
containerName,
|
||||
gpustackDataVolume
|
||||
gpustackDataVolume,
|
||||
advertisAddress
|
||||
]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -42,6 +42,7 @@ type AddWorkerProps = {
|
||||
image: string;
|
||||
server_url: string;
|
||||
cluster_id: number;
|
||||
[key: string]: any;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -59,6 +59,11 @@ export interface SummaryDataKeys {
|
||||
enabled: boolean;
|
||||
path: string;
|
||||
};
|
||||
externalWorkerIPConfig: {
|
||||
enable: boolean;
|
||||
ip: string;
|
||||
required: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export type SummaryDataMap = {
|
||||
|
||||
@@ -9,13 +9,17 @@ import VendorNotes from './vendor-notes';
|
||||
|
||||
const DockerRunCommand = () => {
|
||||
const intl = useIntl();
|
||||
const { registrationInfo, stepList, summary, clusterList } =
|
||||
useAddWorkerContext();
|
||||
const { registrationInfo, stepList, summary } = useAddWorkerContext();
|
||||
const workerIPConfig = summary.get('workerIPConfig') || {
|
||||
enable: false,
|
||||
ip: '',
|
||||
required: false
|
||||
};
|
||||
const externalWorkerIPConfig = summary.get('externalWorkerIPConfig') || {
|
||||
enable: false,
|
||||
ip: '',
|
||||
required: false
|
||||
};
|
||||
const modelDirConfig = summary.get('modelDirConfig') || {
|
||||
enable: false,
|
||||
path: '',
|
||||
@@ -62,6 +66,9 @@ const DockerRunCommand = () => {
|
||||
</Tips>
|
||||
<AddWorkerCommand
|
||||
registrationInfo={registrationInfo}
|
||||
advertisAddress={
|
||||
externalWorkerIPConfig.enable ? externalWorkerIPConfig.ip : ''
|
||||
}
|
||||
workerIP={workerIPConfig.enable ? workerIPConfig.ip : ''}
|
||||
modelDir={modelDirConfig.enable ? modelDirConfig.path : ''}
|
||||
cacheDir={cacheDirConfig.enable ? cacheDirConfig.path : ''}
|
||||
|
||||
@@ -16,7 +16,7 @@ const ButtonWrapper = styled.div`
|
||||
`;
|
||||
|
||||
const SwitchSetting: React.FC<{
|
||||
label: string;
|
||||
label: React.ReactNode;
|
||||
checked: boolean;
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
@@ -88,6 +88,13 @@ const SpecifyArguments = () => {
|
||||
ip: '',
|
||||
required: false
|
||||
};
|
||||
|
||||
const externalWorkerIPConfig = summary.get('externalWorkerIPConfig') || {
|
||||
enable: false,
|
||||
ip: '',
|
||||
required: false
|
||||
};
|
||||
|
||||
const modelDirConfig = summary.get('modelDirConfig') || {
|
||||
enable: false,
|
||||
path: ''
|
||||
@@ -143,6 +150,15 @@ const SpecifyArguments = () => {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (externalWorkerIPConfig.enable && !externalWorkerIPConfig.ip) {
|
||||
updateField('externalWorkerIPConfig', {
|
||||
...externalWorkerIPConfig,
|
||||
required: true
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -189,6 +205,12 @@ const SpecifyArguments = () => {
|
||||
enable: true,
|
||||
path: 'gpustack-data'
|
||||
});
|
||||
|
||||
updateField('externalWorkerIPConfig', {
|
||||
enable: false,
|
||||
ip: '',
|
||||
required: false
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -213,13 +235,27 @@ const SpecifyArguments = () => {
|
||||
{/* worker IP config */}
|
||||
<SwitchSetting
|
||||
label={
|
||||
workerIPConfig.enable
|
||||
? intl.formatMessage({
|
||||
id: 'clusters.addworker.specifyWorkerIP'
|
||||
})
|
||||
: intl.formatMessage({
|
||||
id: 'clusters.addworker.detectWorkerIP'
|
||||
})
|
||||
<span
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: workerIPConfig.enable
|
||||
? intl.formatMessage(
|
||||
{
|
||||
id: 'clusters.addworker.specifyWorkerIP'
|
||||
},
|
||||
{
|
||||
type: ` (${intl.formatMessage({ id: 'clusters.table.ip.internal' })})`
|
||||
}
|
||||
)
|
||||
: intl.formatMessage(
|
||||
{
|
||||
id: 'clusters.addworker.detectWorkerIP'
|
||||
},
|
||||
{
|
||||
type: ` (${intl.formatMessage({ id: 'clusters.table.ip.internal' })})`
|
||||
}
|
||||
)
|
||||
}}
|
||||
></span>
|
||||
}
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'clusters.addworker.enterWorkerIP'
|
||||
@@ -274,6 +310,83 @@ const SpecifyArguments = () => {
|
||||
)
|
||||
}
|
||||
></SwitchSetting>
|
||||
{/* external worker ip config */}
|
||||
<SwitchSetting
|
||||
label={
|
||||
<span
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: externalWorkerIPConfig.enable
|
||||
? intl.formatMessage(
|
||||
{
|
||||
id: 'clusters.addworker.specifyWorkerIP'
|
||||
},
|
||||
{
|
||||
type: ` (${intl.formatMessage({ id: 'clusters.table.ip.external' })})`
|
||||
}
|
||||
)
|
||||
: intl.formatMessage(
|
||||
{
|
||||
id: 'clusters.addworker.detectWorkerIP'
|
||||
},
|
||||
{
|
||||
type: ` (${intl.formatMessage({ id: 'clusters.table.ip.external' })})`
|
||||
}
|
||||
)
|
||||
}}
|
||||
></span>
|
||||
}
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'clusters.addworker.enterWorkerIP'
|
||||
})}
|
||||
value={externalWorkerIPConfig.ip}
|
||||
checked={externalWorkerIPConfig.enable}
|
||||
errorMessage={
|
||||
externalWorkerIPConfig.required &&
|
||||
!externalWorkerIPConfig.ip &&
|
||||
intl.formatMessage({
|
||||
id: 'clusters.addworker.enterWorkerIP.error'
|
||||
})
|
||||
}
|
||||
onChange={(checked) =>
|
||||
updateField('externalWorkerIPConfig', {
|
||||
...externalWorkerIPConfig,
|
||||
enable: checked,
|
||||
required: false
|
||||
})
|
||||
}
|
||||
onInputChange={(value) =>
|
||||
updateField('externalWorkerIPConfig', {
|
||||
...externalWorkerIPConfig,
|
||||
ip: value
|
||||
})
|
||||
}
|
||||
extra={
|
||||
!externalWorkerIPConfig.enable && (
|
||||
<AlertInfoBlock
|
||||
maxHeight={200}
|
||||
contentStyle={{
|
||||
paddingLeft: 0
|
||||
}}
|
||||
type="warning"
|
||||
icon={<ExclamationCircleFilled />}
|
||||
message={
|
||||
<NotesWrapper>
|
||||
<li
|
||||
style={{
|
||||
marginLeft: '0 !important',
|
||||
listStyleType: 'none'
|
||||
}}
|
||||
>
|
||||
{intl.formatMessage({
|
||||
id: 'clusters.addworker.externalIP.tips'
|
||||
})}
|
||||
</li>
|
||||
</NotesWrapper>
|
||||
}
|
||||
></AlertInfoBlock>
|
||||
)
|
||||
}
|
||||
></SwitchSetting>
|
||||
{/* cache directory config */}
|
||||
<SwitchSetting
|
||||
label={intl.formatMessage({ id: 'clusters.addworker.cacheVolume' })}
|
||||
|
||||
@@ -14,7 +14,7 @@ interface DataItemProps {
|
||||
enable: boolean;
|
||||
value: string;
|
||||
required?: boolean;
|
||||
label: string;
|
||||
label: React.ReactNode;
|
||||
tips?: string;
|
||||
}
|
||||
|
||||
@@ -99,6 +99,11 @@ const SummaryData: React.FC = () => {
|
||||
path: ''
|
||||
};
|
||||
|
||||
const externalWorkerIPConfig = summary.get('externalWorkerIPConfig') || {
|
||||
enable: false,
|
||||
ip: ''
|
||||
};
|
||||
|
||||
return (
|
||||
<ConfigWrapper>
|
||||
<Title>
|
||||
@@ -120,7 +125,18 @@ const SummaryData: React.FC = () => {
|
||||
></DataItem>
|
||||
|
||||
<DataItem
|
||||
label={intl.formatMessage({ id: 'clusters.addworker.workerIP' })}
|
||||
label={
|
||||
<span
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: intl.formatMessage(
|
||||
{ id: 'clusters.addworker.workerIP' },
|
||||
{
|
||||
type: `(${intl.formatMessage({ id: 'clusters.table.ip.internal' })})`
|
||||
}
|
||||
)
|
||||
}}
|
||||
></span>
|
||||
}
|
||||
tips={
|
||||
workerIPConfig.enable
|
||||
? workerIPConfig.ip
|
||||
@@ -133,6 +149,31 @@ const SummaryData: React.FC = () => {
|
||||
required={true}
|
||||
></DataItem>
|
||||
|
||||
<DataItem
|
||||
label={
|
||||
<span
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: intl.formatMessage(
|
||||
{ id: 'clusters.addworker.workerIP' },
|
||||
{
|
||||
type: `(${intl.formatMessage({ id: 'clusters.table.ip.external' })})`
|
||||
}
|
||||
)
|
||||
}}
|
||||
></span>
|
||||
}
|
||||
tips={
|
||||
externalWorkerIPConfig.enable
|
||||
? externalWorkerIPConfig.ip
|
||||
? ''
|
||||
: intl.formatMessage({ id: 'clusters.addworker.notSpecified' })
|
||||
: intl.formatMessage({ id: 'clusters.addworker.autoDetect' })
|
||||
}
|
||||
enable={externalWorkerIPConfig.enable}
|
||||
value={externalWorkerIPConfig.ip}
|
||||
required={true}
|
||||
></DataItem>
|
||||
|
||||
<DataItem
|
||||
label={intl.formatMessage({ id: 'clusters.addworker.extraVolume' })}
|
||||
enable={modelDirConfig.enable}
|
||||
|
||||
@@ -73,8 +73,8 @@ const usePoolsColumns = (
|
||||
}
|
||||
}}
|
||||
data={{
|
||||
vendor: record.instance_spec.vendor,
|
||||
description: record.instance_spec.description,
|
||||
vendor: record.instance_spec?.vendor,
|
||||
description: record.instance_spec?.description,
|
||||
specInfo: _.omit(record.instance_spec, [
|
||||
'label',
|
||||
'vendor',
|
||||
@@ -83,11 +83,11 @@ const usePoolsColumns = (
|
||||
}}
|
||||
/>
|
||||
}
|
||||
showTitle
|
||||
SHOWTITLE
|
||||
ghost
|
||||
minWidth={20}
|
||||
>
|
||||
{record.instance_spec.description || record.instance_spec.label}
|
||||
{record.instance_spec?.description || record.instance_spec?.label}
|
||||
</AutoTooltip>
|
||||
)
|
||||
},
|
||||
|
||||
@@ -143,9 +143,23 @@ interface AddWorkerCommandParams {
|
||||
cacheDir?: string;
|
||||
}
|
||||
|
||||
const generateEnvArgs = (params: any) => {
|
||||
const registrationInfo = params.registrationInfo || {};
|
||||
// generate environment variables args from registrationInfo.env
|
||||
let envArgs = '';
|
||||
if (registrationInfo.env && typeof registrationInfo.env === 'object') {
|
||||
Object.keys(registrationInfo.env).forEach((key) => {
|
||||
const value = registrationInfo.env[key];
|
||||
envArgs += `-e "${key}=${value}" \\\n `;
|
||||
});
|
||||
}
|
||||
return envArgs;
|
||||
};
|
||||
|
||||
const setNormalArgs = (params: any) => {
|
||||
return `sudo docker run -d --name ${params.containerName || 'gpustack-worker'} \\
|
||||
-e "GPUSTACK_RUNTIME_DEPLOY_MIRRORED_NAME=${params.containerName || 'gpustack-worker'}" \\
|
||||
${generateEnvArgs(params)}
|
||||
--restart=unless-stopped \\
|
||||
--privileged \\
|
||||
--network=host \\
|
||||
@@ -155,6 +169,11 @@ const setNormalArgs = (params: any) => {
|
||||
${params.cacheDir ? `--volume ${params.cacheDir}:/var/lib/gpustack/cache \\` : ''}`;
|
||||
};
|
||||
|
||||
const setWorkerIPArg = (params: any) => {
|
||||
return `${params.workerIP ? `--worker-ip ${params.workerIP} \\` : ''}
|
||||
${params.advertisAddress ? `--advertise-address ${params.advertisAddress} \\` : ''}`;
|
||||
};
|
||||
|
||||
const setImageArgs = (params: any) => {
|
||||
return `${params.image} \\
|
||||
--server-url ${params.server} \\
|
||||
@@ -171,7 +190,7 @@ const registerWorker = (params: AddWorkerCommandParams) => {
|
||||
return `${commonArgs}
|
||||
--runtime ${config.runtime} \\
|
||||
${imageArgs}
|
||||
${params.workerIP ? `--advertise-address ${params.workerIP} \\` : ''}`;
|
||||
${setWorkerIPArg(params)}`;
|
||||
};
|
||||
|
||||
// avaliable for AMD
|
||||
@@ -184,7 +203,7 @@ const registerAMDWorker = (params: AddWorkerCommandParams) => {
|
||||
--volume /opt/rocm:/opt/rocm:ro \\
|
||||
--runtime ${config.runtime} \\
|
||||
${imageArgs}
|
||||
${params.workerIP ? `--advertise-address ${params.workerIP} \\` : ''}`;
|
||||
${setWorkerIPArg(params)}`;
|
||||
};
|
||||
|
||||
// avaliable for Ascend
|
||||
@@ -196,7 +215,7 @@ const registerAscendWorker = (params: AddWorkerCommandParams) => {
|
||||
--env "ASCEND_VISIBLE_DEVICES=$(sudo ls /dev/davinci* | head -1 | grep -o '[0-9]\\+' || echo "0")" \\
|
||||
--runtime ${config.runtime} \\
|
||||
${imageArgs}
|
||||
${params.workerIP ? `--advertise-address ${params.workerIP} \\` : ''}`;
|
||||
${setWorkerIPArg(params)}`;
|
||||
};
|
||||
|
||||
const registerHygonWorker = (params: AddWorkerCommandParams) => {
|
||||
@@ -209,7 +228,7 @@ const registerHygonWorker = (params: AddWorkerCommandParams) => {
|
||||
--env ROCM_PATH=/opt/dtk \\
|
||||
--env ROCM_SMI_LIB_PATH=/opt/hyhal/lib \\
|
||||
${imageArgs}
|
||||
${params.workerIP ? `--advertise-address ${params.workerIP} \\` : ''}`;
|
||||
${setWorkerIPArg(params)}`;
|
||||
};
|
||||
|
||||
const registerIluvatarWorker = (params: AddWorkerCommandParams) => {
|
||||
@@ -222,7 +241,7 @@ const registerIluvatarWorker = (params: AddWorkerCommandParams) => {
|
||||
--volume /usr/bin/ixsmi:/usr/bin/ixsmi \\
|
||||
--runtime ${config.runtime} \\
|
||||
${imageArgs}
|
||||
${params.workerIP ? `--advertise-address ${params.workerIP} \\` : ''}`;
|
||||
${setWorkerIPArg(params)}`;
|
||||
};
|
||||
|
||||
const registerMetaXWorker = (params: AddWorkerCommandParams) => {
|
||||
@@ -233,7 +252,7 @@ const registerMetaXWorker = (params: AddWorkerCommandParams) => {
|
||||
--volume /opt/mxdriver:/opt/mxdriver:ro \\
|
||||
--volume /opt/maca:/opt/maca:ro \\
|
||||
${imageArgs}
|
||||
${params.workerIP ? `--advertise-address ${params.workerIP} \\` : ''}`;
|
||||
${setWorkerIPArg(params)}`;
|
||||
};
|
||||
|
||||
const registerCambriconWorker = (params: AddWorkerCommandParams) => {
|
||||
@@ -244,7 +263,7 @@ const registerCambriconWorker = (params: AddWorkerCommandParams) => {
|
||||
--volume /usr/local/neuware:/usr/local/neuware:ro \\
|
||||
--volume /usr/bin/cnmon:/usr/bin/cnmon \\
|
||||
${imageArgs}
|
||||
${params.workerIP ? `--advertise-address ${params.workerIP} \\` : ''}`;
|
||||
${setWorkerIPArg(params)}`;
|
||||
};
|
||||
|
||||
export const registerAddWokerCommandMap = {
|
||||
|
||||
@@ -64,6 +64,7 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
token: string;
|
||||
image: string;
|
||||
gpu: string;
|
||||
[key: string]: any;
|
||||
}) {
|
||||
return registerAddWokerCommandMap[params.gpu]?.(params);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user