queuejobresources

package
v0.0.0-...-50759bc Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterPods

func FilterPods(pods []*v1.Pod, phase v1.PodPhase) int

filterPods returns pods based on their phase.

func GetPodResources

func GetPodResources(template *v1.PodTemplateSpec) *clusterstateapi.Resource

func GetPodResourcesByPhase

func GetPodResourcesByPhase(phase v1.PodPhase, pods []*v1.Pod) *clusterstateapi.Resource

filterPods returns pods based on their phase.

Types

type Factory

type Factory func(config *rest.Config) Interface

Factory is a function that returns an Interface for queue job resources.

type Interface

type Interface interface {
	SyncQueueJob(queuejob *qjobv1.AppWrapper, qjobRes *qjobv1.AppWrapperResource) error
	UpdateQueueJobStatus(queuejob *qjobv1.AppWrapper) error
	GetAggregatedResources(queuejob *qjobv1.AppWrapper) *clusterstateapi.Resource
	GetAggregatedResourcesByPriority(priority float64, queuejob *qjobv1.AppWrapper) *clusterstateapi.Resource
	//TODO: Add to calculate more accurate partial deployments while job is being realized
	//	GetAggregatedResourcesByPhase(phase v1.PodPhase, queuejob *qjobv1.AppWrapper) *clusterstateapi.Resource
	Cleanup(queuejob *qjobv1.AppWrapper, qjobRes *qjobv1.AppWrapperResource) error
	Run(stopCh <-chan struct{})
}

Interface is an abstract interface for queue job resource management.

type RefByLabel

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

RefByLabel : A reference manager by resource vector index

func (*RefByLabel) AddReference

func (rm *RefByLabel) AddReference(owner *qjobv1.AppWrapperResource, ownee runtime.Object) error

AddReference : add ref

func (*RefByLabel) AddTag

func (rm *RefByLabel) AddTag(owner *qjobv1.AppWrapperResource, getTag func() string) error

AddTag : add tag

func (*RefByLabel) BelongTo

func (rm *RefByLabel) BelongTo(owner *qjobv1.AppWrapperResource, ownee runtime.Object) bool

BelongTo : belong to QJ

type RefManager

type RefManager interface {

	//Tag the owner
	AddTag(owner *qjobv1.AppWrapperResource, getTag func() string) error

	//check whether ownee is a member of owner
	BelongTo(owner *qjobv1.AppWrapperResource, ownee runtime.Object) bool

	//mark the ownee to be a member of owner
	AddReference(owner *qjobv1.AppWrapperResource, ownee runtime.Object) error
}

RefManager : Define reference manager commont interface

func NewLabelRefManager

func NewLabelRefManager() RefManager

NewLabelRefManager : new ref manager

type RegisteredResources

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

RegisteredResources : registered resources

func (*RegisteredResources) InitQueueJobResource

func (rres *RegisteredResources) InitQueueJobResource(t qjobv1.ResourceType,
	config *rest.Config) (Interface, bool, error)

InitQueueJobResource creates an instance of the type queue job resource. It returns `false` if the type is not known.

func (*RegisteredResources) Register

func (rres *RegisteredResources) Register(t qjobv1.ResourceType, factory Factory)

Register registers a Factory by type. This is expected to happen during app startup.

func (*RegisteredResources) Registered

func (rres *RegisteredResources) Registered() []qjobv1.ResourceType

Registered enumerates the names of all registered plugins.

Jump to

Keyboard shortcuts

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