recipe

package module
v0.0.0-...-bb878ca Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: BSD-3-Clause Imports: 15 Imported by: 0

README

Recipe

Build Status Build status Go Report Card GolangCI Maintainability Test Coverage GoDoc

Task scheduler able to run tasks in parallel. Each task is scheduled to run when all their dependencies have been satisfied previously. The configuration files can be definded in JSON or TOML as you can see in the examples folder

Documentation

Documentation is available at godoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

func (*Error) Error

func (e *Error) Error() string

type Logger

type Logger struct {
	Level LoggerLevel
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(prefix string) *Logger

func (*Logger) Debug

func (l *Logger) Debug(format string, v ...interface{})

func (*Logger) Error

func (l *Logger) Error(format string, v ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(v ...interface{})

func (*Logger) Info

func (l *Logger) Info(format string, v ...interface{})

func (*Logger) Warning

func (l *Logger) Warning(format string, v ...interface{})

type LoggerLevel

type LoggerLevel int
const (
	DebugL LoggerLevel = iota
	InfoL
	WarningL
	ErrorL
	FatalL
)

func (LoggerLevel) String

func (i LoggerLevel) String() string

type Recipe

type Recipe struct {
	Main   string            `json:"main"`
	Env    map[string]string `json:"env" toml:"env"`
	Interp []string          `json:"interp" toml:"interp"`
	Tasks  map[string]*Task  `json:"tasks"`
	// contains filtered or unexported fields
}

func Open

func Open(path string, recipeLogger, stateLogger *Logger) (*Recipe, error)

func (*Recipe) Environ

func (r *Recipe) Environ() map[string]string

func (*Recipe) Interpreter

func (r *Recipe) Interpreter() []string

func (*Recipe) PrettyString

func (r *Recipe) PrettyString() string

func (*Recipe) RunMain

func (r *Recipe) RunMain(numWorkers uint) error

func (*Recipe) RunTask

func (r *Recipe) RunTask(task string, numWorkers uint) error

func (*Recipe) String

func (r *Recipe) String() string

type State

type State struct {
	States map[string]TaskState `json:"states" toml:"states"`
	// contains filtered or unexported fields
}

func OpenState

func OpenState(path string, logger *Logger) (*State, error)

func (*State) IsCancelled

func (s *State) IsCancelled(taskName string) bool

func (*State) IsDone

func (s *State) IsDone(taskName string) bool

func (*State) IsEnabled

func (s *State) IsEnabled(taskName string) bool

func (*State) IsFailure

func (s *State) IsFailure(taskName string) bool

func (*State) IsRunning

func (s *State) IsRunning(taskName string) bool

func (*State) IsSuccess

func (s *State) IsSuccess(taskName string) bool

func (*State) IsWaiting

func (s *State) IsWaiting(taskName string) bool

func (*State) MustSetCancelled

func (s *State) MustSetCancelled(taskName string)

func (*State) MustSetEnabled

func (s *State) MustSetEnabled(taskName string)

func (*State) MustSetFailure

func (s *State) MustSetFailure(taskName string)

func (*State) MustSetRunning

func (s *State) MustSetRunning(taskName string)

func (*State) MustSetSuccess

func (s *State) MustSetSuccess(taskName string)

func (*State) MustSetWaiting

func (s *State) MustSetWaiting(taskName string)

func (*State) PrettyString

func (s *State) PrettyString() string

func (*State) Remove

func (s *State) Remove() error

func (*State) Save

func (s *State) Save() error

func (*State) SetDisabled

func (s *State) SetDisabled(taskName string)

func (*State) SetEnabled

func (s *State) SetEnabled(taskName string) error

func (*State) String

func (s *State) String() string

type Task

type Task struct {
	Deps         []string          `json:"deps" toml:"deps"`
	Env          map[string]string `json:"env" toml:"env"`
	Interp       []string          `json:"interp" toml:"interp"`
	Cmd          string            `json:"cmd" toml:"cmd"`
	Stdout       string            `json:"stdout" toml:"stdout"`
	Stderr       string            `json:"stderr" toml:"stderr"`
	AllowFailure bool              `json:"allow_failure" toml:"allow_failure"`
	// contains filtered or unexported fields
}

func (*Task) Environ

func (t *Task) Environ() map[string]string

func (*Task) Execute

func (t *Task) Execute(r *Recipe) error

func (*Task) Interpreter

func (t *Task) Interpreter() []string

func (*Task) PrettyString

func (t *Task) PrettyString() string

func (*Task) String

func (t *Task) String() string

func (*Task) Terminate

func (t *Task) Terminate() error

type TaskIterator

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

type TaskState

type TaskState int
const (
	Disabled TaskState = iota
	Enabled
	Waiting
	Running
	Cancelled
	Success
	Failure
)

func (TaskState) MarshalJSON

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

func (TaskState) String

func (i TaskState) String() string

func (*TaskState) UnmarshalJSON

func (s *TaskState) UnmarshalJSON(b []byte) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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