Documentation
¶
Overview ¶
Package dispatch decides which planned task starts now: the scheduler's rules, in plain Go, apart from the store and the workers. A pass reads a Situation (the tasks, the wishes, the projects, the machine) and gives a Decision for each planned task: start it, let it wait with its reason, or fail it. The harness acts on the decisions; the dispatch bench (internal/dispatch/bench) feeds it cases written by hand.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Light ¶
Light tells whether the task takes no slot of the machine: a watcher, or a question worker.
func Overlap ¶
Overlap tells whether two sets of write scopes share a path: one names the other, or a folder holding it. No scope is the whole folder. Case is ignored, as on macOS and Windows.
func Planned ¶
Planned tells whether Djinn starts the task by itself, once it is ready: a task planned on this machine, or one whose worker Djinn resumes (cut short by a restart, or by its provider's usage limit). An azima never is: no worker runs it.
func QuestionWorker ¶
QuestionWorker tells whether Djinn started the task on a question (Task.role): it reads and runs djinn's commands, no build nor gate, so it takes no slot and holds no write scope; an agent all the same, it waits while the machine is under pressure or its memory would not hold it.
Types ¶
type Decision ¶
type Decision struct {
Task *planv1.Task
// Why it waits.
Why string
// Why it never will start: it fails.
Failed string
// It waits for a dependency's work to be committed into the wish's integration branch: the integration commits
// that work at once.
Commit bool
}
Decision is what a pass decides for one planned task. Why and Failed both empty: it starts now.
type Machine ¶
type Machine struct {
// Slots is the most workers that run at once, and Rule how it was decided.
Slots int
Rule string
// Pressure says why the machine is under pressure, "" when it is not: no worker starts then.
Pressure string
// Running is the number of workers that run now.
Running int
// Gates is the number of gates held outside the running workers: each takes a slot.
Gates int
// Available is the memory available to new programs, in bytes; 0 when unknown, and then the memory holds no
// worker back. Policy weighs it against what a worker of the task's provider typically takes
// (machine.Policy.WorkerRoom).
Available uint64
Policy machine.Policy
}
Machine is what the machine allows now.
type Situation ¶
type Situation struct {
// contains filtered or unexported fields
}
Situation is what a pass knows: every task, every wish, which projects are in Git, and the machine. Its zero value knows nothing and limits nothing; New fills it.
func New ¶
func New(tasks []*planv1.Task, wishes []*planv1.Wish, git map[string]bool, machine *Machine) *Situation
New is the situation of tasks and wishes, all of them as the store lists them (oldest first), the projects in Git being git (a project not in it is not), and machine what the machine allows (nil: nothing limits).
func (*Situation) At ¶
At sets the time the situation is read at, which a usage limit's reset is compared with: the harness's clock.
func (*Situation) Blocker ¶
Blocker says why the task cannot start now (why), or why it never will (failed); both empty when it can start. Its wish must be active (not paused nor granted); then come the dependencies, its provider's usage limit, the write scopes, and the machine; a watcher only waits for its wish and its dependencies, a question worker for the machine's pressure and memory too. A wish the situation does not know does not hold the task.
func (*Situation) Order ¶
Order is the planned tasks: the ones Djinn resumes first, as they ran before; then by the rank of their wish, then the oldest first. The tasks of a wish that is not active come last; Blocker keeps them waiting.
Directories
¶
| Path | Synopsis |
|---|---|
|
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.
|
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. |