manager

package
v0.0.0-...-5b6649e Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const HeartbeatFrequencySeconds = 5

HeartbeatFrequencySeconds dictates the frequency of expected heartbeats from executors

View Source
const MaxMissedHeartbeats = 3

MaxMissedHeartbeats dictates the maximum number of heartbeats missed before we declare the executor dead

Variables

This section is empty.

Functions

func AddExecutor

func AddExecutor(id string, workerCount int)

AddExecutor adds an Executor to the list of Executors to track.

func RecordHeartbeat

func RecordHeartbeat(id string)

RecordHeartbeat records a heartbeat for an executor by its id.

func Schedule

func Schedule(ctx context.Context,
	calc LoadCalculator,
	source types.RequestSource)

Types

type Executor

type Executor struct {
	Id            string
	HeartbeatTime time.Time
	Workers       int
	WorkChan      chan []types.Job
}

Executor represents a running client process that hosts worker threads. Each Executor can support up to #Workers simultaneously running Jobs.

func EligibleExecutors

func EligibleExecutors() []*Executor

EligibleExecutors returns an array of Executors that are currently alive and ready to receive work

func GetExecutor

func GetExecutor(id string) *Executor

GetExecutor returns an Executor by its id, if it exists. nil is returned otherwise.

type ExponentialFunctionLoadCalculator

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

func (*ExponentialFunctionLoadCalculator) Next

type LoadCalculator

type LoadCalculator interface {
	Next() int
}

func NewExponentialLoadCalculator

func NewExponentialLoadCalculator(minRps int, maxRps int) LoadCalculator

func NewLogarithmicLoadCalculator

func NewLogarithmicLoadCalculator(minRps int, maxRps int) LoadCalculator

func NewStepFunctionLoadCalculator

func NewStepFunctionLoadCalculator(minRps int, maxRps int, stepSize int) LoadCalculator

type StepFunctionLoadCalculator

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

func (*StepFunctionLoadCalculator) Next

func (s *StepFunctionLoadCalculator) Next() int

Jump to

Keyboard shortcuts

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