Skip to content

Commit 81f9513

Browse files
author
高魏洪
committed
fix: Refactor the model download logic, support multiple solutions, and optimize automatic resource deployment
1 parent 79030cd commit 81f9513

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/subCommands/model/model.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,15 @@ export class ModelService {
120120
return;
121121
}
122122
// mode 是 once 时候,判断是否已经下载过
123+
const destination = storage === 'nas' ? `file://${nasMountPoints[0].mountDir}` : `file://${ossMountPoints[0].mountDir}`;
123124
if (modelConfig.mode === 'once') {
124125
const ListFileManagerTasksRequest = new $Dev20230714.ListFileManagerTasksRequest({
125126
name
126127
})
127128
const res = await devClient.listFileManagerTasks(ListFileManagerTasksRequest)
128129
logger.debug('listFileManagerTasks', JSON.stringify(res, null, 2))
129130
const tasks = res.body.data.tasks
130-
const needDownload = !tasks.some(task => task.finished && task.success && task.progress.currentBytes === task.progress.totalBytes && task.parameters.source === source);
131+
const needDownload = !tasks.some(task => task.finished && task.success && task.progress.currentBytes === task.progress.totalBytes && task.parameters.source === source && task.parameters.destination === destination );
131132
if (!needDownload) {
132133
logger.info('[Download-model] Download model finished.')
133134
return;
@@ -144,7 +145,7 @@ export class ModelService {
144145
vpcConfig
145146
}),
146147
source,
147-
destination: storage === 'nas' ? `file://${nasMountPoints[0].mountDir}` : `file://${ossMountPoints[0].mountDir}`,
148+
destination,
148149
conflictHandling: process.env.MODEL_CONFLIC_HANDLING || modelConfig.conflictResolution
149150
})
150151
logger.debug(JSON.stringify(fileManagerRsyncRequest, null, 2))

0 commit comments

Comments
 (0)