multiple adapters for hps task submit
Former-commit-id: 27cbca8bf1eec9807636b541ed1c68741e85e043
This commit is contained in:
parent
935af66c47
commit
3eb71a7bf5
|
@ -14,7 +14,7 @@ type (
|
||||||
Description string `json:"description,optional"`
|
Description string `json:"description,optional"`
|
||||||
TenantId int64 `json:"tenantId,optional"`
|
TenantId int64 `json:"tenantId,optional"`
|
||||||
TaskId int64 `json:"taskId,optional"`
|
TaskId int64 `json:"taskId,optional"`
|
||||||
AdapterId string `json:"adapterId,optional"`
|
AdapterIds []string `json:"adapterId"`
|
||||||
MatchLabels map[string]string `json:"matchLabels,optional"`
|
MatchLabels map[string]string `json:"matchLabels,optional"`
|
||||||
CardCount int64 `json:"cardCount,optional"`
|
CardCount int64 `json:"cardCount,optional"`
|
||||||
WorkDir string `json:"workDir,optional"` //paratera:workingDir
|
WorkDir string `json:"workDir,optional"` //paratera:workingDir
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||||
"k8s.io/apimachinery/pkg/util/json"
|
"k8s.io/apimachinery/pkg/util/json"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strconv"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"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
|
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 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 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)
|
env, _ := json.Marshal(req.Environment)
|
||||||
|
|
||||||
|
|
|
@ -1164,7 +1164,7 @@ type CommitHpcTaskReq struct {
|
||||||
Description string `json:"description,optional"`
|
Description string `json:"description,optional"`
|
||||||
TenantId int64 `json:"tenantId,optional"`
|
TenantId int64 `json:"tenantId,optional"`
|
||||||
TaskId int64 `json:"taskId,optional"`
|
TaskId int64 `json:"taskId,optional"`
|
||||||
AdapterId string `json:"adapterId,optional"`
|
AdapterIds []string `json:"adapterIds"`
|
||||||
MatchLabels map[string]string `json:"matchLabels,optional"`
|
MatchLabels map[string]string `json:"matchLabels,optional"`
|
||||||
CardCount int64 `json:"cardCount,optional"`
|
CardCount int64 `json:"cardCount,optional"`
|
||||||
WorkDir string `json:"workDir,optional"` //paratera:workingDir
|
WorkDir string `json:"workDir,optional"` //paratera:workingDir
|
||||||
|
|
Loading…
Reference in New Issue