fairshare

package
v1.8.8 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MPL-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNumWorkers

func GetNumWorkers(j *JobManager) int

Types

type Job

type Job interface {
	// Execute performs the work.
	// It should be synchronous if a cleanupFn is provided.
	Execute() error

	// OnFailure handles the error resulting from a failed Execute().
	// It should be synchronous if a cleanupFn is provided.
	OnFailure(err error)
}

Job is an interface for jobs used with this job manager

type JobManager

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

func NewJobManager

func NewJobManager(name string, numWorkers int, l log.Logger, metricSink *metricsutil.ClusterMetricSink) *JobManager

NewJobManager creates a job manager, with an optional name

func (*JobManager) AddJob

func (j *JobManager) AddJob(job Job, queueID string)

AddJob adds a job to the given queue, creating the queue if it doesn't exist

func (*JobManager) GetPendingJobCount

func (j *JobManager) GetPendingJobCount() int

GetCurrentJobCount returns the total number of pending jobs in the job manager

func (*JobManager) GetWorkQueueLengths

func (j *JobManager) GetWorkQueueLengths() map[string]int

GetWorkQueueLengths() returns a map of queue ID to number of jobs in the queue

func (*JobManager) GetWorkerCounts

func (j *JobManager) GetWorkerCounts() map[string]int

GetWorkerCounts() returns a map of queue ID to number of active workers

func (*JobManager) Start

func (j *JobManager) Start()

Start starts the job manager note: a given job manager cannot be restarted after it has been stopped

func (*JobManager) Stop

func (j *JobManager) Stop()

Stop stops the job manager asynchronously

Jump to

Keyboard shortcuts

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