forked from JointCloud/pcm-coordinator
36 lines
841 B
Go
36 lines
841 B
Go
package schedule
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type QueryResourcesLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewQueryResourcesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QueryResourcesLogic {
|
|
return &QueryResourcesLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *QueryResourcesLogic) QueryResources(req *types.QueryResourcesReq) (resp *types.QueryResourcesResp, err error) {
|
|
resp = &types.QueryResourcesResp{}
|
|
|
|
_, err = l.svcCtx.Scheduler.AiService.AiCollectorAdapterMap[req.AdapterId]["req.ClusterId"].GetResourceUsage(l.ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return resp, nil
|
|
}
|