Documentation
¶
Overview ¶
Package tasks holds the overmind's assigned-task model, seed-file loader, and the in-memory store that matches pending tasks to idle workers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds tasks in memory and matches pending ones to idle workers.
func (*Store) Add ¶
Add inserts a runtime task (plan-runner injection path). Same validation as LoadTasks; Status is forced to pending regardless of input.
func (*Store) AssignPending ¶
func (s *Store) AssignPending(workers []supervisor.WorkerInfo, sender Sender)
AssignPending reconciles assignments against the current fleet snapshot, then sends an Assign for each pending task to an eligible idle worker. Called each status tick. Tasks assigned to a worker absent from the snapshot (died) are returned to pending for reassignment.
func (*Store) HandleEvent ¶
HandleEvent updates task status from a worker's task_done / task_failed event. The event Detail begins with the task id (see the worker's OnTaskResult).
type Task ¶
type Task struct {
ID string `yaml:"id"`
Script string `yaml:"script"`
Params map[string]string `yaml:"params"`
RoleRequired string `yaml:"role_required"`
AgentID string `yaml:"agent_id"` // optional pin
Status TaskStatus `yaml:"-"`
AssignedTo string `yaml:"-"`
}
Task is one unit of assignable work.
type TaskStatus ¶
type TaskStatus string
TaskStatus is the lifecycle state of a task.
const ( StatusPending TaskStatus = "pending" StatusAssigned TaskStatus = "assigned" StatusRunning TaskStatus = "running" StatusDone TaskStatus = "done" StatusFailed TaskStatus = "failed" )