labassistant

package module
v0.0.0-...-82abc98 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2016 License: MIT Imports: 5 Imported by: 0

README

LabAssistant!

A Go library for carefully refactoring critical paths and code. It's a lightweight port of Github's Scientist and with inspiration from the python port Laboratory.

Why?

See GitHub's blog post — http://githubengineering.com/scientist/

Status

Project has been shut down, if anyone want to take it over please go see issue #2.

The library is currently in an alpha stage and under development.

Main features have been implemented, along with basic test coverage. It haven't been tested in production yet, so beware.

Installation

go get github.com/lmas/labassistant.

Usage

For now, please see the example.go file for how to use the library.

Contribution

Any and all contributions are welcome. Just make sure to run go fmt and go test on any code in a new pull request.

License

MIT License, see the LICENSE file.

TODO

Library:

  • Ditch the reflect magic and make a code gen tool instead?
  • Remove the panic'ing code and return errors instead.
  • Default publish functions? One simple CLI output and one web page graph.

Misc:

  • Show feature list.
  • More documentation and usage examples (especially in this file).

Documentation

Index

Constants

View Source
const VERSION = "0.2"

Variables

This section is empty.

Functions

func DefaultIgnoreMismatch

func DefaultIgnoreMismatch(control, candidate []interface{}) bool

The default ignore mismatch check. It always returns false, so it will never ignore any output mismatches.

func DefaultMismatchCompare

func DefaultMismatchCompare(control, candidate []interface{}) bool

The default output mismatch comparison. If there's a mismatch it will return true.

It loops over all outputs for a candidate and do a simple == comparison against the control's output. It also ensures that the number of outputs of the candidate is the same as the control's.

Types

type Experiment

type Experiment struct {
	Name       string
	Control    *Observation
	Candidates []*Observation
	RunOrder   []string
	Inputs     []interface{}
	// contains filtered or unexported fields
}

func NewExperiment

func NewExperiment(name string) *Experiment

Create a new experiment to run and set a name for it.

func (*Experiment) AddCandidate

func (ex *Experiment) AddCandidate(f interface{})

Add a candidate function f. You can add as many as you like.

func (*Experiment) Run

func (ex *Experiment) Run(inputs ...interface{}) []interface{}

Run the experiment, calling the control and candidate functions, one at a time, in a random order. You can optionally provide input arguments to give to the control/candidates.

func (*Experiment) SetCompare

func (ex *Experiment) SetCompare(f func([]interface{}, []interface{}) bool)

Set a custom comparison function. It is run once for each candidate.

Format of the custom comparison function: `func name_of_func(control []interface{}, candidate []interface{}) bool{}` and it should return wether the control outputs "control" is equal to the candidate outputs "candidate".

func (*Experiment) SetControl

func (ex *Experiment) SetControl(f interface{})

Set a function f as the control for the experiemnt. There can only be one control for each experiment and it's required to be set before the experiment can be run.

func (*Experiment) SetIgnore

func (ex *Experiment) SetIgnore(f func([]interface{}, []interface{}) bool)

Set a custom check for if a mismatch, between the control's outputs and a candidate's, should be ignored. It's run once for each candidate with mismatched outputs. A panic for a candidate is always considered a mismatch.

Format of the custom ignore function: `func name_of_func(control []interface{}, candidate []interface{}) bool{}` and it should return wether the output mismatch should be ignored.

type Observation

type Observation struct {
	Name     string
	Panic    interface{}
	Outputs  []interface{}
	Start    time.Time
	Duration time.Duration
	Mismatch bool
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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