Merge pull request 'updated the scheduler module' (#8) from tzwang/pcm-coordinator:master into master

Former-commit-id: 2e745f2c7adc245598118de1114b85b4a8720af0
This commit is contained in:
tzwang 2024-01-19 17:40:44 +08:00
commit c22a9cc8f0
11 changed files with 54 additions and 10 deletions

View File

@ -52,3 +52,7 @@ func (as *AiScheduler) pickOptimalStrategy() (strategies.Strategy, error) {
func (as *AiScheduler) genTaskAndProviders() (*providerPricing.Task, []*providerPricing.Provider) {
return nil, nil
}
func (as *AiScheduler) assignTask(clusters []*strategies.AssignedCluster) error {
return nil
}

View File

@ -116,3 +116,7 @@ func (cs *CloudScheduler) genTaskAndProviders() (*providerPricing.Task, []*provi
return nil, providerList, nil
}
func (cs *CloudScheduler) assignTask(clusters []*strategies.AssignedCluster) error {
return nil
}

View File

@ -0,0 +1,13 @@
package collector
//单条作业费=作业运行秒数×(CPU核心数*CPU单价+GPU卡数×GPU单价+DCU卡数×DCU单价)/3600
//CPU单价=队列CPU费率×计算中心CPU单价
//GPU单价=队列GPU费率×计算中心GPU单价
//DCU单价=队列DCU费率×计算中心DCU单价
type ShuguangAiCollector struct {
}
func (a *ShuguangAiCollector) getResourceSpecs() {
}

View File

@ -1,8 +0,0 @@
package collector
type AiCollector struct {
}
func (a *AiCollector) getResourceSpecs() {
}

View File

@ -1,8 +1,19 @@
package collector
type ResourceCollector interface {
getResourceSpecs()
getResourceSpecs() ([]ResourceSpecs, error)
}
type ResourceSpecs struct {
CpuAvail float64
MemAvail float64
DiskAvail float64
GpuAvail float64
CardAvail []Card
}
type Card struct {
Type string
Name string
TOpsAtFp16 float64
}

View File

@ -24,6 +24,7 @@ import (
type scheduleService interface {
getNewStructForDb(task *response.TaskInfo, resource string, participantId int64) (interface{}, error)
pickOptimalStrategy() (strategies.Strategy, error)
assignTask(clusters []*strategies.AssignedCluster) error
}
// 求交集

View File

@ -49,3 +49,7 @@ func (h *HpcScheduler) pickOptimalStrategy() (strategies.Strategy, error) {
func (h *HpcScheduler) genTaskAndProviders(task *response.TaskInfo) (*providerPricing.Task, []*providerPricing.Provider) {
return nil, nil
}
func (h *HpcScheduler) assignTask(clusters []*strategies.AssignedCluster) error {
return nil
}

View File

@ -136,7 +136,7 @@ func (s *scheduler) AssignAndSchedule() error {
return err
}
_, err = strategy.Schedule()
clusters, err := strategy.Schedule()
if err != nil {
return err
}
@ -147,6 +147,11 @@ func (s *scheduler) AssignAndSchedule() error {
// return nil
//}
err = s.scheduleService.assignTask(clusters)
if err != nil {
return err
}
return nil
}

View File

@ -0,0 +1,10 @@
package strategies
type StaticWeightStrategy struct {
// TODO: add fields
}
func (ps *StaticWeightStrategy) Schedule() ([]*AssignedCluster, error) {
// TODO: implement the scheduling logic return nil, nil
return nil, nil
}