auctionrunner

package
v0.0.0-...-16b1a22 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const LocalityOffset = 1000
View Source
const MinBinPackFirstFitWeight = 0.0

Variables

This section is empty.

Functions

func FetchStateAndBuildZones

func FetchStateAndBuildZones(logger lager.Logger, workPool *workpool.WorkPool, clients map[string]rep.Client, metricEmitter auctiontypes.AuctionMetricEmitterDelegate, binPackFirstFitWeight float64) map[string]Zone

func New

func New(
	logger lager.Logger,
	delegate auctiontypes.AuctionRunnerDelegate,
	metricEmitter auctiontypes.AuctionMetricEmitterDelegate,
	clock clock.Clock,
	workPool *workpool.WorkPool,
	binPackFirstFitWeight float64,
	startingContainerWeight float64,
	startingContainerCountMaximum int,
) *auctionRunner

Types

type Batch

type Batch struct {
	HasWork chan Work
	// contains filtered or unexported fields
}

func NewBatch

func NewBatch(clock clock.Clock) *Batch

func (*Batch) AddLRPStarts

func (b *Batch) AddLRPStarts(starts []auctioneer.LRPStartRequest, traceID string)

func (*Batch) AddTasks

func (b *Batch) AddTasks(tasks []auctioneer.TaskStartRequest, traceID string)

func (*Batch) DedupeAndDrain

func (b *Batch) DedupeAndDrain() ([]auctiontypes.LRPAuction, []auctiontypes.TaskAuction)

type Cell

type Cell struct {
	Guid string

	Index int
	// contains filtered or unexported fields
}

func NewCell

func NewCell(logger lager.Logger, guid string, client rep.Client, state rep.CellState) *Cell

func (*Cell) Commit

func (c *Cell) Commit() rep.Work

func (*Cell) MatchPlacementTags

func (c *Cell) MatchPlacementTags(placementTags []string) bool

func (*Cell) MatchRootFS

func (c *Cell) MatchRootFS(rootFS string) bool

func (*Cell) MatchVolumeDrivers

func (c *Cell) MatchVolumeDrivers(volumeDrivers []string) bool

func (*Cell) ReserveLRP

func (c *Cell) ReserveLRP(lrp *rep.LRP) error

func (*Cell) ReserveTask

func (c *Cell) ReserveTask(task *rep.Task) error

func (*Cell) ScoreForLRP

func (c *Cell) ScoreForLRP(lrp *rep.LRP, startingContainerWeight, binPackFirstFitWeight float64) (float64, error)

func (*Cell) ScoreForTask

func (c *Cell) ScoreForTask(task *rep.Task, startingContainerWeight float64) (float64, error)

func (*Cell) StartingContainerCount

func (c *Cell) StartingContainerCount() int

func (*Cell) State

func (c *Cell) State() rep.CellState

type CellResourceState

type CellResourceState struct {
	CellID                string `json:"cell_id"`
	RootFSProviders       rep.RootFSProviders
	AvailableResources    rep.Resources
	TotalResources        rep.Resources
	PlacementTags         []string
	OptionalPlacementTags []string
}

func NewCellResourceState

func NewCellResourceState(state rep.CellState) CellResourceState

type Scheduler

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

func NewScheduler

func NewScheduler(
	workPool *workpool.WorkPool,
	zones map[string]Zone,
	clock clock.Clock,
	logger lager.Logger,
	binPackFirstFitWeight float64,
	startingContainerWeight float64,
	startingContainerCountMaximum int,
) *Scheduler

func (*Scheduler) Schedule

func (s *Scheduler) Schedule(auctionRequest auctiontypes.AuctionRequest) auctiontypes.AuctionResults

Schedule takes in a set of job requests (LRP start auctions and task starts) and assigns the work to available cells according to the diego scoring algorithm. The scheduler is single-threaded. It determines scheduling of jobs one at a time so that each calculation reflects available resources correctly. It commits the work in batches at the end, for better network performance. Schedule returns AuctionResults, indicating the success or failure of each requested job.

type SortableLRPAuctions

type SortableLRPAuctions []auctiontypes.LRPAuction

func (SortableLRPAuctions) Len

func (a SortableLRPAuctions) Len() int

func (SortableLRPAuctions) Less

func (a SortableLRPAuctions) Less(i, j int) bool

func (SortableLRPAuctions) Swap

func (a SortableLRPAuctions) Swap(i, j int)

type SortableTaskAuctions

type SortableTaskAuctions []auctiontypes.TaskAuction

func (SortableTaskAuctions) Len

func (a SortableTaskAuctions) Len() int

func (SortableTaskAuctions) Less

func (a SortableTaskAuctions) Less(i, j int) bool

func (SortableTaskAuctions) Swap

func (a SortableTaskAuctions) Swap(i, j int)

type Work

type Work struct {
	TraceID string
}

type Zone

type Zone []*Cell

func (Zone) Len

func (z Zone) Len() int

func (Zone) Less

func (z Zone) Less(i, j int) bool

func (Zone) Swap

func (z Zone) Swap(i, j int)

Jump to

Keyboard shortcuts

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