|
|
@@ -30,25 +30,25 @@ func (b *PretrainModelBuilder) SetOpts(opts *entity.ContainerBuildOpts) { |
|
|
|
func (b *PretrainModelBuilder) Build(ctx *context.CreationContext) ([]entity.ContainerData, *response.BizError) { |
|
|
|
form := ctx.Request |
|
|
|
var preTrainModelEntity []entity.ContainerData |
|
|
|
if ctx.Request.Cluster == entity.C2Net && (ctx.Request.JobType == models.JobTypeDebug || ctx.Request.JobType == models.JobTypeTrain) && ctx.Request.ComputeSource.Name == models.GPU { |
|
|
|
//挂载一个文件夹保证容器内pretrainmodel目录提交镜像时不被打包 |
|
|
|
uploader := storage_helper.SelectStorageHelperFromStorageType(entity.OBS) |
|
|
|
objectKey := path.Join(uploader.GetJobDefaultObjectKeyPrefix(form.JobName), "pretrain_model_mount") |
|
|
|
uploader.MKDIR(objectKey, "pretrain model folder") |
|
|
|
preTrainModelEntity = append(preTrainModelEntity, entity.ContainerData{ |
|
|
|
Name: "pretrain_model_mount", |
|
|
|
Bucket: uploader.GetBucket(), |
|
|
|
EndPoint: uploader.GetEndpoint(), |
|
|
|
ObjectKey: objectKey + "/", |
|
|
|
ReadOnly: false, |
|
|
|
ContainerPath: b.Opts.ContainerPath, |
|
|
|
RealPath: uploader.GetRealPath(objectKey), |
|
|
|
S3DownloadUrl: uploader.GetS3DownloadUrl(objectKey), |
|
|
|
IsDir: true, |
|
|
|
IsOverwrite: true, |
|
|
|
IsNeedUnzip: false, |
|
|
|
}) |
|
|
|
} |
|
|
|
//if ctx.Request.Cluster == entity.C2Net && (ctx.Request.JobType == models.JobTypeDebug || ctx.Request.JobType == models.JobTypeTrain) && ctx.Request.ComputeSource.Name == models.GPU { |
|
|
|
// //挂载一个文件夹保证容器内pretrainmodel目录提交镜像时不被打包 |
|
|
|
// uploader := storage_helper.SelectStorageHelperFromStorageType(entity.OBS) |
|
|
|
// objectKey := path.Join(uploader.GetJobDefaultObjectKeyPrefix(form.JobName), "pretrain_model_mount") |
|
|
|
// uploader.MKDIR(objectKey, "pretrain model folder") |
|
|
|
// preTrainModelEntity = append(preTrainModelEntity, entity.ContainerData{ |
|
|
|
// Name: "pretrain_model_mount", |
|
|
|
// Bucket: uploader.GetBucket(), |
|
|
|
// EndPoint: uploader.GetEndpoint(), |
|
|
|
// ObjectKey: objectKey + "/", |
|
|
|
// ReadOnly: false, |
|
|
|
// ContainerPath: b.Opts.ContainerPath, |
|
|
|
// RealPath: uploader.GetRealPath(objectKey), |
|
|
|
// S3DownloadUrl: uploader.GetS3DownloadUrl(objectKey), |
|
|
|
// IsDir: true, |
|
|
|
// IsOverwrite: true, |
|
|
|
// IsNeedUnzip: false, |
|
|
|
// }) |
|
|
|
//} |
|
|
|
|
|
|
|
if b.Opts.Disable { |
|
|
|
return preTrainModelEntity, nil |
|
|
@@ -123,7 +123,7 @@ func (b *PretrainModelBuilder) buildModelData(m *models.AiModelManage, jobName s |
|
|
|
Bucket: uploader.GetBucket(), |
|
|
|
EndPoint: uploader.GetEndpoint(), |
|
|
|
ObjectKey: preTrainModelPath, |
|
|
|
ReadOnly: false, |
|
|
|
ReadOnly: true, |
|
|
|
ContainerPath: path.Join(b.Opts.ContainerPath, m.Name), |
|
|
|
RealPath: uploader.GetRealPath(preTrainModelPath), |
|
|
|
S3DownloadUrl: uploader.GetS3DownloadUrl(preTrainModelPath), |
|
|
|