|
1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package ai
-
- 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 TrainingTaskStatLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
-
- func NewTrainingTaskStatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TrainingTaskStatLogic {
- return &TrainingTaskStatLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
-
- func (l *TrainingTaskStatLogic) TrainingTaskStat() (resp *types.TrainingTaskStatResp, err error) {
- resp = &types.TrainingTaskStatResp{}
-
- total, err := l.svcCtx.Scheduler.AiStorages.GetTrainingTaskTotalNum()
- if err != nil {
- return nil, err
- }
-
- running, err := l.svcCtx.Scheduler.AiStorages.GetTrainingTaskRunningNum()
- if err != nil {
- return nil, err
- }
-
- resp.Total = total
- resp.Running = running
- return resp, nil
- }
|