scheduler

package
v0.6.13 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SchedHandler

func SchedHandler(scheduler Type) interface{}

SchedHandler get scheduler instance of type Todo change to logic allowing for external schedulers

Types

type IScheduler

type IScheduler interface {
	Validate() error
	Execute(
		context.Context,
		*logger.Log,
		time.Duration,
		[]scenario.Action,
		string,
		users.UserGenerator,
		*connection.ConnectionSettings,
		*statistics.ExecutionCounters,
	) error
	RequireScenario() bool
}

IScheduler interface of scheduler

func UnmarshalScheduler

func UnmarshalScheduler(raw []byte) (IScheduler, error)

UnmarshalScheduler unmarshal IScheduler

type Scheduler

type Scheduler struct {
	// SchedType type of scheduler
	SchedType Type `json:"type" doc-key:"config.scheduler.type"`
	// TimeBuf add wait time in between iterations
	TimeBuf TimeBuffer `json:"iterationtimebuffer" doc-key:"config.scheduler.iterationtimebuffer"`
	// InstanceNumber used to ensure different randomizations when running script in multiple different instances
	InstanceNumber uint64 `json:"instance" doc-key:"config.scheduler.instance"`
	// ReconnectSettings settings for re-connecting websocket on unexpected disconnect
	ReconnectSettings session.ReconnectSettings `json:"reconnectsettings" doc-key:"config.scheduler.reconnectsettings"`
	// contains filtered or unexported fields
}

Scheduler common core of schedulers

func (*Scheduler) SetContinueOnErrors added in v0.6.5

func (sched *Scheduler) SetContinueOnErrors(enabled bool) error

SetContinueOnErrors toggles whether to continue on action errors

func (*Scheduler) Validate

func (sched *Scheduler) Validate() error

Validate Scheduler settings

type SimpleSchedSettings

type SimpleSchedSettings struct {
	ExecutionTime    int     `json:"executionTime" displayname:"Execution time" doc-key:"config.scheduler.settings.executiontime"` // in seconds
	Iterations       int     `json:"iterations" displayname:"Iterations" doc-key:"config.scheduler.settings.iterations"`
	RampupDelay      float64 `json:"rampupDelay" displayname:"Rampup delay" doc-key:"config.scheduler.settings.rampupdelay"` // in seconds
	ConcurrentUsers  int     ``                                                                                              /* 132-byte string literal not displayed */
	ReuseUsers       bool    `json:"reuseUsers" displayname:"Reuse users" doc-key:"config.scheduler.settings.reuseusers"`
	OnlyInstanceSeed bool    `json:"onlyinstanceseed" displayname:"Only use instance seed" doc-key:"config.scheduler.settings.onlyinstanceseed"`
}

SimpleSchedSettings simple scheduler settings

type SimpleScheduler

type SimpleScheduler struct {
	Scheduler
	Settings SimpleSchedSettings `json:"settings" doc-key:"config.scheduler.settings"`
}

SimpleScheduler simple scheduler

func (SimpleScheduler) Execute

func (sched SimpleScheduler) Execute(ctx context.Context, log *logger.Log, timeout time.Duration, scenario []scenario.Action, outputsDir string,
	users users.UserGenerator, connectionSettings *connection.ConnectionSettings, counters *statistics.ExecutionCounters) (err error)

Execute execute schedule

func (*SimpleScheduler) RequireScenario

func (sched *SimpleScheduler) RequireScenario() bool

RequireScenario report that scheduler requires a scenario

func (SimpleScheduler) Validate

func (sched SimpleScheduler) Validate() error

Validate schedule

type TimeBufMode

type TimeBufMode int

TimeBufMode type of time buffer

const (
	// TimeBufNoWait no time buffer
	TimeBufNoWait TimeBufMode = iota
	// TimeBufConstant constant time buffer
	TimeBufConstant
	// TimeBufOnError time buffer on error
	TimeBufOnError
	// TimeBufMinDur buffer time until minimum duration
	TimeBufMinDur
)

func (TimeBufMode) GetEnumMap

func (mode TimeBufMode) GetEnumMap() *enummap.EnumMap

func (TimeBufMode) MarshalJSON

func (mode TimeBufMode) MarshalJSON() ([]byte, error)

MarshalJSON marshal time buffer mode to JSON

func (*TimeBufMode) UnmarshalJSON

func (mode *TimeBufMode) UnmarshalJSON(arg []byte) error

UnmarshalJSON unmarshal time buffer mode from JSON

type TimeBuffer

type TimeBuffer struct {
	Mode     TimeBufMode          `json:"mode,omitempty" displayname:"Time buffer mode" doc-key:"config.scheduler.iterationtimebuffer.mode"`
	Duration helpers.TimeDuration `json:"duration,omitempty" displayname:"Time buffer duration" doc-key:"config.scheduler.iterationtimebuffer.duration"`
	// contains filtered or unexported fields
}

TimeBuffer time buffer at end of a user iteration

func (*TimeBuffer) SetDurationStart

func (timeBuf *TimeBuffer) SetDurationStart(time time.Time)

SetDurationStart mark start of duration time (to be used with TimeBufMinDur)

func (*TimeBuffer) Validate

func (timeBuf *TimeBuffer) Validate() error

Validate settings of time buffer

func (*TimeBuffer) Wait

func (timeBuf *TimeBuffer) Wait(ctx context.Context, hasErrors bool) error

Wait inserts time buffer or context

type Type

type Type int

Type type of scheduler

const (
	// SchedUnknown unknown scheduler
	SchedUnknown Type = iota
	// SchedSimple simple scheduler
	SchedSimple
)

func (Type) GetEnumMap

func (value Type) GetEnumMap() *enummap.EnumMap

func (Type) MarshalJSON

func (value Type) MarshalJSON() ([]byte, error)

MarshalJSON marshal scheduler type to json

func (*Type) UnmarshalJSON

func (value *Type) UnmarshalJSON(arg []byte) error

UnmarshalJSON unmarshal scheduler type from json

Jump to

Keyboard shortcuts

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