#4598 智算网络调试任务代码挂载目录,防止解压代码打包到镜像中

Merged
zouap merged 2 commits from fix-4304 into V20230808 9 months ago
  1. +1
    -0
      entity/container.go
  2. +1
    -1
      services/ai_task_service/cluster/c2net.go
  3. +6
    -3
      services/ai_task_service/container_builder/code_builder.go
  4. +1
    -0
      services/ai_task_service/task/grampus_notebook_task.go

+ 1
- 0
entity/container.go View File

@@ -43,6 +43,7 @@ type ContainerBuildOpts struct {
AcceptStorageType []StorageType
Uncompressed bool
MKDIR bool
VolumeFolder bool
}

func (opts ContainerBuildOpts) IsStorageTypeIn(storageType StorageType) bool {


+ 1
- 1
services/ai_task_service/cluster/c2net.go View File

@@ -90,7 +90,7 @@ func convertNoteBookReq2Grampus(req entity.CreateNoteBookTaskRequest) models.Cre
codePath := "/code"
if len(req.Tasks[0].Code) > 0 {
codePath = req.Tasks[0].Code[0].ContainerPath
if strings.Contains(codePath, "/") {
if strings.HasSuffix(codePath, ".zip") {
codePath = codePath[0:strings.LastIndex(codePath, "/")]
}
}


+ 6
- 3
services/ai_task_service/container_builder/code_builder.go View File

@@ -59,9 +59,12 @@ func (b *CodeBuilder) Build(ctx *context.CreationContext) ([]entity.ContainerDat
}

var codeArchiveName, objectKey string
//无论代码是压缩包还是文件夹形式,挂载的都是文件夹,以默认分支命名压缩包

objectKey = remoteDir + "/"
if !b.Opts.Uncompressed && !b.Opts.VolumeFolder {
codeArchiveName = cloudbrain.DefaultBranchName + ".zip"
objectKey = path.Join(remoteDir, codeArchiveName)
} else {
objectKey = remoteDir + "/"
}

containerPath := ""
if opts.ContainerPath != "" {


+ 1
- 0
services/ai_task_service/task/grampus_notebook_task.go View File

@@ -39,6 +39,7 @@ func GetGrampusNoteBookConfig(opts entity.AITaskConfigKey) *entity.AITaskBaseCon
ContainerPath: codePath,
ReadOnly: false,
AcceptStorageType: []entity.StorageType{entity.MINIO, entity.OBS},
VolumeFolder: true,
},
entity.ContainerDataset: {
ContainerPath: datasetPath,


Loading…
Cancel
Save