Merge branch 'master' of https://gitlink.org.cn/JointCloud/pcm-coordinator
# Conflicts: # api/internal/types/types.go Former-commit-id: 405b1832b2e74dac8df070b0ebee30a37e25e766
This commit is contained in:
commit
9d1f98b478
|
@ -1086,4 +1086,11 @@ type Card {
|
|||
TOpsAtFp16 float64 `json:"TOpsAtFp16"`
|
||||
CardHours float64 `json:"cardHours"`
|
||||
CardNum int32 `json:"cardNum"`
|
||||
}
|
||||
|
||||
type TaskStatusResp {
|
||||
Succeeded int `json:"Succeeded"`
|
||||
Failed int `json:"Failed"`
|
||||
Running int `json:"Running"`
|
||||
Pause int `json:"Pause"`
|
||||
}
|
|
@ -136,7 +136,7 @@ service pcm {
|
|||
|
||||
@doc "Statistical task status"
|
||||
@handler countTaskStatus
|
||||
get /core/task/countTaskStatus () returns(ListResult)
|
||||
get /core/task/countTaskStatus () returns(TaskStatusResp)
|
||||
}
|
||||
|
||||
//hpc二级接口
|
||||
|
|
|
@ -15102,7 +15102,7 @@
|
|||
"taskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"taskStatus": {
|
||||
"TaskStatus": {
|
||||
"type": "string"
|
||||
},
|
||||
"startedAt": {
|
||||
|
@ -15118,7 +15118,7 @@
|
|||
"required": [
|
||||
"taskId",
|
||||
"taskName",
|
||||
"taskStatus",
|
||||
"TaskStatus",
|
||||
"startedAt",
|
||||
"completedAt"
|
||||
]
|
||||
|
|
|
@ -94,7 +94,7 @@ type (
|
|||
TaskSl {
|
||||
TaskId string `json:"taskId"`
|
||||
TaskName string `json:"taskName"`
|
||||
TaskStatus string `json:"taskStatus"`
|
||||
TaskStatus string `json:"TaskStatus"`
|
||||
StartedAt int64 `json:"startedAt"`
|
||||
CompletedAt int64 `json:"completedAt"`
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package core
|
|||
import (
|
||||
"context"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||
|
||||
|
@ -23,19 +24,18 @@ func NewCountTaskStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *C
|
|||
}
|
||||
}
|
||||
|
||||
type taskStatus struct {
|
||||
Quantity string `json:"quantity"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
func (l *CountTaskStatusLogic) CountTaskStatus() (resp *types.ListResult, err error) {
|
||||
resp = &types.ListResult{}
|
||||
var taskStatusList []*taskStatus
|
||||
err = l.svcCtx.DbEngin.Raw("select count(*) quantity, status from task group by status").Scan(&taskStatusList).Error
|
||||
func (l *CountTaskStatusLogic) CountTaskStatus() (resp *types.TaskStatusResp, err error) {
|
||||
resp = &types.TaskStatusResp{}
|
||||
sqlStr := `SELECT
|
||||
COUNT(CASE WHEN status = 'Succeeded' THEN 1 END) AS Succeeded,
|
||||
COUNT(CASE WHEN status = 'Failed' THEN 1 END) AS Failed,
|
||||
COUNT(CASE WHEN status = 'Running' THEN 1 END) AS Running,
|
||||
COUNT(CASE WHEN status = 'Pause' THEN 1 END) AS Pause
|
||||
FROM task;`
|
||||
err = l.svcCtx.DbEngin.Raw(sqlStr).Scan(&resp).Error
|
||||
if err != nil {
|
||||
logx.Errorf("CountTaskStatus() => sql execution error: %v", err)
|
||||
return nil, errors.Errorf("Description Failed to collect statistics on the status of a task. Please try again later")
|
||||
}
|
||||
resp.List = &taskStatusList
|
||||
return
|
||||
}
|
||||
|
|
|
@ -1052,6 +1052,13 @@ type Card struct {
|
|||
CardNum int32 `json:"cardNum"`
|
||||
}
|
||||
|
||||
type TaskStatusResp struct {
|
||||
Succeeded int `json:"Succeeded"`
|
||||
Failed int `json:"Failed"`
|
||||
Running int `json:"Running"`
|
||||
Pause int `json:"Pause"`
|
||||
}
|
||||
|
||||
type CommitHpcTaskReq struct {
|
||||
Name string `json:"name"` // paratera:jobName
|
||||
Description string `json:"description,optional"`
|
||||
|
@ -5428,7 +5435,7 @@ type DeleteLinkTaskResp struct {
|
|||
type TaskSl struct {
|
||||
TaskId string `json:"taskId"`
|
||||
TaskName string `json:"taskName"`
|
||||
TaskStatus string `json:"taskStatus"`
|
||||
TaskStatus string `json:"TaskStatus"`
|
||||
StartedAt int64 `json:"startedAt"`
|
||||
CompletedAt int64 `json:"completedAt"`
|
||||
}
|
||||
|
@ -5541,8 +5548,6 @@ type CreateAlertRuleReq struct {
|
|||
|
||||
type AlertRulesReq struct {
|
||||
AlertType string `form:"alertType"`
|
||||
AdapterId string `form:"adapterId,optional"`
|
||||
ClusterId string `form:"clusterId,optional"`
|
||||
}
|
||||
|
||||
type AlertRulesResp struct {
|
||||
|
|
Loading…
Reference in New Issue