|
|
@@ -14,18 +14,17 @@ import ( |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/modelarts" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/git" |
|
|
|
"code.gitea.io/gitea/modules/storage" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/models" |
|
|
|
"code.gitea.io/gitea/modules/auth" |
|
|
|
"code.gitea.io/gitea/modules/base" |
|
|
|
"code.gitea.io/gitea/modules/cloudbrain" |
|
|
|
"code.gitea.io/gitea/modules/context" |
|
|
|
"code.gitea.io/gitea/modules/git" |
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"code.gitea.io/gitea/modules/modelarts" |
|
|
|
"code.gitea.io/gitea/modules/setting" |
|
|
|
"code.gitea.io/gitea/modules/storage" |
|
|
|
"code.gitea.io/gitea/modules/util" |
|
|
|
) |
|
|
|
|
|
|
|
const ( |
|
|
@@ -277,7 +276,7 @@ func CloudBrainRestart(ctx *context.Context) { |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
|
if !ctx.IsSigned || (ctx.User.ID != task.UserID && !ctx.IsUserSiteAdmin()){ |
|
|
|
if !ctx.IsSigned || (ctx.User.ID != task.UserID && !ctx.IsUserSiteAdmin()) { |
|
|
|
log.Error("the user has no right ro restart the job", task.JobName, ctx.Data["MsgID"]) |
|
|
|
resultCode = "-1" |
|
|
|
errorMsg = "you have no right to restart the job" |
|
|
@@ -949,6 +948,13 @@ func SyncCloudbrainStatus() { |
|
|
|
task.Duration = result.Duration |
|
|
|
task.TrainJobDuration = result.TrainJobDuration |
|
|
|
|
|
|
|
if result.Duration != 0 { |
|
|
|
task.TrainJobDuration = util.AddZero(result.Duration/3600000) + ":" + util.AddZero(result.Duration%3600000/60000) + ":" + util.AddZero(result.Duration%60000/1000) |
|
|
|
|
|
|
|
} else { |
|
|
|
task.TrainJobDuration = "00:00:00" |
|
|
|
} |
|
|
|
|
|
|
|
err = models.UpdateJob(task) |
|
|
|
if err != nil { |
|
|
|
log.Error("UpdateJob(%s) failed:%v", task.JobName, err) |
|
|
|