|
|
|
@@ -6,7 +6,9 @@ |
|
|
|
package repo |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.gitea.io/gitea/modules/setting" |
|
|
|
"net/http" |
|
|
|
"os" |
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
|
|
|
|
@@ -237,7 +239,7 @@ func DelTrainJobVersion(ctx *context.APIContext) { |
|
|
|
JobID: jobID, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("get VersionListCount faild", err) |
|
|
|
ctx.ServerError("get VersionListCount failed", err) |
|
|
|
return |
|
|
|
} |
|
|
|
if VersionListCount > 0 { |
|
|
|
@@ -255,6 +257,8 @@ func DelTrainJobVersion(ctx *context.APIContext) { |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} else { //已删除该任务下的所有版本 |
|
|
|
deleteJobStorage(task.JobName) |
|
|
|
} |
|
|
|
|
|
|
|
ctx.JSON(http.StatusOK, map[string]interface{}{ |
|
|
|
@@ -321,3 +325,21 @@ func ModelList(ctx *context.APIContext) { |
|
|
|
"PageIsCloudBrain": true, |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
func deleteJobStorage(jobName string) error { |
|
|
|
//delete local |
|
|
|
localJobPath := setting.JobPath + jobName |
|
|
|
err := os.RemoveAll(localJobPath) |
|
|
|
if err != nil { |
|
|
|
log.Error("RemoveAll(%s) failed:%v", localJobPath, err) |
|
|
|
} |
|
|
|
|
|
|
|
//delete oss |
|
|
|
dirPath := setting.CodePathPrefix + jobName + "/" |
|
|
|
err = storage.ObsRemoveObject(setting.Bucket, dirPath) |
|
|
|
if err != nil { |
|
|
|
log.Error("ObsRemoveObject(%s) failed:%v", localJobPath, err) |
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
} |