cache

package
v0.0.0-...-f2569be Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 10 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) GetUsedGpuMilli

func (d *DeviceInfo) GetUsedGpuMilli() (gpuMilli int64)

type DeviceInfoBrief

type DeviceInfoBrief struct {
	Idx          int
	Model        string
	PodList      []string
	GpuUsedMilli int64
}

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) 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) ExportGpuNodeInfoAsStr

func (n *GpuNodeInfo) ExportGpuNodeInfoAsStr() *GpuNodeInfoStr

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) Reset

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

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

type GpuNodeInfoStr

type GpuNodeInfoStr struct {
	DevsBrief    map[int]*DeviceInfoBrief
	GpuCount     int
	GpuModel     string
	GpuUsedMilli int64
	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, nodeName string) error

func (*SchedulerCache) BuildCacheFromPodList

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

func (*SchedulerCache) ExportGpuNodeInfoAsStr

func (cache *SchedulerCache) ExportGpuNodeInfoAsStr(nodeName string) (*GpuNodeInfoStr, 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, nodeName string)

The lock is in cacheNode

Jump to

Keyboard shortcuts

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