schedule

package
v0.0.0-...-717c872 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result interface {
	// Errors contains the results of tasks with errors.
	Errors() []TaskResult
	// Ok is true if there were no errors.
	Ok() bool
}

Result is the result of the whole build.

type Scheduler

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

Scheduler takes a list of tasks and schedules their execution according to their dependencies.

func New

func New() *Scheduler

New creates a new scheduler.

func (*Scheduler) NewTask

func (s *Scheduler) NewTask(name, command string, deps []string) task.Task

NewTask adds a new task to this scheduler and returns it.

func (*Scheduler) Start

func (s *Scheduler) Start(workers int, executor exec.Executor) Result

Start the scheduler. Scheduler calls executor.Run(t Task) when t can be executed and returns when the whole task network has been processed.

type TaskResult

type TaskResult struct {
	Task   task.Task
	Err    error
	Status TaskStatus
}

TaskResult is the result of a single task.

func (TaskResult) String

func (ta TaskResult) String() string

type TaskStatus

type TaskStatus int

TaskStatus is the status of a task in a build.

const (
	// NotRun indicates a task was not run.
	NotRun TaskStatus = iota
	// Ok indicates a task was run with no error.
	Ok
	// Error indicates a task was run, but resulted in an error.
	Error
)

func (TaskStatus) String

func (ts TaskStatus) String() string

Jump to

Keyboard shortcuts

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