jobcoordinator

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code int

Code is the status code/type which is returned from plugins.

const (
	// Success means that plugin ran correctly and found job schedulable.
	// NOTE: A nil status is also considered as "Success".
	Success Code = iota
	// Error is used for internal plugin errors, unexpected input, etc.
	Error
	// Unschedulable is used when a plugin finds a job unschedulable.
	// The accompanying status message should explain why the pod is unschedulable.
	Unschedulable
	// Wait is used when a Permit plugin finds a pod scheduling should wait.
	Wait
	// Skip is used when a Bind plugin chooses to skip binding.
	Skip
)

These are predefined codes used in a status.

type CoordinatorConfiguration

type CoordinatorConfiguration struct {
	SchedulePeriod    time.Duration
	TenantPlugin      string
	PreFilterPlugins  []string
	FilterPlugins     []string
	ScorePlugins      []string
	PreDequeuePlugins []string
}

type FilterPlugin

type FilterPlugin interface {
	Filter(ctx context.Context, qu *QueueUnit) Status
	Plugin
}

type Plugin

type Plugin interface {
	Name() string
}

type PluginFactory

type PluginFactory func(client client.Client, recorder record.EventRecorder) Plugin

type PreDequeuePlugin

type PreDequeuePlugin interface {
	PreDequeue(ctx context.Context, qu *QueueUnit) Status
	Plugin
}

type PreFilterPlugin

type PreFilterPlugin interface {
	PreFilter(ctx context.Context, qu *QueueUnit) Status
	Plugin
}

type QueueUnit

type QueueUnit struct {
	Tenant        string
	Priority      *int32
	Object        client.Object
	SchedPolicy   *v1.SchedulingPolicy
	Specs         map[v1.ReplicaType]*v1.ReplicaSpec
	Status        *v1.JobStatus
	Resources     corev1.ResourceList
	SpotResources corev1.ResourceList
	Owner         workqueue.RateLimitingInterface
}

func (*QueueUnit) Key

func (qu *QueueUnit) Key() string

func (*QueueUnit) SpotQueueUnit

func (qu *QueueUnit) SpotQueueUnit() *QueueUnit

SpotQueueUnit returns a wrapped queue unit which takes spot resource as its total resource requests and shallow copy other fields as its properties.

type QueueUnitScore

type QueueUnitScore struct {
	QueueUnit *QueueUnit
	Score     int64
}

type ScorePlugin

type ScorePlugin interface {
	Score(ctx context.Context, qu *QueueUnit) (int64, Status)
	Plugin
}

type Status

type Status interface {
	// Code returns code of the status.
	Code() Code
	// Message returns a concatenated message on reasons of the status.
	Message() string
	// Reasons returns reasons of the status.
	Reasons() []string
	// AppendReason appends given reason to the status.
	AppendReason(reason string)
	// IsSuccess returns true if and only if "status" is nil or Code is "Success".
	IsSuccess() bool
	// IsUnschedulable returns true if "status" is Unschedulable (Unschedulable or UnschedulableAndUnresolvable).
	IsUnschedulable() bool
	// AsError returns nil if the status is a success; otherwise returns an "error" object
	// with a concatenated message on reasons of the status.
	AsError() error
}

func NewStatus

func NewStatus(code Code, reasons ...string) Status

NewStatus makes a status out of the given arguments and returns its pointer.

type TenantPlugin

type TenantPlugin interface {
	TenantName(qu *QueueUnit) string
	Plugin
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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