merge conflict
Former-commit-id: b6a6a7c963182194e03b9673f5b2e47fe47952f4
This commit is contained in:
parent
6304fee876
commit
7d067b0082
|
@ -8,7 +8,6 @@ import (
|
|||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
|
@ -51,26 +50,25 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t
|
|||
}
|
||||
|
||||
var clusterIds []int64
|
||||
l.svcCtx.DbEngin.Raw("SELECT id FROM `t_cluster` where adapter_id = ? and label = ?", req.AdapterId, req.ClusterType).Scan(&clusterIds)
|
||||
|
||||
adapterId, _ := strconv.ParseInt(req.AdapterId, 10, 64)
|
||||
var adapterName string
|
||||
l.svcCtx.DbEngin.Raw("SELECT name FROM `t_adapter` where id = ?", req.AdapterId).Scan(&adapterName)
|
||||
if len(adapterName) == 0 || adapterName == "" {
|
||||
return nil, errors.New("no corresponding adapter found")
|
||||
}
|
||||
clusterId := clusterIds[rand.Intn(len(clusterIds))]
|
||||
var clusterName string
|
||||
l.svcCtx.DbEngin.Raw("SELECT nickname FROM `t_cluster` where id = ?", clusterId).Scan(&clusterName)
|
||||
|
||||
env, _ := json.Marshal(req.Environment)
|
||||
|
||||
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
|
||||
var adapterName string
|
||||
clusterId := clusterIds[rand.Intn(len(clusterIds))]
|
||||
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{
|
||||
TaskId: taskModel.Id,
|
||||
AdapterId: uint(adapterId),
|
||||
|
|
Loading…
Reference in New Issue