diff --git a/api/internal/logic/hpc/commithpctasklogic.go b/api/internal/logic/hpc/commithpctasklogic.go index 374d7807..ebd6f252 100644 --- a/api/internal/logic/hpc/commithpctasklogic.go +++ b/api/internal/logic/hpc/commithpctasklogic.go @@ -2,6 +2,7 @@ package hpc import ( "context" + "errors" clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/api/client" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models" @@ -63,7 +64,9 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t l.svcCtx.DbEngin.Raw("SELECT nickname FROM `t_cluster` where id = ?", clusterId).Scan(&clusterName) l.svcCtx.DbEngin.Raw("SELECT adapter_id FROM `t_cluster` where id = ?", clusterId).Scan(&adapterId) l.svcCtx.DbEngin.Raw("SELECT name FROM `t_adapter` where id = ?", adapterId).Scan(&adapterName) - + if len(adapterName) == 0 || adapterName == "" { + return nil, errors.New("no corresponding adapter found") + } env, _ := json.Marshal(req.Environment) hpcInfo := models.TaskHpc{ diff --git a/api/internal/svc/servicecontext.go b/api/internal/svc/servicecontext.go index 1aca2ac4..4bbc6a27 100644 --- a/api/internal/svc/servicecontext.go +++ b/api/internal/svc/servicecontext.go @@ -91,7 +91,7 @@ func NewServiceContext(c config.Config) *ServiceContext { NamingStrategy: schema.NamingStrategy{ SingularTable: true, // 使用单数表名,启用该选项,此时,`User` 的表名应该是 `t_user` }, - Logger: logger.Default.LogMode(logger.Info), + Logger: logger.Default.LogMode(logger.Error), }) if err != nil { logx.Errorf("数据库连接失败, err%v", err)