Documentation ¶
Index ¶
- type Nodes
- type Scheduler
- func (scheduler *Scheduler) HashAlloc(location string, nodes *Nodes)
- func (scheduler *Scheduler) HashSingleJobAlloc(location string, jobid string)
- func (s *Scheduler) PrefAlloc(location string, nodes *Nodes)
- func (s *Scheduler) PrefSingleJobAlloc(location string, jobid string)
- func (scheduler *Scheduler) QuickAlloc(online gzkwrapper.NodesPair, offline gzkwrapper.NodesPair)
- func (scheduler *Scheduler) RecoveryLocationAlloc(location string, jobs []*models.SimpleJob)
- func (scheduler *Scheduler) SingleJobAlloc(location string, jobid string)
- type SchedulerConfigs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Nodes ¶
type Nodes struct { Online gzkwrapper.NodesPair Offline gzkwrapper.NodesPair }
Nodes is exported
type Scheduler ¶
type Scheduler struct { *SchedulerConfigs // contains filtered or unexported fields }
Scheduler is exported
func NewScheduler ¶
func NewScheduler(configs *SchedulerConfigs, cacheRepository *cache.CacheRepository) *Scheduler
NewScheduler is exported
func (*Scheduler) HashAlloc ¶
HashAlloc hash分配原则: 1、若location下只有worker上线情况(online > 0, offline == 0) location中worker环发生了变化, 将环中所有worker的jobs重新分配一次, 状态为STARTED的job排除在外. 将job的状态设置为REALLOC. 2、若location下只有worker下线情况(online == 0, offline > 0) location中worker环虽然发生了变化,但为了避免location下所有jobs全都调整(抖动过大),因此只处理下线worker的所有jobs. 将job的状态设置为REALLOC. 3、若location下既有worker上线,也有worker下线(online > 0, offline > 0) 记录下线worker的jobs到临时缓存(tempOffJobs) 将location中所有worker的job重新分配一次,但状态为STARTED同时在tempOffJobs中未查询到的job排除在外. 在tempOffJobs中的job虽然为启动状态,但有可能worker是异常关闭没有改变job状态,所以必须重新分配. 将job的状态设置为REALLOC.
func (*Scheduler) HashSingleJobAlloc ¶
HashSingleJobAlloc: 调整单一job 条件:当创建或修改job后调用该方法
func (*Scheduler) PrefSingleJobAlloc ¶
func (*Scheduler) QuickAlloc ¶
func (scheduler *Scheduler) QuickAlloc(online gzkwrapper.NodesPair, offline gzkwrapper.NodesPair)
QuickAlloc is exported 以节点状态改变为条件进行分配,调度器对上下线节点进行job调整.
func (*Scheduler) RecoveryLocationAlloc ¶
RecoveryLocationAlloc is exported 检查location下所有enabled已打开的job 1、若分配表中不存在,则重新分配一次. 2、已存在,则检测分配的节点是否已发生改变,若改变则重新再分配.
func (*Scheduler) SingleJobAlloc ¶
SingleJobAlloc is exported 以job为条件进行分配,当创建或删除Job时调度器会立即分配
type SchedulerConfigs ¶
SchedulerConfigs is exported
Click to show internal directories.
Click to hide internal directories.