Merge pull request 'multiple adapters for hps task submit' (#161) from zhouqunjie/pcm-coordinator:master into master
Former-commit-id: 9e788a4d5b279f88e708d6342dbb0dffb1ab3061
This commit is contained in:
commit
8bc4176932
|
@ -14,7 +14,7 @@ type (
|
|||
Description string `json:"description,optional"`
|
||||
TenantId int64 `json:"tenantId,optional"`
|
||||
TaskId int64 `json:"taskId,optional"`
|
||||
AdapterId string `json:"adapterId,optional"`
|
||||
AdapterIds []string `json:"adapterId"`
|
||||
MatchLabels map[string]string `json:"matchLabels,optional"`
|
||||
CardCount int64 `json:"cardCount,optional"`
|
||||
WorkDir string `json:"workDir,optional"` //paratera:workingDir
|
||||
|
|
|
@ -7,7 +7,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"
|
||||
|
@ -50,14 +49,15 @@ 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)
|
||||
l.svcCtx.DbEngin.Raw("SELECT id FROM `t_cluster` where adapter_id in ? and label = ?", req.AdapterIds, 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)
|
||||
clusterId := clusterIds[rand.Intn(len(clusterIds))]
|
||||
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)
|
||||
|
||||
env, _ := json.Marshal(req.Environment)
|
||||
|
||||
|
|
|
@ -1164,7 +1164,7 @@ type CommitHpcTaskReq struct {
|
|||
Description string `json:"description,optional"`
|
||||
TenantId int64 `json:"tenantId,optional"`
|
||||
TaskId int64 `json:"taskId,optional"`
|
||||
AdapterId string `json:"adapterId,optional"`
|
||||
AdapterIds []string `json:"adapterIds"`
|
||||
MatchLabels map[string]string `json:"matchLabels,optional"`
|
||||
CardCount int64 `json:"cardCount,optional"`
|
||||
WorkDir string `json:"workDir,optional"` //paratera:workingDir
|
||||
|
|
Loading…
Reference in New Issue