Merge pull request 'fix bugs' (#77) from devad/pcm-coordinator:master into master

Former-commit-id: c3d4d5629b00296f0aecd6a4627600302f21db19
This commit is contained in:
devad 2024-03-27 11:01:43 +08:00
commit 2914bdb7d9
6 changed files with 75 additions and 0 deletions

View File

@ -727,6 +727,8 @@ type ClusterRelationInfo {
CLabel string `json:"cLabel,omitempty" db:"label"`
COwnerId string `json:"cOwnerId,omitempty" db:"owner_id"`
CAuthType string `json:"cAuthType,omitempty" db:"auth_type"`
CRegionDict string `json:"cRegionDict,omitempty" db:"-"`
CProducerDict string `json:"CProducerDict,omitempty" db:"-"`
CCreateTime string `json:"cCreateTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
}

View File

@ -1109,6 +1109,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/schedule/ai/getStrategies",
Handler: schedule.ScheduleGetStrategyHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/schedule/ai/getAlgorithms",
Handler: schedule.ScheduleGetAlgorithmsHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/schedule/submit",

View File

@ -0,0 +1,24 @@
package schedule
import (
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func ScheduleGetAlgorithmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AiAlgorithmsReq
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := schedule.NewScheduleGetAlgorithmsLogic(r.Context(), svcCtx)
resp, err := l.ScheduleGetAlgorithms(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@ -75,6 +75,8 @@ func (l *GetAdapterRelationLogic) GetAdapterRelation(req *types.AdapterRelationQ
cr.CLabel = c.Label
cr.COwnerId = c.OwnerId
cr.CAuthType = c.AuthType
cr.CRegionDict = c.RegionDict
cr.CProducerDict = c.ProducerDict
cr.CCreateTime = c.CreateTime
rlist = append(rlist, cr)
}

View File

@ -0,0 +1,30 @@
package schedule
import (
"context"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type ScheduleGetAlgorithmsLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewScheduleGetAlgorithmsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ScheduleGetAlgorithmsLogic {
return &ScheduleGetAlgorithmsLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *ScheduleGetAlgorithmsLogic) ScheduleGetAlgorithms(req *types.AiAlgorithmsReq) (resp *types.AiAlgorithmsResp, err error) {
// todo: add your logic here and delete this line
return
}

View File

@ -704,6 +704,8 @@ type ClusterRelationInfo struct {
CLabel string `json:"cLabel,omitempty" db:"label"`
COwnerId string `json:"cOwnerId,omitempty" db:"owner_id"`
CAuthType string `json:"cAuthType,omitempty" db:"auth_type"`
CRegionDict string `json:"cRegionDict,omitempty" db:"-"`
CProducerDict string `json:"CProducerDict,omitempty" db:"-"`
CCreateTime string `json:"cCreateTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
}
@ -5205,6 +5207,16 @@ type AiStrategyResp struct {
Strategies []string `json:"strategies"`
}
type AiAlgorithmsReq struct {
ResourceType string `json:"resourceType"`
TaskType string `json:"taskType"`
Dataset string `json:"dataset"`
}
type AiAlgorithmsResp struct {
Algorithms []string `json:"algorithms"`
}
type PullTaskInfoReq struct {
AdapterId int64 `form:"adapterId"`
}