added ai center overview apis
Former-commit-id: 02ea4ae3c93275c3c76f29aecba6ac7be32ef555
This commit is contained in:
parent
190c158322
commit
9bd725380e
|
@ -1697,6 +1697,44 @@ PayloadCreateTrainJob{
|
||||||
jobId string `json:"jobId,optional"`
|
jobId string `json:"jobId,optional"`
|
||||||
}
|
}
|
||||||
********************/
|
********************/
|
||||||
|
|
||||||
|
/******************Ai Center overview*************************/
|
||||||
|
CenterOverviewResp {
|
||||||
|
CenterNum int32 `json:"totalCenters,optional"`
|
||||||
|
TaskNum int32 `json:"totalTasks,optional"`
|
||||||
|
CardNum int32 `json:"totalCards,optional"`
|
||||||
|
PowerInTops float64 `json:"totalPower,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
CenterQueueingResp {
|
||||||
|
Current []*CenterQueue `json:"current,optional"`
|
||||||
|
History []*CenterQueue `json:"history,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
CenterQueue {
|
||||||
|
Name string `json:"name,optional"`
|
||||||
|
QueueingNum int32 `json:"num,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
CenterListResp {
|
||||||
|
List []*Center `json:"centerList,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
Center {
|
||||||
|
Name string `json:"name,optional"`
|
||||||
|
StackName string `json:"stack,optional"`
|
||||||
|
Version string `json:"version,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
CenterTaskListResp {
|
||||||
|
List []*AiTask `json:"taskList,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AiTask {
|
||||||
|
Name string `json:"name,optional"`
|
||||||
|
status string `json:"status,optional"`
|
||||||
|
TimeElapsed int32 `json:"elapsed,optional"`
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
/******************create TrainIngJob end*************************/
|
/******************create TrainIngJob end*************************/
|
||||||
|
|
|
@ -219,6 +219,22 @@ service pcm {
|
||||||
group: ai
|
group: ai
|
||||||
)
|
)
|
||||||
service pcm {
|
service pcm {
|
||||||
|
@doc "智算中心概览"
|
||||||
|
@handler getCenterOverviewHandler
|
||||||
|
get /ai/getCenterOverview returns (CenterOverviewResp)
|
||||||
|
|
||||||
|
@doc "智算中心排队状况"
|
||||||
|
@handler getCenterQueueingHandler
|
||||||
|
get /ai/getCenterQueueing returns (CenterQueueingResp)
|
||||||
|
|
||||||
|
@doc "智算中心列表"
|
||||||
|
@handler getCenterListHandler
|
||||||
|
get /ai/getCenterList returns (CenterListResp)
|
||||||
|
|
||||||
|
@doc "智算中心任务列表"
|
||||||
|
@handler getCenterTaskListHandler
|
||||||
|
get /ai/getCenterTaskList returns (CenterTaskListResp)
|
||||||
|
|
||||||
@doc "查询数据集列表"
|
@doc "查询数据集列表"
|
||||||
@handler listDataSetHandler
|
@handler listDataSetHandler
|
||||||
get /ai/listDataSet/:projectId (DataSetReq) returns (DataSetResp)
|
get /ai/listDataSet/:projectId (DataSetReq) returns (DataSetResp)
|
||||||
|
@ -927,6 +943,9 @@ service pcm {
|
||||||
|
|
||||||
@handler ScheduleSubmitHandler
|
@handler ScheduleSubmitHandler
|
||||||
post /schedule/submit (ScheduleReq) returns (ScheduleResp)
|
post /schedule/submit (ScheduleReq) returns (ScheduleResp)
|
||||||
|
|
||||||
|
@handler ScheduleGetOverviewHandler
|
||||||
|
post /schedule/getOverview returns (ScheduleOverviewResp)
|
||||||
}
|
}
|
||||||
|
|
||||||
@server(
|
@server(
|
||||||
|
|
|
@ -24,6 +24,9 @@ type (
|
||||||
Msg string `json:"msg"`
|
Msg string `json:"msg"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScheduleOverviewResp {
|
||||||
|
}
|
||||||
|
|
||||||
AiOption {
|
AiOption {
|
||||||
TaskName string `json:"taskName"`
|
TaskName string `json:"taskName"`
|
||||||
AdapterId string `json:"adapterId"`
|
AdapterId string `json:"adapterId"`
|
||||||
|
|
|
@ -129,42 +129,19 @@ func (s *Scheduler) TempAssign() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Scheduler) AssignAndSchedule(ss SubSchedule) (interface{}, error) {
|
func (s *Scheduler) AssignAndSchedule(ss SubSchedule) (interface{}, error) {
|
||||||
//// 已指定 ParticipantId
|
//choose strategy
|
||||||
//if s.task.ParticipantId != 0 {
|
|
||||||
// return nil
|
|
||||||
//}
|
|
||||||
//// 标签匹配以及后,未找到ParticipantIds
|
|
||||||
//if len(s.participantIds) == 0 {
|
|
||||||
// return errors.New("未找到匹配的ParticipantIds")
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//// 指定或者标签匹配的结果只有一个集群,给任务信息指定
|
|
||||||
//if len(s.participantIds) == 1 {
|
|
||||||
// s.task.ParticipantId = s.participantIds[0]
|
|
||||||
// //replicas := s.task.Metadata.(map[string]interface{})["spec"].(map[string]interface{})["replicas"].(float64)
|
|
||||||
// //result := make(map[int64]string)
|
|
||||||
// //result[s.participantIds[0]] = strconv.FormatFloat(replicas, 'f', 2, 64)
|
|
||||||
// //s.result = result
|
|
||||||
//
|
|
||||||
// return nil
|
|
||||||
//}
|
|
||||||
|
|
||||||
strategy, err := ss.PickOptimalStrategy()
|
strategy, err := ss.PickOptimalStrategy()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//schedule
|
||||||
clusters, err := strategy.Schedule()
|
clusters, err := strategy.Schedule()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
//集群数量不满足,指定到标签匹配后第一个集群
|
//assign tasks to clusters
|
||||||
//if len(providerList) < 2 {
|
|
||||||
// s.task.ParticipantId = s.participantIds[0]
|
|
||||||
// return nil
|
|
||||||
//}
|
|
||||||
|
|
||||||
resp, err := ss.AssignTask(clusters)
|
resp, err := ss.AssignTask(clusters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue