fairshare

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: MPL-2.0 Imports: 8 Imported by: 0

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 {
	GetID() string
	Execute() error
	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) *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 active workers

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, and waits for the worker pool and job manager to quit gracefully

Jump to

Keyboard shortcuts

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