Browse Source

delete cb

tags/v1.21.12.2^2
lewis 4 years ago
parent
commit
2d0b53b901
1 changed files with 7 additions and 5 deletions
  1. +7
    -5
      routers/repo/cloudbrain.go

+ 7
- 5
routers/repo/cloudbrain.go View File

@@ -479,7 +479,6 @@ func CloudBrainDel(ctx *context.Context) {
return
}

//todo: delete local and oss's job
deleteJobName(task.JobName, models.TypeCloudBrainOne)
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob")
}
@@ -762,7 +761,6 @@ func mkModelPath(modelPath string) error {
func deleteJobName(jobName string, cloudbrainType int) error {
//delete local
localJobPath := setting.JobPath + jobName
log.Info("%s", localJobPath)
err := os.RemoveAll(localJobPath)
if err != nil {
log.Error("RemoveAll(%s) failed:%v", localJobPath, err)
@@ -771,13 +769,17 @@ func deleteJobName(jobName string, cloudbrainType int) error {
//delete oss
if cloudbrainType == models.TypeCloudBrainOne {
dirPath := setting.CBCodePathPrefix + jobName + "/"
log.Info("%s", dirPath)
err = storage.Attachments.DeleteDir(dirPath)
if err != nil {
log.Error("Delete(%s) failed:%v", localJobPath, err)
log.Error("DeleteDir(%s) failed:%v", localJobPath, err)
}
} else if cloudbrainType == models.TypeCloudBrainTwo {

//dirPath := setting.CodePathPrefix + jobName + "/"
//err = storage.ObsRemoveObject(setting.Bucket, dirPath)
//if err != nil {
// log.Error("ObsRemoveObject(%s) failed:%v", localJobPath, err)
//}
log.Info("no need to delete")
} else {
log.Error("cloudbrainType(%d) error", cloudbrainType)
}


Loading…
Cancel
Save