示例#1
0
func NewScheduler(leader string, option *SchedulerOption) *Scheduler {
	s := &Scheduler{
		Leader:       leader,
		EventChan:    make(chan interface{}),
		Market:       market.NewMarket(),
		shardLocator: NewDatasetShardLocator(option.ExecutableFileHash),
		option:       option,
	}
	s.Market.SetScoreFunction(s.Score).SetFetchFunction(s.Fetch)
	return s
}
示例#2
0
func NewScheduler(leader string, option *SchedulerOption) *Scheduler {
	s := &Scheduler{
		Leader:                leader,
		EventChan:             make(chan interface{}),
		Market:                market.NewMarket(),
		datasetShard2Location: make(map[string]resource.Location),
		option:                option,
	}
	s.Market.SetScoreFunction(s.Score).SetFetchFunction(s.Fetch)
	s.waitForAllInputs = sync.NewCond(&s.datasetShard2LocationLock)
	return s
}