modified schedule apis
Former-commit-id: a30d161c27346206ae0eaeaa2056eb2b1e97f756
This commit is contained in:
parent
ceaad28539
commit
3102a154c5
|
@ -2,6 +2,7 @@ package schedule
|
|||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/storeLink"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
||||
|
@ -24,7 +25,9 @@ func NewScheduleGetAiResourceTypesLogic(ctx context.Context, svcCtx *svc.Service
|
|||
}
|
||||
|
||||
func (l *ScheduleGetAiResourceTypesLogic) ScheduleGetAiResourceTypes() (resp *types.AiResourceTypesResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
resp = &types.AiResourceTypesResp{}
|
||||
resourceTypes := storeLink.GetResourceTypes()
|
||||
resp.ResourceTypes = resourceTypes
|
||||
|
||||
return
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package schedule
|
|||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/storeLink"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
||||
|
@ -24,7 +25,9 @@ func NewScheduleGetAiTaskTypesLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
|||
}
|
||||
|
||||
func (l *ScheduleGetAiTaskTypesLogic) ScheduleGetAiTaskTypes() (resp *types.AiTaskTypesResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
resp = &types.AiTaskTypesResp{}
|
||||
taskTypes := storeLink.GetTaskTypes()
|
||||
resp.TaskTypes = taskTypes
|
||||
|
||||
return
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package schedule
|
|||
|
||||
import (
|
||||
"context"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/scheduler/service"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/storeLink"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
||||
|
@ -24,7 +26,12 @@ func NewScheduleGetDatasetsLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
|||
}
|
||||
|
||||
func (l *ScheduleGetDatasetsLogic) ScheduleGetDatasets() (resp *types.AiDatasetsResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
resp = &types.AiDatasetsResp{}
|
||||
_, colMap := service.InitAiClusterMap(l.ctx, l.svcCtx)
|
||||
names, err := storeLink.GetDatasetsNames(colMap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.Datasets = names
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package schedule
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/scheduler/strategy"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
||||
|
||||
|
@ -24,7 +24,9 @@ func NewScheduleGetStrategyLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
|||
}
|
||||
|
||||
func (l *ScheduleGetStrategyLogic) ScheduleGetStrategy() (resp *types.AiStrategyResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
resp = &types.AiStrategyResp{}
|
||||
names := strategy.GetStrategyNames()
|
||||
resp.Strategies = names
|
||||
|
||||
return
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ func (as *AiScheduler) PickOptimalStrategy() (strategy.Strategy, error) {
|
|||
case strategy.REPLICATION:
|
||||
strategy := strategy.NewReplicationStrategy(¶m.ReplicationParams{Params: params, Replicas: 1})
|
||||
return strategy, nil
|
||||
case strategy.RESOURCE_PRICING:
|
||||
case strategy.RESOURCES_PRICING:
|
||||
strategy := strategy.NewPricingStrategy(¶m.ResourcePricingParams{Params: params, Replicas: 1})
|
||||
return strategy, nil
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package strategy
|
||||
|
||||
const (
|
||||
REPLICATION = "replication"
|
||||
RESOURCE_PRICING = "resourcePricing"
|
||||
STATIC_WEIGHT = "staticWeight"
|
||||
DYNAMIC_WEIGHT = "dynamicWeight"
|
||||
REPLICATION = "replication"
|
||||
RESOURCES_PRICING = "resourcesPricing"
|
||||
STATIC_WEIGHT = "staticWeight"
|
||||
DYNAMIC_RESOURCES = "dynamicResources"
|
||||
)
|
||||
|
||||
var (
|
||||
strategyNames = []string{REPLICATION, RESOURCE_PRICING}
|
||||
strategyNames = []string{REPLICATION, RESOURCES_PRICING, STATIC_WEIGHT, DYNAMIC_RESOURCES}
|
||||
)
|
||||
|
||||
type Strategy interface {
|
||||
|
|
|
@ -15,7 +15,7 @@ func TestReplication(t *testing.T) {
|
|||
{Name: "test2", Participant_id: 2},
|
||||
{Name: "test3", Participant_id: 3},
|
||||
}
|
||||
rsc := []*collector.ResourceSpecs{
|
||||
rsc := []*collector.ResourceStats{
|
||||
{
|
||||
ParticipantId: 1,
|
||||
Name: "test1",
|
||||
|
@ -31,7 +31,7 @@ func TestReplication(t *testing.T) {
|
|||
name string
|
||||
replica int32
|
||||
ps []entity.Participant
|
||||
res []*collector.ResourceSpecs
|
||||
res []*collector.ResourceStats
|
||||
}{
|
||||
{
|
||||
name: "test1",
|
||||
|
|
Loading…
Reference in New Issue