Browse Source

Merge pull request 'fix-2264' (#2449) from fix-2264 into V20220718

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/2449
Reviewed-by: lewis <747342561@qq.com>
tags/v1.22.7.1
lewis 3 years ago
parent
commit
10f3ad66e1
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      routers/repo/cloudbrain.go

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

@@ -2,7 +2,6 @@ package repo

import (
"bufio"
"code.gitea.io/gitea/modules/grampus"
"encoding/json"
"errors"
"fmt"
@@ -16,6 +15,8 @@ import (
"time"
"unicode/utf8"

"code.gitea.io/gitea/modules/grampus"

"code.gitea.io/gitea/modules/timeutil"
"github.com/unknwon/i18n"

@@ -573,7 +574,9 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo
if task.TrainJobDuration == "" {
if task.Duration == 0 {
var duration int64
if task.Status == string(models.JobRunning) {
if task.Status == string(models.JobWaiting) {
duration = 0
} else if task.Status == string(models.JobRunning) {
duration = time.Now().Unix() - int64(task.CreatedUnix)
} else {
duration = int64(task.UpdatedUnix) - int64(task.CreatedUnix)


Loading…
Cancel
Save