cache

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptimisticLockErrorMsg = "the object has been modified; please apply your changes to the latest version and try again"
)

Variables

View Source
var (
	ConfigMapLister         corelisters.ConfigMapLister
	ConfigMapInformerSynced clientgocache.InformerSynced
)

Functions

This section is empty.

Types

type DeviceInfo

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

func (*DeviceInfo) ExportDeviceInfoBrief

func (d *DeviceInfo) ExportDeviceInfoBrief() *DeviceInfoBrief

func (*DeviceInfo) GetPods

func (d *DeviceInfo) GetPods() []*v1.Pod

func (*DeviceInfo) GetTotalGpuMemory

func (d *DeviceInfo) GetTotalGpuMemory() int64

func (*DeviceInfo) GetUsedGpuMemory

func (d *DeviceInfo) GetUsedGpuMemory() (gpuMem int64)

type DeviceInfoBrief

type DeviceInfoBrief struct {
	PodList        []string
	GpuTotalMemory resource.Quantity
	GpuUsedMemory  resource.Quantity
	// contains filtered or unexported fields
}

type GpuNodeInfo

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

GpuNodeInfo is node level aggregated information.

func NewGpuNodeInfo

func NewGpuNodeInfo(node *v1.Node) *GpuNodeInfo

NewGpuNodeInfo creates Node Level

func (*GpuNodeInfo) Allocate

func (n *GpuNodeInfo) Allocate(clientset *kubernetes.Clientset, pod *v1.Pod) (err error)

func (*GpuNodeInfo) AllocateGpuId

func (n *GpuNodeInfo) AllocateGpuId(pod *v1.Pod) (candDevId string, found bool)

AllocateGpuId is the key of GPU allocating; it assigns the GPU ID to the pod

func (*GpuNodeInfo) Assume

func (n *GpuNodeInfo) Assume(pod *v1.Pod) (allocatable bool)

Assume checks if the pod can be allocated on the node

func (*GpuNodeInfo) ExportGpuNodeInfoAsNodeGpuInfo

func (n *GpuNodeInfo) ExportGpuNodeInfoAsNodeGpuInfo() *NodeGpuInfo

func (*GpuNodeInfo) GetDevByDevId

func (n *GpuNodeInfo) GetDevByDevId(devId int) (*DeviceInfo, bool)

func (*GpuNodeInfo) GetDevs

func (n *GpuNodeInfo) GetDevs() []*DeviceInfo

func (*GpuNodeInfo) GetGpuCount

func (n *GpuNodeInfo) GetGpuCount() int

func (*GpuNodeInfo) GetName

func (n *GpuNodeInfo) GetName() string

func (*GpuNodeInfo) GetNode

func (n *GpuNodeInfo) GetNode() *v1.Node

func (*GpuNodeInfo) GetTotalGpuMemory

func (n *GpuNodeInfo) GetTotalGpuMemory() int64

func (*GpuNodeInfo) Reset

func (n *GpuNodeInfo) Reset(node *v1.Node)

Reset only updates the devices when the length of devs is 0

type NodeGpuInfo

type NodeGpuInfo struct {
	DevsBrief      map[int]*DeviceInfoBrief
	GpuCount       int
	GpuAllocatable int
	GpuModel       string
	GpuTotalMemory resource.Quantity
	NumPods        int
}

type NodePodGetter

type NodePodGetter interface {
	NodeGet(name string) (*v1.Node, error)
	PodGet(name string, namespace string) (*v1.Pod, error)
}

type SchedulerCache

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

func NewSchedulerCache

func NewSchedulerCache(getter NodePodGetter) *SchedulerCache

func (*SchedulerCache) AddOrUpdatePod

func (cache *SchedulerCache) AddOrUpdatePod(pod *v1.Pod) error

func (*SchedulerCache) BuildCacheFromPodList

func (cache *SchedulerCache) BuildCacheFromPodList(podList []*v1.Pod) error

func (*SchedulerCache) ExportGpuNodeInfoAsNodeGpuInfo

func (cache *SchedulerCache) ExportGpuNodeInfoAsNodeGpuInfo(nodeName string) (*NodeGpuInfo, error)

func (*SchedulerCache) GetGpuNodeInfo

func (cache *SchedulerCache) GetGpuNodeInfo(name string) (*GpuNodeInfo, error)

Get or build nodeInfo if it doesn't exist

func (*SchedulerCache) GetGpuNodeinfos

func (cache *SchedulerCache) GetGpuNodeinfos() []*GpuNodeInfo

func (*SchedulerCache) GetPod

func (cache *SchedulerCache) GetPod(name, namespace string) (*v1.Pod, error)

func (*SchedulerCache) KnownPod

func (cache *SchedulerCache) KnownPod(podUID types.UID) bool

KnownPod Get known pod from the pod UID

func (*SchedulerCache) RemovePod

func (cache *SchedulerCache) RemovePod(pod *v1.Pod)

The lock is in cacheNode

Jump to

Keyboard shortcuts

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