Browse Source

fix-bug

tags/V1.22.3.1^2
liuzx 3 years ago
parent
commit
389af0cc7f
2 changed files with 8 additions and 3 deletions
  1. +1
    -1
      modules/util/util.go
  2. +7
    -2
      routers/repo/modelarts.go

+ 1
- 1
modules/util/util.go View File

@@ -115,7 +115,7 @@ func AddZero(t int64) (m string) {


func ConvertDisplayJobNameToJobName(DisplayName string) (JobName string) { func ConvertDisplayJobNameToJobName(DisplayName string) (JobName string) {
t := time.Now() t := time.Now()
JobName = "openi" + strings.ToLower(cutNameString(DisplayName, 15)) + "t" + t.Format("2006010215") + strconv.Itoa(int(rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(100000)))
JobName = "openi" + strings.ToLower(cutNameString(DisplayName, 15)) + "t" + t.Format("20060102150405")[4:] + strconv.Itoa(int(rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(100000)))
return JobName return JobName
} }




+ 7
- 2
routers/repo/modelarts.go View File

@@ -329,9 +329,14 @@ func NotebookManage(ctx *context.Context) {
var resultCode = "0" var resultCode = "0"
var errorMsg = "" var errorMsg = ""
var status = "" var status = ""
task, err := models.GetCloudbrainByID(ID)
if err != nil {
log.Error("get task(%s) failed:%v", task.JobName, err.Error(), ctx.Data["MsgID"])
resultCode = "-1"
errorMsg = "system error"
}


for { for {
task := ctx.Cloudbrain


if action == models.ActionStop { if action == models.ActionStop {
if task.Status != string(models.ModelArtsRunning) { if task.Status != string(models.ModelArtsRunning) {
@@ -438,7 +443,7 @@ func NotebookDel(ctx *context.Context) {
_, err := modelarts.DelNotebook2(task.JobID) _, err := modelarts.DelNotebook2(task.JobID)
if err != nil { if err != nil {
log.Error("DelNotebook2(%s) failed:%v", task.JobName, err.Error()) log.Error("DelNotebook2(%s) failed:%v", task.JobName, err.Error())
if strings.Contains(err.Error(), modelarts.NotebookNotFound) || strings.Contains(err.Error(), modelarts.NotebookNoPermission) || strings.Contains(err.Error(), modelarts.NotebookInvalid){
if strings.Contains(err.Error(), modelarts.NotebookNotFound) || strings.Contains(err.Error(), modelarts.NotebookNoPermission) || strings.Contains(err.Error(), modelarts.NotebookInvalid) {
log.Info("old notebook version") log.Info("old notebook version")
} else { } else {
ctx.RenderWithErr(err.Error(), tplDebugJobIndex, nil) ctx.RenderWithErr(err.Error(), tplDebugJobIndex, nil)


Loading…
Cancel
Save