runner

package
v0.0.0-...-1d9613f Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

README

Testing the number of runner check workers

This package includes a comprehensive test for comparing the efficiency of running checks with differing numbers of check workers.

To run this test, use the following command:
go test {path_to_runner_package} -run TestNumWorkersEfficiency -v -args -efficiency [optional args]

The test is configured by run-time flags. The available flags are described below.

Flag Description
-static Run the check with the default number of workers (vs a dynamic number)
-lazy Run the check using a lazy wait (vs a busy wait)
-python Use a python check (vs a golang check)
-memory Run the memory tests: involves running 5 sets of checks and displaying the memory stats after each
-granularity={} (For memory test) How many checks to run in each set - default 100
-wait={} How long each test check will take to complete (ms) - default 100

Note: there's a bug in the python checks test causing the tests to crash occasionally

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TestWg is used for testing the number of check workers
	TestWg sync.WaitGroup
)

Functions

func GetCheckStats

func GetCheckStats() map[check.ID]*check.Stats

GetCheckStats returns the check stats map

func RemoveCheckStats

func RemoveCheckStats(checkID check.ID)

RemoveCheckStats removes a check from the check stats map

Types

type Runner

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

Runner ...

func NewRunner

func NewRunner() *Runner

NewRunner takes the number of desired goroutines processing incoming checks.

func (*Runner) AddWorker

func (r *Runner) AddWorker()

AddWorker adds a new worker to the worker pull

func (*Runner) GetChan

func (r *Runner) GetChan() chan<- check.Check

GetChan returns a write-only version of the pending channel

func (*Runner) Stop

func (r *Runner) Stop()

Stop closes the pending channel so all workers will exit their loop and terminate All publishers to the pending channel need to have stopped before Stop is called

func (*Runner) StopCheck

func (r *Runner) StopCheck(id check.ID) error

StopCheck invokes the `Stop` method on a check if it's running. If the check is not running, this is a noop

func (*Runner) UpdateNumWorkers

func (r *Runner) UpdateNumWorkers(numChecks int64)

UpdateNumWorkers checks if the current number of workers is reasonable, and adds more if needed

Jump to

Keyboard shortcuts

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