22import logger from '../../logger' ;
33import * as $Dev20230714 from '@alicloud/devs20230714' ;
44import { IInputs } from '../../interface' ;
5- import { checkModelStatus , initClient } from './utils' ;
6- import { isEmpty } from 'lodash' ;
5+ import { checkModelStatus , extractOssMountDir , initClient } from './utils' ;
76
87export class ModelService {
98 logger = logger ;
@@ -41,15 +40,14 @@ export class ModelService {
4140 ) ;
4241 return ;
4342 }
43+
44+ const processedOssMountPoints = extractOssMountDir ( ossMountPoints ) ;
45+
4446 // mode 是 once 时候,判断是否已经下载过
4547 const destination =
4648 storage === 'nas'
4749 ? `file:/${ nasMountPoints [ 0 ] . mountDir } `
48- : `file:/${
49- ossMountPoints [ 0 ] . mountDir . length > 48
50- ? ossMountPoints [ 0 ] . mountDir . substring ( 0 , 48 )
51- : ossMountPoints [ 0 ] . mountDir
52- } `;
50+ : `file:/${ processedOssMountPoints [ 0 ] . mountDir } ` ;
5351 if ( modelConfig . mode === 'once' ) {
5452 const ListFileManagerTasksRequest = new $Dev20230714 . ListFileManagerTasksRequest ( {
5553 name,
@@ -71,17 +69,6 @@ export class ModelService {
7169 }
7270 }
7371
74- let processedOssMountPoints ;
75- if ( ! isEmpty ( ossMountPoints ) ) {
76- processedOssMountPoints = ossMountPoints . map ( ( ossMountPoint ) => ( {
77- ...ossMountPoint ,
78- mountDir :
79- ossMountPoint . mountDir . length > 48
80- ? ossMountPoint . mountDir . substring ( 0 , 48 )
81- : ossMountPoint . mountDir ,
82- } ) ) ;
83- }
84-
8572 const fileManagerRsyncRequest = new $Dev20230714 . FileManagerRsyncRequest ( {
8673 mountConfig : new $Dev20230714 . FileManagerMountConfig ( {
8774 name,
@@ -112,19 +99,11 @@ export class ModelService {
11299 const { nasMountPoints, ossMountPoints, role, region, vpcConfig, storage } = params ;
113100 const devClient = await initClient ( this . inputs , this . region , logger , 'fun-model' ) ;
114101
115- let processedOssMountPoints ;
116- if ( ! isEmpty ( ossMountPoints ) ) {
117- processedOssMountPoints = ossMountPoints . map ( ( ossMountPoint ) => ( {
118- ...ossMountPoint ,
119- mountDir :
120- ossMountPoint . mountDir . length > 48
121- ? ossMountPoint . mountDir . substring ( 0 , 48 )
122- : ossMountPoint . mountDir ,
123- } ) ) ;
124- }
102+ const processedOssMountPoints = extractOssMountDir ( ossMountPoints ) ;
125103
126104 const fileManagerRmRequest = new $Dev20230714 . FileManagerRmRequest ( {
127- filepath : storage === 'nas' ? nasMountPoints [ 0 ] ?. mountDir : ossMountPoints [ 0 ] ?. mountDir ,
105+ filepath :
106+ storage === 'nas' ? nasMountPoints [ 0 ] ?. mountDir : processedOssMountPoints [ 0 ] ?. mountDir ,
128107 mountConfig : new $Dev20230714 . FileManagerMountConfig ( {
129108 name,
130109 nasMountPoints,
0 commit comments