scheduler

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterConfigType

func RegisterConfigType(configType string, constructor ConfigConstructor)

RegisterConfigType adds the supplied ConfigConstructor as the constructor for its type in the configConstructors map, in a thread-safe manner

Types

type BaseConfig

type BaseConfig struct {
	Name             string             `json:"-"` // set via the JS object key
	Type             string             `json:"type"`
	StartTime        types.NullDuration `json:"startTime"`
	Interruptible    null.Bool          `json:"interruptible"`
	IterationTimeout types.NullDuration `json:"iterationTimeout"`
	Env              map[string]string  `json:"env"`
	Exec             null.String        `json:"exec"` // function name, externally validated
	Percentage       float64            `json:"-"`    // 100, unless Split() was called

}

BaseConfig contains the common config fields for all schedulers

func NewBaseConfig

func NewBaseConfig(name, configType string, interruptible bool) BaseConfig

NewBaseConfig returns a default base config with the default values

func (BaseConfig) CopyWithPercentage

func (bc BaseConfig) CopyWithPercentage(percentage float64) *BaseConfig

CopyWithPercentage is a helper function that just sets the percentage to the specified amount.

func (BaseConfig) GetBaseConfig

func (bc BaseConfig) GetBaseConfig() BaseConfig

GetBaseConfig just returns itself

func (BaseConfig) Validate

func (bc BaseConfig) Validate() (errors []error)

Validate checks some basic things like present name, type, and a positive start time

type Config

type Config interface {
	GetBaseConfig() BaseConfig
	Validate() []error
	GetMaxVUs() int64
	GetMaxDuration() time.Duration // includes max timeouts, to allow us to share VUs between schedulers in the future

}

Config is an interface that should be implemented by all scheduler config types

func GetParsedConfig

func GetParsedConfig(name, configType string, rawJSON []byte) (result Config, err error)

GetParsedConfig returns a struct instance corresponding to the supplied config type. It will be fully initialized - with both the default values of the type, as well as with whatever the user had specified in the JSON

type ConfigConstructor

type ConfigConstructor func(name string, rawJSON []byte) (Config, error)

ConfigConstructor is a simple function that returns a concrete Config instance with the specified name and all default values correctly initialized

type ConfigMap

type ConfigMap map[string]Config

ConfigMap can contain mixed scheduler config types

func (*ConfigMap) UnmarshalJSON

func (scs *ConfigMap) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface in a two-step manner, creating the correct type of configs based on the `type` property.

func (ConfigMap) Validate

func (scs ConfigMap) Validate() (errors []error)

Validate checks if all of the specified scheduler options make sense

type ConstantArrivalRateConfig

type ConstantArrivalRateConfig struct {
	BaseConfig
	Rate     null.Int           `json:"rate"`
	TimeUnit types.NullDuration `json:"timeUnit"`
	Duration types.NullDuration `json:"duration"`

	// Initialize `PreAllocatedVUs` number of VUs, and if more than that are needed,
	// they will be dynamically allocated, until `MaxVUs` is reached, which is an
	// absolutely hard limit on the number of VUs the scheduler will use
	PreAllocatedVUs null.Int `json:"preAllocatedVUs"`
	MaxVUs          null.Int `json:"maxVUs"`
}

ConstantArrivalRateConfig stores config for the constant arrival-rate scheduler

func NewConstantArrivalRateConfig

func NewConstantArrivalRateConfig(name string) ConstantArrivalRateConfig

NewConstantArrivalRateConfig returns a ConstantArrivalRateConfig with default values

func (ConstantArrivalRateConfig) GetMaxDuration

func (carc ConstantArrivalRateConfig) GetMaxDuration() time.Duration

GetMaxDuration returns the maximum duration time for this scheduler, including the specified iterationTimeout, if the iterations are uninterruptible

func (ConstantArrivalRateConfig) GetMaxVUs

func (carc ConstantArrivalRateConfig) GetMaxVUs() int64

GetMaxVUs returns the absolute maximum number of possible concurrently running VUs

func (ConstantArrivalRateConfig) Validate

func (carc ConstantArrivalRateConfig) Validate() []error

Validate makes sure all options are configured and valid

type ConstantLoopingVUsConfig

type ConstantLoopingVUsConfig struct {
	BaseConfig
	VUs      null.Int           `json:"vus"`
	Duration types.NullDuration `json:"duration"`
}

ConstantLoopingVUsConfig stores VUs and duration

func NewConstantLoopingVUsConfig

func NewConstantLoopingVUsConfig(name string) ConstantLoopingVUsConfig

NewConstantLoopingVUsConfig returns a ConstantLoopingVUsConfig with default values

func (ConstantLoopingVUsConfig) GetMaxDuration

func (lcv ConstantLoopingVUsConfig) GetMaxDuration() time.Duration

GetMaxDuration returns the maximum duration time for this scheduler, including the specified iterationTimeout, if the iterations are uninterruptible

func (ConstantLoopingVUsConfig) GetMaxVUs

func (lcv ConstantLoopingVUsConfig) GetMaxVUs() int64

GetMaxVUs returns the absolute maximum number of possible concurrently running VUs

func (ConstantLoopingVUsConfig) Split

func (lcv ConstantLoopingVUsConfig) Split(percentages []float64) ([]Config, error)

Split divides the VUS as best it can, but keeps the same duration

func (ConstantLoopingVUsConfig) Validate

func (lcv ConstantLoopingVUsConfig) Validate() []error

Validate makes sure all options are configured and valid

type PerVUIteationsConfig

type PerVUIteationsConfig struct {
	BaseConfig
	VUs         null.Int           `json:"vus"`
	Iterations  null.Int           `json:"iterations"`
	MaxDuration types.NullDuration `json:"maxDuration"`
}

PerVUIteationsConfig stores the number of VUs iterations, as well as maxDuration settings

func NewPerVUIterationsConfig

func NewPerVUIterationsConfig(name string) PerVUIteationsConfig

NewPerVUIterationsConfig returns a PerVUIteationsConfig with default values

func (PerVUIteationsConfig) GetMaxDuration

func (pvic PerVUIteationsConfig) GetMaxDuration() time.Duration

GetMaxDuration returns the maximum duration time for this scheduler, including the specified iterationTimeout, if the iterations are uninterruptible

func (PerVUIteationsConfig) GetMaxVUs

func (pvic PerVUIteationsConfig) GetMaxVUs() int64

GetMaxVUs returns the absolute maximum number of possible concurrently running VUs

func (PerVUIteationsConfig) Validate

func (pvic PerVUIteationsConfig) Validate() []error

Validate makes sure all options are configured and valid

type SharedIteationsConfig

type SharedIteationsConfig struct {
	BaseConfig
	VUs         null.Int           `json:"vus"`
	Iterations  null.Int           `json:"iterations"`
	MaxDuration types.NullDuration `json:"maxDuration"`
}

SharedIteationsConfig stores the number of VUs iterations, as well as maxDuration settings

func NewSharedIterationsConfig

func NewSharedIterationsConfig(name string) SharedIteationsConfig

NewSharedIterationsConfig returns a SharedIteationsConfig with default values

func (SharedIteationsConfig) GetMaxDuration

func (sic SharedIteationsConfig) GetMaxDuration() time.Duration

GetMaxDuration returns the maximum duration time for this scheduler, including the specified iterationTimeout, if the iterations are uninterruptible

func (SharedIteationsConfig) GetMaxVUs

func (sic SharedIteationsConfig) GetMaxVUs() int64

GetMaxVUs returns the absolute maximum number of possible concurrently running VUs

func (SharedIteationsConfig) Validate

func (sic SharedIteationsConfig) Validate() []error

Validate makes sure all options are configured and valid

type Stage

type Stage struct {
	Duration types.NullDuration `json:"duration"`
	Target   null.Int           `json:"target"` // TODO: maybe rename this to endVUs? something else?
}

Stage contains

type VariableArrivalRateConfig

type VariableArrivalRateConfig struct {
	BaseConfig
	StartRate null.Int           `json:"startRate"`
	TimeUnit  types.NullDuration `json:"timeUnit"`
	Stages    []Stage            `json:"stages"`

	// Initialize `PreAllocatedVUs` number of VUs, and if more than that are needed,
	// they will be dynamically allocated, until `MaxVUs` is reached, which is an
	// absolutely hard limit on the number of VUs the scheduler will use
	PreAllocatedVUs null.Int `json:"preAllocatedVUs"`
	MaxVUs          null.Int `json:"maxVUs"`
}

VariableArrivalRateConfig stores config for the variable arrival-rate scheduler

func NewVariableArrivalRateConfig

func NewVariableArrivalRateConfig(name string) VariableArrivalRateConfig

NewVariableArrivalRateConfig returns a VariableArrivalRateConfig with default values

func (VariableArrivalRateConfig) GetMaxDuration

func (varc VariableArrivalRateConfig) GetMaxDuration() time.Duration

GetMaxDuration returns the maximum duration time for this scheduler, including the specified iterationTimeout, if the iterations are uninterruptible

func (VariableArrivalRateConfig) GetMaxVUs

func (varc VariableArrivalRateConfig) GetMaxVUs() int64

GetMaxVUs returns the absolute maximum number of possible concurrently running VUs

func (VariableArrivalRateConfig) Validate

func (varc VariableArrivalRateConfig) Validate() []error

Validate makes sure all options are configured and valid

type VariableLoopingVUsConfig

type VariableLoopingVUsConfig struct {
	BaseConfig
	StartVUs null.Int `json:"startVUs"`
	Stages   []Stage  `json:"stages"`
}

VariableLoopingVUsConfig stores the configuration for the stages scheduler

func NewVariableLoopingVUsConfig

func NewVariableLoopingVUsConfig(name string) VariableLoopingVUsConfig

NewVariableLoopingVUsConfig returns a VariableLoopingVUsConfig with its default values

func (VariableLoopingVUsConfig) GetMaxDuration

func (vlvc VariableLoopingVUsConfig) GetMaxDuration() time.Duration

GetMaxDuration returns the maximum duration time for this scheduler, including the specified iterationTimeout, if the iterations are uninterruptible

func (VariableLoopingVUsConfig) GetMaxVUs

func (vlvc VariableLoopingVUsConfig) GetMaxVUs() int64

GetMaxVUs returns the absolute maximum number of possible concurrently running VUs

func (VariableLoopingVUsConfig) Validate

func (vlvc VariableLoopingVUsConfig) Validate() []error

Validate makes sure all options are configured and valid

Jump to

Keyboard shortcuts

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