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
Click to show internal directories.
Click to hide internal directories.