gpuscheduler

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package gpuscheduler has the logic for the scheduler extender - including the server it starts and filter methods

Index

Constants

View Source
const (
	L1 = klog.Level(1)
	L2 = klog.Level(2)
	L3 = klog.Level(3)
	L4 = klog.Level(4)
	L5 = klog.Level(5)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache : basically all things cached, including the resulting resource usage statuses per card Nodes cache is needed for incoming scheduling request so that not all node objects need to be sent for every scheduled pod. Pods cache is needed during the scheduling request so that not all pods need to be read from all nodes for every scheduled pod. The cache could be accessed from multiple goroutines and therefore needs concurrency protection, which is achieved with a mutex.

func NewCache

func NewCache(client kubernetes.Interface) *Cache

NewCache returns a new Cache object.

type CacheAPI

type CacheAPI interface {
	NewCache(kubernetes.Interface) *Cache
	FetchNode(cache *Cache, nodeName string) (*v1.Node, error)
	GetNodeResourceStatus(cache *Cache, nodeName string) nodeResources
}

CacheAPI is the mocked interface for the Cache used by the scheduler.

type ClientAPI

type ClientAPI interface {
	InClusterConfig() (*rest.Config, error)
	NewForConfig(*rest.Config) (kubernetes.Interface, error)
	UpdatePod(kubernetes.Interface, *v1.Pod) (*v1.Pod, error)
	GetPod(clientset kubernetes.Interface, ns, name string) (*v1.Pod, error)
}

ClientAPI is the mocked interface for the part of go client API used by the scheduler.

type GASExtender

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

GASExtender is the scheduler extension part.

func NewGASExtender

func NewGASExtender(clientset kubernetes.Interface) *GASExtender

NewGASExtender returns a new GAS Extender.

func (*GASExtender) Bind

func (m *GASExtender) Bind(w http.ResponseWriter, r *http.Request)

Bind binds the pod to the node.

func (*GASExtender) Filter

func (m *GASExtender) Filter(w http.ResponseWriter, r *http.Request)

Filter manages all filter requests from the scheduler. First it decodes the request, then it calls the filter logic and writes a response to the scheduler.

func (*GASExtender) Prioritize

func (m *GASExtender) Prioritize(w http.ResponseWriter, r *http.Request)

Prioritize manages all prioritize requests from the scheduler extender. Not implemented yet by GAS, hence response with StatusNotFound.

type InternalCacheAPI

type InternalCacheAPI interface {
	WaitForCacheSync(stopCh <-chan struct{}, cacheSyncs ...cache.InformerSynced) bool
}

InternalCacheAPI has the mocked interface of Cache internals.

type MockCacheAPI

type MockCacheAPI struct {
	mock.Mock
}

MockCacheAPI is an autogenerated mock type for the CacheAPI type

func (*MockCacheAPI) FetchNode

func (_m *MockCacheAPI) FetchNode(cache *Cache, nodeName string) (*v1.Node, error)

FetchNode provides a mock function with given fields: cache, nodeName

func (*MockCacheAPI) GetNodeResourceStatus

func (_m *MockCacheAPI) GetNodeResourceStatus(cache *Cache, nodeName string) nodeResources

GetNodeResourceStatus provides a mock function with given fields: cache, nodeName

func (*MockCacheAPI) NewCache

func (_m *MockCacheAPI) NewCache(_a0 kubernetes.Interface) *Cache

NewCache provides a mock function with given fields: _a0

type MockClientAPI

type MockClientAPI struct {
	mock.Mock
}

MockClientAPI is an autogenerated mock type for the ClientAPI type

func (*MockClientAPI) GetPod

func (_m *MockClientAPI) GetPod(clientset kubernetes.Interface, ns string, name string) (*v1.Pod, error)

GetPod provides a mock function with given fields: clientset, ns, name

func (*MockClientAPI) InClusterConfig

func (_m *MockClientAPI) InClusterConfig() (*rest.Config, error)

InClusterConfig provides a mock function with given fields:

func (*MockClientAPI) NewForConfig

func (_m *MockClientAPI) NewForConfig(_a0 *rest.Config) (kubernetes.Interface, error)

NewForConfig provides a mock function with given fields: _a0

func (*MockClientAPI) UpdatePod

func (_m *MockClientAPI) UpdatePod(_a0 kubernetes.Interface, _a1 *v1.Pod) (*v1.Pod, error)

UpdatePod provides a mock function with given fields: _a0, _a1

type MockInternalCacheAPI

type MockInternalCacheAPI struct {
	mock.Mock
}

MockInternalCacheAPI is an autogenerated mock type for the InternalCacheAPI type

func (*MockInternalCacheAPI) WaitForCacheSync

func (_m *MockInternalCacheAPI) WaitForCacheSync(stopCh <-chan struct{}, cacheSyncs ...cache.InformerSynced) bool

WaitForCacheSync provides a mock function with given fields: stopCh, cacheSyncs

Jump to

Keyboard shortcuts

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