From 91c38d66fd00c9bbfdfb63c6f7cafff8cae01dce Mon Sep 17 00:00:00 2001 From: zhouqunjie Date: Sat, 11 May 2024 15:42:52 +0800 Subject: [PATCH] fix bug Former-commit-id: a32dab848d0e2055a62190de1461d4ba7be83ca5 --- api/internal/logic/hpc/commithpctasklogic.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/api/internal/logic/hpc/commithpctasklogic.go b/api/internal/logic/hpc/commithpctasklogic.go index e716b2c0..374d7807 100644 --- a/api/internal/logic/hpc/commithpctasklogic.go +++ b/api/internal/logic/hpc/commithpctasklogic.go @@ -50,6 +50,11 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t var clusterIds []int64 l.svcCtx.DbEngin.Raw("SELECT id FROM `t_cluster` where adapter_id in ? and label = ?", req.AdapterIds, req.ClusterType).Scan(&clusterIds) + if len(clusterIds) == 0 || clusterIds == nil { + resp.Code = 400 + resp.Msg = "no cluster found" + return resp, nil + } var clusterName string var adapterId int64 @@ -61,12 +66,6 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t env, _ := json.Marshal(req.Environment) - if len(clusterIds) == 0 || clusterIds == nil { - resp.Code = 400 - resp.Msg = "no cluster found" - return resp, nil - } - hpcInfo := models.TaskHpc{ TaskId: taskModel.Id, AdapterId: uint(adapterId),