Documentation
¶
Overview ¶
Package bench is the dispatch bench (T07): dispatch situations written as data, each with the decision expected by hand, and what a contender decides for each. The plain Go scheduler (internal/dispatch) is the first contender; a local model would read the same cases. go tool task bench-dispatch prints the table.
Index ¶
Constants ¶
const ( Start = "start" Wait = "wait" Fail = "fail" )
The decisions a case expects for a planned task.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Answer ¶
type Answer struct {
Code string
Decision string // start, wait or fail
Reason string // why it waits or fails
}
Answer is what a contender decided for one planned task.
type Case ¶
type Case struct {
// Name says what the case checks.
Name string `json:"name"`
// Machine is what the machine allows; absent, nothing limits.
Machine *Machine `json:"machine,omitempty"`
// Wishes, oldest first.
Wishes []Wish `json:"wishes"`
// Projects; a project not listed is not in Git.
Projects []Project `json:"projects,omitempty"`
// Tasks, oldest first.
Tasks []Task `json:"tasks"`
// Gates held now. The Go scheduler does not read them: a worker waits for its gate when it runs the command.
Gates []Gate `json:"gates,omitempty"`
// Expect is the decision for each planned or resuming task, by code: start, wait or fail.
Expect map[string]string `json:"expect"`
}
Case is a dispatch situation and the decision expected for each of its planned tasks.
type Machine ¶
type Machine struct {
Slots int `json:"slots"`
Running int `json:"running"`
Pressure string `json:"pressure,omitempty"`
}
Machine is what the machine allows in a case.
type Result ¶
type Result struct {
Case Case
Answers []Answer // in the order the contender decided
// Wrong are the codes whose decision is not the expected one.
Wrong []string
// PerPass is the time of one pass over the case, the situation built included.
PerPass time.Duration
}
Result is a contender's answer to a case.
type Task ¶
type Task struct {
Code string `json:"code"`
Wish string `json:"wish"`
// Project; empty outside any project.
Project string `json:"project,omitempty"`
// Status: planned (pending, started by the scheduler), resuming (cut short, started again by the scheduler),
// running, waiting (for its edit question), done, failed, stopped or interrupted.
Status string `json:"status"`
DependsOn []string `json:"depends_on,omitempty"`
// Scopes are the write scopes; none is the whole folder.
Scopes []string `json:"scopes,omitempty"`
// ForkOf is the code of the task this one forks: an interrupted task forked is resumed as its fork.
ForkOf string `json:"fork_of,omitempty"`
}
Task is a task of a case. Its code is its identifier, unique in the case.