manager

package
v2.3.19+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskExecutorStatusWaiting string = "waiting"
	TaskExecutorStatusRunning string = "running"
	TaskExecutorStatusFailed  string = "failed"
	TaskExecutorStatusKilled  string = "killed"
	TaskExecutorStatusSuccess string = "success"
)

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(cleanupArgs *api.CleanupArgs) (*api.CleanupResult, error)

func CompletedNotify

func CompletedNotify(completedNotifyArgs *api.CompletedNotifyArgs) (*api.CompletedNotifyResult, error)

func Expire

func Expire(expireArgs *api.ExpireArgs) (*api.ExpireResult, error)

func GetCandidateBaremetalList

func GetCandidateBaremetalList(
	candidates []core.Candidater,
	args *api.CandidateListArgs,
	r *api.CandidateListResult,
) (*api.CandidateListResult, error)

func GetCandidateDetail

func GetCandidateDetail(args *api.CandidateDetailArgs) (*api.CandidateDetailResult, error)

func GetCandidateHostList

func GetCandidateHostList(
	candidates []core.Candidater,
	args *api.CandidateListArgs,
	r *api.CandidateListResult,
) (*api.CandidateListResult, error)

func GetCandidateHostsDesc

func GetCandidateHostsDesc() ([]*candidate.HostDesc, error)

func GetCandidateList

func GetCandidateList(args *api.CandidateListArgs) (*api.CandidateListResult, error)

func GetCandidateManager

func GetCandidateManager() *data_manager.CandidateManager

func GetHistoryDetail

func GetHistoryDetail(historyDetailArgs *api.HistoryDetailArgs) (*api.HistoryDetailResult, error)

func GetHistoryList

func GetHistoryList(historyArgs *api.HistoryArgs) (*api.HistoryResult, error)

func GetK8sCandidateHosts

func GetK8sCandidateHosts(nodesName ...string) ([]*candidatecache.HostDesc, error)

func GetK8sClient

func GetK8sClient() (*kubernetes.Clientset, error)

func InitAndStart

func InitAndStart(stopCh <-chan struct{})

func IsReady

func IsReady() bool

func NewSessionID

func NewSessionID() string

NewSessionID returns the current timestamp of a string type with precision of milliseconds. And it should be consistent with the format of Region. just like: 1509699887616

func Schedule

func Schedule(info *api.SchedInfo) ([]*core.SchedResultItem, error)

Schedule process the request data that is scheduled for dispatch and complements the session information.

Types

type BaremetalCandidatesProvider

type BaremetalCandidatesProvider struct {
	*BaseCandidateProvider
}

func NewBaremetalCandidatesProvider

func NewBaremetalCandidatesProvider(s Scheduler) *BaremetalCandidatesProvider

func (*BaremetalCandidatesProvider) CandidateType

func (b *BaremetalCandidatesProvider) CandidateType() string

func (*BaremetalCandidatesProvider) Candidates

func (b *BaremetalCandidatesProvider) Candidates() ([]core.Candidater, error)

func (*BaremetalCandidatesProvider) ProviderType

func (b *BaremetalCandidatesProvider) ProviderType() string

type BaremetalScheduler

type BaremetalScheduler struct {
	*BaseScheduler
	// contains filtered or unexported fields
}

BaremetalScheduler for baremetal type schedule

func (*BaremetalScheduler) Candidates

func (bs *BaremetalScheduler) Candidates() ([]core.Candidater, error)

func (*BaremetalScheduler) Predicates

func (bs *BaremetalScheduler) Predicates() (map[string]core.FitPredicate, error)

func (*BaremetalScheduler) PriorityConfigs

func (bs *BaremetalScheduler) PriorityConfigs() ([]core.PriorityConfig, error)

type BaseCandidateProvider

type BaseCandidateProvider struct {
	// contains filtered or unexported fields
}

func (*BaseCandidateProvider) CandidateManager

func (b *BaseCandidateProvider) CandidateManager() *data_manager.CandidateManager

type BaseScheduler

type BaseScheduler struct {
	// contains filtered or unexported fields
}

func (*BaseScheduler) BeforePredicate

func (s *BaseScheduler) BeforePredicate() error

func (*BaseScheduler) CandidateManager

func (s *BaseScheduler) CandidateManager() *data_manager.CandidateManager

func (*BaseScheduler) DirtySelectedCandidates

func (s *BaseScheduler) DirtySelectedCandidates(scs []*core.SelectedCandidate)

func (*BaseScheduler) NewSchedUnit

func (s *BaseScheduler) NewSchedUnit() *core.Unit

func (*BaseScheduler) SchedData

func (s *BaseScheduler) SchedData() *api.SchedData

func (*BaseScheduler) Unit

func (s *BaseScheduler) Unit() *core.Unit

type CandidatesProvider

type CandidatesProvider interface {
	ProviderType() string
	CandidateType() string
	Candidates() ([]core.Candidater, error)
	CandidateManager() *data_manager.CandidateManager
}

type CompletedManager

type CompletedManager struct {
	// contains filtered or unexported fields
}

func NewCompletedManager

func NewCompletedManager(stopCh <-chan struct{}) *CompletedManager

func (*CompletedManager) Add

func (c *CompletedManager) Add(completedNotifyArgs *api.CompletedNotifyArgs)

func (*CompletedManager) Run

func (c *CompletedManager) Run()

type ExpireManager

type ExpireManager struct {
	// contains filtered or unexported fields
}

func NewExpireManager

func NewExpireManager(stopCh <-chan struct{}) *ExpireManager

func (*ExpireManager) Add

func (e *ExpireManager) Add(expireArgs *api.ExpireArgs)

func (*ExpireManager) Run

func (e *ExpireManager) Run()

type GuestScheduler

type GuestScheduler struct {
	*BaseScheduler
	// contains filtered or unexported fields
}

GuestScheduler for guest type schedule

func (*GuestScheduler) Candidates

func (gs *GuestScheduler) Candidates() ([]core.Candidater, error)

func (*GuestScheduler) Predicates

func (gs *GuestScheduler) Predicates() (map[string]core.FitPredicate, error)

func (*GuestScheduler) PriorityConfigs

func (gs *GuestScheduler) PriorityConfigs() ([]core.PriorityConfig, error)

type HistoryItem

type HistoryItem struct {
	Task *Task
	Time time.Time
}

func NewHistoryItem

func NewHistoryItem(task *Task) *HistoryItem

func (*HistoryItem) IsSuggestion

func (h *HistoryItem) IsSuggestion() bool

func (*HistoryItem) ToMap

func (h *HistoryItem) ToMap() map[string]string

type HistoryManager

type HistoryManager struct {
	// contains filtered or unexported fields
}

func NewHistoryManager

func NewHistoryManager(stopCh <-chan struct{}) *HistoryManager

func (*HistoryManager) GetHistory

func (m *HistoryManager) GetHistory(sessionId string) *HistoryItem

func (*HistoryManager) GetHistoryList

func (m *HistoryManager) GetHistoryList(offset int64, limit int64, all bool) ([]*HistoryItem, int64)

func (*HistoryManager) NewHistoryItem

func (m *HistoryManager) NewHistoryItem(task *Task) *HistoryItem

func (*HistoryManager) Run

func (m *HistoryManager) Run()

type HostCandidatesProvider

type HostCandidatesProvider struct {
	*BaseCandidateProvider
}

func NewHostCandidatesProvider

func NewHostCandidatesProvider(s Scheduler) *HostCandidatesProvider

func (*HostCandidatesProvider) CandidateType

func (h *HostCandidatesProvider) CandidateType() string

func (*HostCandidatesProvider) Candidates

func (h *HostCandidatesProvider) Candidates() ([]core.Candidater, error)

func (*HostCandidatesProvider) ProviderType

func (h *HostCandidatesProvider) ProviderType() string

type Scheduler

type Scheduler interface {
	SchedData() *api.SchedData
	CandidateManager() *data_manager.CandidateManager

	// Schedule process
	BeforePredicate() error
	Predicates() (map[string]core.FitPredicate, error)
	PriorityConfigs() ([]core.PriorityConfig, error)

	// Schedule input get function
	Unit() *core.Unit
	Candidates() ([]core.Candidater, error)

	DirtySelectedCandidates([]*core.SelectedCandidate)
}

type SchedulerManager

type SchedulerManager struct {
	ExpireManager    *ExpireManager
	CompletedManager *CompletedManager
	HistoryManager   *HistoryManager
	TaskManager      *TaskManager

	DataManager      *data_manager.DataManager
	CandidateManager *data_manager.CandidateManager
	//ReservedPoolManager *data_manager.ReservedPoolManager
	//NetworkManager   *data_manager.NetworkManager
	KubeClusterManager *k8s.SKubeClusterManager
}

func GetScheduleManager

func GetScheduleManager() *SchedulerManager

func NewSchedulerManager

func NewSchedulerManager(stopCh <-chan struct{}) *SchedulerManager

type Task

type Task struct {
	Time      time.Time
	SchedInfo *api.SchedInfo
	Consuming time.Duration
	// contains filtered or unexported fields
}

func NewTask

func NewTask(manager *SchedulerManager, schedInfo *api.SchedInfo) *Task

func (*Task) GetResult

func (t *Task) GetResult() ([]*core.SchedResultItem, error)

func (*Task) GetSessionID

func (t *Task) GetSessionID() string

func (*Task) GetStatus

func (t *Task) GetStatus() string

func (*Task) GetTaskExecutor

func (t *Task) GetTaskExecutor(tag string) *TaskExecutor

func (*Task) Wait

func (t *Task) Wait() ([]*core.SchedResultItem, error)

type TaskExecuteCallback

type TaskExecuteCallback func(task *TaskExecutor)

type TaskExecutor

type TaskExecutor struct {
	Tag       string
	Status    string
	Time      time.Time
	Consuming time.Duration
	// contains filtered or unexported fields
}

func NewTaskExecutor

func NewTaskExecutor(scheduler Scheduler, taskExecuteCallback TaskExecuteCallback) *TaskExecutor

func (*TaskExecutor) Execute

func (te *TaskExecutor) Execute()

func (*TaskExecutor) GetLogs

func (te *TaskExecutor) GetLogs() []string

func (*TaskExecutor) GetResult

func (te *TaskExecutor) GetResult() ([]*core.SchedResultItem, error)

func (*TaskExecutor) Kill

func (te *TaskExecutor) Kill()

type TaskExecutorQueue

type TaskExecutorQueue struct {
	// contains filtered or unexported fields
}

func NewTaskExecutorQueue

func NewTaskExecutorQueue(schedType string, poolId string, stopCh <-chan struct{}) *TaskExecutorQueue

func (*TaskExecutorQueue) AddTaskExecutor

func (teq *TaskExecutorQueue) AddTaskExecutor(scheduler Scheduler,
	callback TaskExecuteCallback) *TaskExecutor

func (*TaskExecutorQueue) Start

func (teq *TaskExecutorQueue) Start(stopCh <-chan struct{})

type TaskExecutorQueueManager

type TaskExecutorQueueManager struct {
	// contains filtered or unexported fields
}

func NewTaskExecutorQueueManager

func NewTaskExecutorQueueManager(stopCh <-chan struct{}) *TaskExecutorQueueManager

func (*TaskExecutorQueueManager) AddTaskExecutor

func (teqm *TaskExecutorQueueManager) AddTaskExecutor(
	scheduler Scheduler, callback TaskExecuteCallback) *TaskExecutor

func (*TaskExecutorQueueManager) GetQueue

func (teqm *TaskExecutorQueueManager) GetQueue(schedType string, poolId string,
) *TaskExecutorQueue

type TaskManager

type TaskManager struct {
	// contains filtered or unexported fields
}

func NewTaskManager

func NewTaskManager(stopCh <-chan struct{}) *TaskManager

func (*TaskManager) AddTask

func (tm *TaskManager) AddTask(schedulerManager *SchedulerManager, schedInfo *api.SchedInfo) (*Task, error)

AddTask provides an interface to increase the scheduling task, it will be a scheduling request by the host specification type split into multiple scheduling tasks, added to the scheduling task manager.

func (*TaskManager) Run

func (tm *TaskManager) Run()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL