diff --git a/api/internal/logic/schedule/schedulegetairesourcetypeslogic.go b/api/internal/logic/schedule/schedulegetairesourcetypeslogic.go index 8f8348af..025642bf 100644 --- a/api/internal/logic/schedule/schedulegetairesourcetypeslogic.go +++ b/api/internal/logic/schedule/schedulegetairesourcetypeslogic.go @@ -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 } diff --git a/api/internal/logic/schedule/schedulegetaitasktypeslogic.go b/api/internal/logic/schedule/schedulegetaitasktypeslogic.go index 01f168f9..926e4dbc 100644 --- a/api/internal/logic/schedule/schedulegetaitasktypeslogic.go +++ b/api/internal/logic/schedule/schedulegetaitasktypeslogic.go @@ -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 } diff --git a/api/internal/logic/schedule/schedulegetdatasetslogic.go b/api/internal/logic/schedule/schedulegetdatasetslogic.go index 54997d6f..99a3dd43 100644 --- a/api/internal/logic/schedule/schedulegetdatasetslogic.go +++ b/api/internal/logic/schedule/schedulegetdatasetslogic.go @@ -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 } diff --git a/api/internal/logic/schedule/schedulegetstrategylogic.go b/api/internal/logic/schedule/schedulegetstrategylogic.go index 102ec4b9..9b591f83 100644 --- a/api/internal/logic/schedule/schedulegetstrategylogic.go +++ b/api/internal/logic/schedule/schedulegetstrategylogic.go @@ -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 } diff --git a/api/internal/scheduler/schedulers/aiScheduler.go b/api/internal/scheduler/schedulers/aiScheduler.go index 3077b67b..c8b5c72b 100644 --- a/api/internal/scheduler/schedulers/aiScheduler.go +++ b/api/internal/scheduler/schedulers/aiScheduler.go @@ -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 } diff --git a/api/internal/scheduler/strategy/strategy.go b/api/internal/scheduler/strategy/strategy.go index ef9123cc..b73288ef 100644 --- a/api/internal/scheduler/strategy/strategy.go +++ b/api/internal/scheduler/strategy/strategy.go @@ -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 { diff --git a/api/internal/scheduler/strategy/test/strategy_test.go b/api/internal/scheduler/strategy/test/strategy_test.go index 6331d136..e92bf482 100644 --- a/api/internal/scheduler/strategy/test/strategy_test.go +++ b/api/internal/scheduler/strategy/test/strategy_test.go @@ -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",