scheduler

package
v1.5.0-slog4 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scheduler

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

func NewScheduler

func NewScheduler(ctx context.Context, logger *log.Logger) *Scheduler

NewScheduler returns a new instance of scheduler

func (*Scheduler) AddExtender

func (s *Scheduler) AddExtender(ext extenders.Extender) error

AddExtender adds a new extender to the slice of the extenders that are used to determine modules' states

func (*Scheduler) AddModuleVertex

func (s *Scheduler) AddModuleVertex(module node.ModuleInterface) error

AddModuleVertex adds a new vertex of type Module to the graph

func (*Scheduler) ApplyExtenders

func (s *Scheduler) ApplyExtenders(extendersEnv string) error

ApplyExtenders excludes and reorders attached extenders according to the APPLIED_MODULE_EXTENDERS env variable

func (*Scheduler) EventCh

func (s *Scheduler) EventCh() chan extenders.ExtenderEvent

func (*Scheduler) Filter

func (s *Scheduler) Filter(extName extenders.ExtenderName, moduleName string, logLabels map[string]string) (*bool, error)

Filter returns filtering result for the specified extender and module

func (*Scheduler) GetEnabledModuleNames

func (s *Scheduler) GetEnabledModuleNames() []string

GetEnabledModuleNames returns a list of all enabled module-type vertices from s.enabledModules so that traversing the graph isn't required.

func (*Scheduler) GetGraphImage

func (s *Scheduler) GetGraphImage() (image.Image, error)

GetGraphImage draws current graph's image

func (*Scheduler) GetGraphState

func (s *Scheduler) GetGraphState(logLabels map[string]string) ([]string, map[node.NodeWeight][]string, map[string]bool, error)

GetGraphState returns: * list of enabled modules if not nil * current modules diff * error if any if s.enabledModules is nil, we infer that the graph hasn't been calculated yet and run RecalculateGraph for the first time. if s.errList isn't empty, we try to recalculate the graph in case there were some minor errors last time.

func (*Scheduler) GetModuleNodes

func (s *Scheduler) GetModuleNodes() ([]*node.Node, error)

GetModuleNodes traverses the graph in BFS-way and returns all Module-type vertices

func (*Scheduler) GetUpdatedByExtender added in v1.4.3

func (s *Scheduler) GetUpdatedByExtender(moduleName string) (string, error)

func (*Scheduler) IsModuleEnabled

func (s *Scheduler) IsModuleEnabled(moduleName string) bool

func (*Scheduler) PrintSummary

func (s *Scheduler) PrintSummary() (map[string]bool, error)

PrintSummary returns resulting consisting of all module-type vertices, their states and last applied extenders

func (*Scheduler) RecalculateGraph

func (s *Scheduler) RecalculateGraph(logLabels map[string]string) (bool, []string)

RecalculateGraph is a public version of recalculateGraphState()

Directories

Path Synopsis
mock
a bunch of mocked extenders for tests
a bunch of mocked extenders for tests

Jump to

Keyboard shortcuts

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