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),