algorithm

package
v0.0.0-...-72cb277 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CellEqual

func CellEqual(c1 Cell, c2 Cell) bool

func NewTopologyAwareScheduler

func NewTopologyAwareScheduler(
	ccl ChainCellList,
	levelLeafCellNum map[CellLevel]int32,
	crossPriorityPack bool) *topologyAwareScheduler

NewTopologyAwareScheduler initializes the scheduler by extracting node-level cells (lower-level if no node-level) from a free cell list.

func ParseConfig

func ParseConfig(sConfig *api.Config) (
	physicalFullList map[CellChain]ChainCellList,
	physicalFreeList map[CellChain]ChainCellList,
	vcFreeCellNum map[api.VirtualClusterName]map[CellChain]map[CellLevel]int32,
	virtualNonPinnedFullList map[api.VirtualClusterName]map[CellChain]ChainCellList,
	virtualNonPinnedFreeList map[api.VirtualClusterName]map[CellChain]ChainCellList,
	virtualPinnedCells map[api.VirtualClusterName]map[api.PinnedCellId]ChainCellList,
	physicalPinnedCells map[api.VirtualClusterName]map[api.PinnedCellId]*PhysicalCell,
	cellLevelToLeafCellNum map[CellChain]map[CellLevel]int32,
	leafCellTypeToChain map[string][]CellChain,
	cellLevelToType map[CellChain]map[CellLevel]api.CellType,
)

Types

type AffinityGroupState

type AffinityGroupState string

type AlgoAffinityGroup

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

AlgoAffinityGroup is the algorithm-internal representation of an affinity group.

func (*AlgoAffinityGroup) ToAffinityGroup

func (aag *AlgoAffinityGroup) ToAffinityGroup() api.AffinityGroup

type Cell

type Cell interface {
	GetChain() CellChain
	GetLevel() CellLevel
	GetAddress() api.CellAddress
	GetParent() Cell
	SetParent(Cell)
	GetChildren() CellList
	SetChildren(CellList)
	AtOrHigherThanNode() bool
	GetPriority() CellPriority
	SetPriority(CellPriority)
	GetTotalLeafCellNum() int32
	GetUsedLeafCellNumAtPriorities() map[CellPriority]int32
	IncreaseUsedLeafCellNumAtPriority(CellPriority, int32)
}

A Cell represents a set of leaf cells affinitized by their interconnection topology. Cells are organized as a tree through pointers to their parents / children.

type CellChain

type CellChain string // name of a cell chain (type of the top-level cell)

type CellLevel

type CellLevel int32

type CellList

type CellList []Cell

CellList is a list of cells at a certain level of a chain.

func (CellList) String

func (cl CellList) String() string

type CellPriority

type CellPriority int32

type CellState

type CellState string

type ChainCellList

type ChainCellList map[CellLevel]CellList

ChainCellList maps each level in a chain to a CellList.

func NewChainCellList

func NewChainCellList(top CellLevel) ChainCellList

func (ChainCellList) String

func (ccl ChainCellList) String() string

type GenericCell

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

func (*GenericCell) AtOrHigherThanNode

func (c *GenericCell) AtOrHigherThanNode() bool

func (*GenericCell) GetAddress

func (c *GenericCell) GetAddress() api.CellAddress

func (*GenericCell) GetChain

func (c *GenericCell) GetChain() CellChain

func (*GenericCell) GetChildren

func (c *GenericCell) GetChildren() CellList

func (*GenericCell) GetLevel

func (c *GenericCell) GetLevel() CellLevel

func (*GenericCell) GetParent

func (c *GenericCell) GetParent() Cell

func (*GenericCell) GetPriority

func (c *GenericCell) GetPriority() CellPriority

func (*GenericCell) GetState

func (c *GenericCell) GetState() CellState

func (*GenericCell) GetTotalLeafCellNum

func (c *GenericCell) GetTotalLeafCellNum() int32

func (*GenericCell) GetUsedLeafCellNumAtPriorities

func (c *GenericCell) GetUsedLeafCellNumAtPriorities() map[CellPriority]int32

func (*GenericCell) IncreaseUsedLeafCellNumAtPriority

func (c *GenericCell) IncreaseUsedLeafCellNumAtPriority(p CellPriority, delta int32)

func (*GenericCell) IsHealthy

func (c *GenericCell) IsHealthy() bool

func (*GenericCell) SetParent

func (c *GenericCell) SetParent(p Cell)

type HivedAlgorithm

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

HivedAlgorithm implements an internal.SchedulerAlgorithm. It schedules affinity groups using the algorithm of HiveD. Note that the topologyAwareScheduler used in this struct is not another implementation of SchedulerAlgorithm; that is a specific algorithm for pod placement, used in intra-VC scheduling and opportunistic pod scheduling.

func NewHivedAlgorithm

func NewHivedAlgorithm(sConfig *api.Config) *HivedAlgorithm

NewHivedAlgorithm initializes a HivedAlgorithm from the config file.

func (*HivedAlgorithm) AddAllocatedPod

func (h *HivedAlgorithm) AddAllocatedPod(pod *core.Pod)

func (*HivedAlgorithm) AddNode

func (h *HivedAlgorithm) AddNode(node *core.Node)

func (*HivedAlgorithm) AddUnallocatedPod

func (h *HivedAlgorithm) AddUnallocatedPod(*core.Pod)

func (*HivedAlgorithm) DeleteAllocatedPod

func (h *HivedAlgorithm) DeleteAllocatedPod(pod *core.Pod)

func (*HivedAlgorithm) DeleteNode

func (h *HivedAlgorithm) DeleteNode(node *core.Node)

func (*HivedAlgorithm) DeleteUnallocatedPod

func (h *HivedAlgorithm) DeleteUnallocatedPod(pod *core.Pod)

func (*HivedAlgorithm) GetAffinityGroup

func (h *HivedAlgorithm) GetAffinityGroup(name string) api.AffinityGroup

func (*HivedAlgorithm) GetAllAffinityGroups

func (h *HivedAlgorithm) GetAllAffinityGroups() api.AffinityGroupList

func (*HivedAlgorithm) GetAllVirtualClustersStatus

func (h *HivedAlgorithm) GetAllVirtualClustersStatus() map[api.VirtualClusterName]api.VirtualClusterStatus

func (*HivedAlgorithm) GetClusterStatus

func (h *HivedAlgorithm) GetClusterStatus() api.ClusterStatus

func (*HivedAlgorithm) GetPhysicalClusterStatus

func (h *HivedAlgorithm) GetPhysicalClusterStatus() api.PhysicalClusterStatus

func (*HivedAlgorithm) GetVirtualClusterStatus

func (h *HivedAlgorithm) GetVirtualClusterStatus(vcn api.VirtualClusterName) api.VirtualClusterStatus

func (*HivedAlgorithm) Schedule

func (h *HivedAlgorithm) Schedule(
	pod *core.Pod,
	suggestedNodes []string,
	phase internal.SchedulingPhase) internal.PodScheduleResult

func (*HivedAlgorithm) UpdateNode

func (h *HivedAlgorithm) UpdateNode(oldNode, newNode *core.Node)

type PhysicalCell

type PhysicalCell struct {
	GenericCell
	// contains filtered or unexported fields
}

PhysicalCell defines a cell in the physical cluster.

func NewPhysicalCell

func NewPhysicalCell(
	c CellChain,
	l CellLevel,
	g bool,
	n int32,
	cellType api.CellType,
	address api.CellAddress,
	isNodeLevel bool) *PhysicalCell

func (*PhysicalCell) AddReservingOrReservedGroup

func (c *PhysicalCell) AddReservingOrReservedGroup(g *AlgoAffinityGroup)

func (*PhysicalCell) AddUsingGroup

func (c *PhysicalCell) AddUsingGroup(g *AlgoAffinityGroup)

func (*PhysicalCell) DeleteReservingOrReservedGroup

func (c *PhysicalCell) DeleteReservingOrReservedGroup(g *AlgoAffinityGroup)

func (*PhysicalCell) DeleteUsingGroup

func (c *PhysicalCell) DeleteUsingGroup(g *AlgoAffinityGroup)

func (*PhysicalCell) GetAPIStatus

func (c *PhysicalCell) GetAPIStatus() *api.PhysicalCellStatus

func (*PhysicalCell) GetPhysicalPlacement

func (c *PhysicalCell) GetPhysicalPlacement() ([]string, []int32)

func (*PhysicalCell) GetPhysicalPlacementString

func (c *PhysicalCell) GetPhysicalPlacementString() string

func (*PhysicalCell) GetReservingOrReservedGroup

func (c *PhysicalCell) GetReservingOrReservedGroup() *AlgoAffinityGroup

func (*PhysicalCell) GetUsingGroup

func (c *PhysicalCell) GetUsingGroup() *AlgoAffinityGroup

func (*PhysicalCell) GetVirtualCell

func (c *PhysicalCell) GetVirtualCell() *VirtualCell

func (*PhysicalCell) IsPinned

func (c *PhysicalCell) IsPinned() bool

func (*PhysicalCell) IsSplit

func (c *PhysicalCell) IsSplit() bool

func (*PhysicalCell) SetChildren

func (c *PhysicalCell) SetChildren(children CellList)

func (*PhysicalCell) SetHealthiness

func (c *PhysicalCell) SetHealthiness(h api.CellHealthiness)

func (*PhysicalCell) SetPhysicalResources

func (c *PhysicalCell) SetPhysicalResources(nodes []string, leafCellIndices []int32)

func (*PhysicalCell) SetPinned

func (c *PhysicalCell) SetPinned(pinned bool)

func (*PhysicalCell) SetPriority

func (c *PhysicalCell) SetPriority(p CellPriority)

func (*PhysicalCell) SetSplit

func (c *PhysicalCell) SetSplit(split bool)

func (*PhysicalCell) SetState

func (c *PhysicalCell) SetState(s CellState)

func (*PhysicalCell) SetVirtualCell

func (c *PhysicalCell) SetVirtualCell(cell *VirtualCell)

type VirtualCell

type VirtualCell struct {
	GenericCell
	// contains filtered or unexported fields
}

VirtualCell defines a cell in a VC.

func NewVirtualCell

func NewVirtualCell(
	vcn api.VirtualClusterName,
	c CellChain,
	l CellLevel,
	g bool,
	n int32,
	pac *VirtualCell,
	cellType api.CellType,
	address api.CellAddress,
	isNodeLevel bool) *VirtualCell

func (*VirtualCell) GetAPIStatus

func (c *VirtualCell) GetAPIStatus() *api.VirtualCellStatus

func (*VirtualCell) GetPhysicalCell

func (c *VirtualCell) GetPhysicalCell() *PhysicalCell

func (*VirtualCell) GetPreassignedCell

func (c *VirtualCell) GetPreassignedCell() *VirtualCell

func (*VirtualCell) GetVirtualCluster

func (c *VirtualCell) GetVirtualCluster() api.VirtualClusterName

func (*VirtualCell) SetChildren

func (c *VirtualCell) SetChildren(children CellList)

func (*VirtualCell) SetPhysicalCell

func (c *VirtualCell) SetPhysicalCell(cell *PhysicalCell)

func (*VirtualCell) SetPinnedCellId

func (c *VirtualCell) SetPinnedCellId(pid api.PinnedCellId)

func (*VirtualCell) SetPreAssignedCell

func (c *VirtualCell) SetPreAssignedCell(cell *VirtualCell)

func (*VirtualCell) SetPriority

func (c *VirtualCell) SetPriority(p CellPriority)

Jump to

Keyboard shortcuts

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