added get balance api

Former-commit-id: 2c8df408652a3e2bede8652ff11e9460ba8fc7e0
This commit is contained in:
tzwang 2024-05-20 15:46:49 +08:00
parent 4555a50afa
commit 130b116b52
3 changed files with 17 additions and 0 deletions

View File

@ -978,6 +978,9 @@ service pcm {
@handler GetComputeCardsByClusterHandler @handler GetComputeCardsByClusterHandler
get /schedule/getComputeCardsByCluster/:adapterId/:clusterId (GetComputeCardsByClusterReq) returns (GetComputeCardsByClusterResp) get /schedule/getComputeCardsByCluster/:adapterId/:clusterId (GetComputeCardsByClusterReq) returns (GetComputeCardsByClusterResp)
@handler GetClusterBalanceByIdHandler
get /schedule/getClusterBalanceById/:adapterId/:clusterId (GetClusterBalanceByIdReq) returns (GetClusterBalanceByIdResp)
} }
@server( @server(

View File

@ -141,4 +141,13 @@ type (
GetComputeCardsByClusterResp { GetComputeCardsByClusterResp {
Cards []string `json:"cards"` Cards []string `json:"cards"`
} }
GetClusterBalanceByIdReq{
AdapterId string `path:"adapterId"`
ClusterId string `path:"clusterId"`
}
GetClusterBalanceByIdResp{
Balance float64 `json:"balance"`
}
) )

View File

@ -143,6 +143,11 @@ func (l *PageListTaskLogic) updateTaskStatus(tasks []*types.TaskModel, ch chan<-
} }
} }
if len(aiTask) == 0 {
ch <- struct{}{}
return
}
start, _ := time.ParseInLocation(constants.Layout, aiTask[0].StartTime, time.Local) start, _ := time.ParseInLocation(constants.Layout, aiTask[0].StartTime, time.Local)
end, _ := time.ParseInLocation(constants.Layout, aiTask[0].EndTime, time.Local) end, _ := time.ParseInLocation(constants.Layout, aiTask[0].EndTime, time.Local)