modified schedule apis
Former-commit-id: a30d161c27346206ae0eaeaa2056eb2b1e97f756
This commit is contained in:
parent
ceaad28539
commit
3102a154c5
|
@ -2,6 +2,7 @@ package schedule
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"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/svc"
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
"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) {
|
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 (
|
import (
|
||||||
"context"
|
"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/svc"
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
"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) {
|
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 (
|
import (
|
||||||
"context"
|
"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/svc"
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
"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) {
|
func (l *ScheduleGetDatasetsLogic) ScheduleGetDatasets() (resp *types.AiDatasetsResp, err error) {
|
||||||
// todo: add your logic here and delete this line
|
resp = &types.AiDatasetsResp{}
|
||||||
|
_, colMap := service.InitAiClusterMap(l.ctx, l.svcCtx)
|
||||||
return
|
names, err := storeLink.GetDatasetsNames(colMap)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
resp.Datasets = names
|
||||||
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package schedule
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"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/svc"
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
"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) {
|
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:
|
case strategy.REPLICATION:
|
||||||
strategy := strategy.NewReplicationStrategy(¶m.ReplicationParams{Params: params, Replicas: 1})
|
strategy := strategy.NewReplicationStrategy(¶m.ReplicationParams{Params: params, Replicas: 1})
|
||||||
return strategy, nil
|
return strategy, nil
|
||||||
case strategy.RESOURCE_PRICING:
|
case strategy.RESOURCES_PRICING:
|
||||||
strategy := strategy.NewPricingStrategy(¶m.ResourcePricingParams{Params: params, Replicas: 1})
|
strategy := strategy.NewPricingStrategy(¶m.ResourcePricingParams{Params: params, Replicas: 1})
|
||||||
return strategy, nil
|
return strategy, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package strategy
|
package strategy
|
||||||
|
|
||||||
const (
|
const (
|
||||||
REPLICATION = "replication"
|
REPLICATION = "replication"
|
||||||
RESOURCE_PRICING = "resourcePricing"
|
RESOURCES_PRICING = "resourcesPricing"
|
||||||
STATIC_WEIGHT = "staticWeight"
|
STATIC_WEIGHT = "staticWeight"
|
||||||
DYNAMIC_WEIGHT = "dynamicWeight"
|
DYNAMIC_RESOURCES = "dynamicResources"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
strategyNames = []string{REPLICATION, RESOURCE_PRICING}
|
strategyNames = []string{REPLICATION, RESOURCES_PRICING, STATIC_WEIGHT, DYNAMIC_RESOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
type Strategy interface {
|
type Strategy interface {
|
||||||
|
|
|
@ -15,7 +15,7 @@ func TestReplication(t *testing.T) {
|
||||||
{Name: "test2", Participant_id: 2},
|
{Name: "test2", Participant_id: 2},
|
||||||
{Name: "test3", Participant_id: 3},
|
{Name: "test3", Participant_id: 3},
|
||||||
}
|
}
|
||||||
rsc := []*collector.ResourceSpecs{
|
rsc := []*collector.ResourceStats{
|
||||||
{
|
{
|
||||||
ParticipantId: 1,
|
ParticipantId: 1,
|
||||||
Name: "test1",
|
Name: "test1",
|
||||||
|
@ -31,7 +31,7 @@ func TestReplication(t *testing.T) {
|
||||||
name string
|
name string
|
||||||
replica int32
|
replica int32
|
||||||
ps []entity.Participant
|
ps []entity.Participant
|
||||||
res []*collector.ResourceSpecs
|
res []*collector.ResourceStats
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "test1",
|
name: "test1",
|
||||||
|
|
Loading…
Reference in New Issue