Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.7.1
zouap 3 years ago
parent
commit
2c579d60cd
2 changed files with 10 additions and 2 deletions
  1. +9
    -1
      models/ai_model_manage.go
  2. +1
    -1
      routers/api/v1/repo/cloudbrain.go

+ 9
- 1
models/ai_model_manage.go View File

@@ -84,7 +84,15 @@ type AiModelQueryOptions struct {
Status int
}

func ComputeAndSetDuration(task *AiModelConvert) {
func ModelComputeAndSetDuration(task *AiModelConvert, result JobResultPayload) {
if task.StartTime == 0 {
task.StartTime = timeutil.TimeStamp(result.JobStatus.CreatedTime / 1000)
}
if task.EndTime == 0 {
if result.JobStatus.CompletedTime > 0 {
task.EndTime = timeutil.TimeStamp(result.JobStatus.CompletedTime / 1000)
}
}
var d int64
if task.StartTime == 0 {
d = 0


+ 1
- 1
routers/api/v1/repo/cloudbrain.go View File

@@ -135,7 +135,7 @@ func GetCloudbrainModelConvertTask(ctx *context.APIContext) {
}

if result.JobStatus.State != string(models.JobWaiting) {
models.ComputeAndSetDuration(job, result)
models.ModelComputeAndSetDuration(job, result)
err = models.UpdateModelConvert(job)
if err != nil {
log.Error("UpdateJob failed:", err)


Loading…
Cancel
Save