Documentation ¶
Index ¶
- Variables
- type CreatedBy
- type DatedState
- type Outcome
- type Queue
- type State
- type Storage
- func (s *Storage) ArchiveTask(tsk *Task) error
- func (s *Storage) Delete(id string) error
- func (s *Storage) Filter(state State, start time.Time, end time.Time) (tasks []*Task, err error)
- func (s *Storage) Get(id string) (*Task, error)
- func (s *Storage) PersistProcessing(tsk *Task) error
- func (s *Storage) PersistScheduled(tsk *Task) error
- func (s *Storage) ProcessTask(tsk *Task) error
- type Task
- type Type
Constants ¶
This section is empty.
Variables ¶
var ( ErrQueueEmpty = errors.New("queue empty") ErrQueueFull = errors.New("queue full") )
var (
ErrNotFound = errors.New("task not found")
)
Functions ¶
This section is empty.
Types ¶
type DatedState ¶ added in v0.6.0
DatedState (kind: struct) is a State with a timestamp.
type Queue ¶
Queue is a priority queue for tasks.
func (*Queue) Pop ¶
get the next item from the priority queue Pop the task off of the queue The task remains in the database, but is no longer in the heap. As the state of the task changes
func (*Queue) Push ¶
Add an item to the priority queue 1. Check if we have too many items enqueued already. 2. Persist task to the database. 3. Push the task into the in-memory heap.
func (*Queue) PushUniqueByBranch ¶ added in v0.6.0
Pushes a task to the queue, and removes any tasks with matching repo/branch from the queue
type State ¶ added in v0.6.0
type State string
State (kind: string) represents the last known state of a task. A task can be in one of three states StateScheduled: this is the initial state of the task when it enters the queue. StateProcessing: once work begins on the task, it is put into this state. StateComplete: work is no longer being done on this task. client should check task result.
type Storage ¶ added in v0.6.0
type Storage struct {
// contains filtered or unexported fields
}
Tasks stored in leveldb
func NewMemoryTaskStorage ¶ added in v0.6.0
func NewTaskStorage ¶ added in v0.6.0
func (*Storage) ArchiveTask ¶ added in v0.6.0
func (*Storage) PersistProcessing ¶ added in v0.6.0
func (*Storage) PersistScheduled ¶ added in v0.6.0
func (*Storage) ProcessTask ¶ added in v0.6.0
type Task ¶
type Task struct { Version int `json:"version"` // Schema version Priority int `json:"priority"` // Scheduling priority ID string `json:"id"` // Unique identifier for this task Runner string `json:"runner"` // Runner that ran this task Plan string `json:"plan"` // Test plan Case string `json:"case"` // Test case States []DatedState `json:"states"` // State of the task Type Type `json:"type"` // Type of the task Composition interface{} `json:"composition"` // Composition used for the task Input interface{} `json:"input"` // The input data for this task Result interface{} `json:"result"` // Result of the task, when terminal. Error string `json:"error"` // Error from Testground CreatedBy CreatedBy `json:"created_by"` // Who created the task }
Task (kind: struct) contains metadata about a testground task. This schema is used to store metadata in our task storage database as well as the wire format returned when clients get the state of a running or scheduled task.
func (*Task) CreatedByCI ¶ added in v0.6.0
func (*Task) IsCanceled ¶ added in v0.6.0
func (*Task) RenderCreatedBy ¶ added in v0.6.0
func (*Task) State ¶ added in v0.6.0
func (t *Task) State() DatedState
type Type ¶ added in v0.6.0
type Type string
Type (kind: string) represents the kind of activity the daemon asked to perform. In alignment with the testground command-line we have two kinds of tasks TypeBuild -- which functions similarly to `testground build`. The result of this task will contain a build ID which can be used in a subsequent run. TypeRun -- which functions similarly to `testground run`