Back to godoc.org

Package preemption

v0.0.0 (a69e935)
Latest Go to latest
Published: Oct 1, 2019 | License: Apache-2.0 | Module: github.com/uber/peloton

Index

Package Files

type Metrics

type Metrics struct {
	RevocableRunningTasksToPreempt    tally.Counter
	RevocableNonRunningTasksToPreempt tally.Counter

	NonRevocableRunningTasksToPreempt    tally.Counter
	NonRevocableNonRunningTasksToPreempt tally.Counter

	PreemptionQueueSize tally.Gauge
	TasksToEvict        tally.Gauge

	TasksFailedPreemption tally.Counter

	NonSlackTotalResourcesToFree          scalar.CounterMaps
	NonSlackNonRunningTasksResourcesFreed scalar.CounterMaps
	NonSlackRunningTasksResourcesToFreed  scalar.CounterMaps

	SlackTotalResourcesToFree          scalar.CounterMaps
	SlackNonRunningTasksResourcesFreed scalar.CounterMaps
	SlackRunningTasksResourcesToFreed  scalar.CounterMaps

	OverAllocationCount tally.Gauge
}

Metrics is a placeholder for all metrics in preemption

func NewMetrics

func NewMetrics(scope tally.Scope) *Metrics

NewMetrics returns a new instance of preemption.Metrics

type Preemptor

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

Preemptor preempts tasks based on either resource pool allocation or external sources eg host maintenance.

func NewPreemptor

func NewPreemptor(
	parent tally.Scope,
	cfg *common.PreemptionConfig,
	tracker task.Tracker,
	resTree respool.Tree,
) *Preemptor

NewPreemptor creates a new preemptor and returns it

func (*Preemptor) DequeueTask

func (p *Preemptor) DequeueTask(maxWaitTime time.Duration) (
	*resmgr.PreemptionCandidate, error)

DequeueTask dequeues a running task from the preemption queue

func (*Preemptor) EnqueueTasks

func (p *Preemptor) EnqueueTasks(
	tasks []*task.RMTask,
	reason resmgr.PreemptionReason,
) error

EnqueueTasks enqueues tasks to be preempted

func (*Preemptor) Start

func (p *Preemptor) Start() error

Start starts Task Preemptor process

func (*Preemptor) Stop

func (p *Preemptor) Stop() error

Stop stops Task Preemptor process

type Queue

type Queue interface {
	// DequeueTask dequeues the RUNNING tasks from the preemption queue.
	// These tasks are then picked up by the jobmanager to be preempted.
	DequeueTask(maxWaitTime time.Duration) (*resmgr.PreemptionCandidate, error)
	// EnqueueTasks enqueues tasks either into the preemption queue for
	// RUNNING tasks or to the pending queue for NON_RUNNING tasks.
	// This API can be used by a caller when making a the decision to
	// preempt certain tasks outside of the preemptor.
	// This can include cases where a host is being taken down for maintenance.
	EnqueueTasks(tasks []*task.RMTask, event resmgr.PreemptionReason) error
}

Queue exposes APIs to interact with the preemption queue.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier