From fa0f91d24f537f4bb44a01435e7bfe6aee5417ee Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Wed, 6 Apr 2022 16:56:15 +0800 Subject: [PATCH] fix 1718 --- routers/repo/cloudbrain.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 73b1914e5..322b131c8 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -346,6 +346,24 @@ func CloudBrainRestart(ctx *context.Context) { break } + var hasSameResource bool + if gpuInfos == nil { + json.Unmarshal([]byte(setting.GpuTypes), &gpuInfos) + } + for _, resourceType := range gpuInfos.GpuInfo { + if resourceType.Queue == task.GpuQueue { + hasSameResource = true + continue + } + } + + if !hasSameResource { + log.Error("has no same resource, can not restart", ctx.Data["MsgID"]) + resultCode = "-1" + errorMsg = "the job's version is too old and can not be restarted" + break + } + count, err := models.GetCloudbrainCountByUserID(ctx.User.ID, string(models.JobTypeDebug)) if err != nil { log.Error("GetCloudbrainCountByUserID failed:%v", err, ctx.Data["MsgID"])