schedule

package
v2.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2016 License: Apache-2.0 Imports: 11 Imported by: 45

Documentation

Overview

Package schedule implements a schedule of terminations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByTime

type ByTime []Entry

ByTime implements sort.Interface for []Entry based on the time field

func (ByTime) Len

func (t ByTime) Len() int

func (ByTime) Less

func (t ByTime) Less(i, j int) bool

func (ByTime) Swap

func (t ByTime) Swap(i, j int)

type Entry

type Entry struct {
	Group grp.InstanceGroup `json:"group"`
	Time  time.Time         `json:"time"`
}

Entry is an entry a termination schedule. It contains the instance group that the terminator will randomly select from as well as the time of termination.

func (*Entry) Crontab

func (e *Entry) Crontab(termPath, account string) string

Crontab returns a termination command for the Entry, in crontab format. It takes as arguments:

  • the path to the termination executable
  • the account that should execute the job

The returned string is not terminated by a newline.

func (*Entry) Equal

func (e *Entry) Equal(o *Entry) bool

Equal checks that two entries are equal

func (*Entry) UnmarshalJSON

func (e *Entry) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements Unmarshaler.UnmarshalJSON

type Schedule

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

Schedule is a collection of termination entries.

func New

func New() *Schedule

New returns a new Schedule

func (*Schedule) Add

func (s *Schedule) Add(tm time.Time, group grp.InstanceGroup)

Add schedules a termination for group at time tm

func (Schedule) Crontab

func (s Schedule) Crontab(exPath string, account string) []byte

Crontab returns a schedule of termination commands in crontab format It takes as arguments:

  • the path to the executable that terminates an instance
  • the account that should execute the job

func (*Schedule) Entries

func (s *Schedule) Entries() []Entry

Entries returns the list of schedule entries

func (Schedule) MarshalJSON

func (s Schedule) MarshalJSON() ([]byte, error)

MarshalJSON implements Marshaler.MarshalJSON

func (*Schedule) Populate

func (s *Schedule) Populate(d deploy.Deployment, getter chaosmonkey.AppConfigGetter, chaosConfig *config.Monkey, apps []string) error

Populate populates the termination schedule with the random terminations for a list of apps. If the specified list of apps is empty, then it will

func (*Schedule) UnmarshalJSON

func (s *Schedule) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements Unmarshaler.UnmarshalJSON

Jump to

Keyboard shortcuts

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