evaluation

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package evaluation runs the remote-evaluation engine: the gate reconciler expands each immutable Evaluation into its EvaluationUnit children, the unit reconciler schedules them through the sandboxed agent-Job machinery with bounded concurrency and collects each pod's EVOLVE-EVENT stream onto unit statuses (full-fidelity entries into per-unit ConfigMaps), and the TTL loop deletes finished evaluations after their retention. An Evaluation's phase is derived from its children's. This package is the single writer for both kinds, so no transition table is involved.

Index

Constants

View Source
const DefaultTTL = 72 * time.Hour

DefaultTTL retains a finished Evaluation for three days: long enough for the submitting client to reconnect and reassemble results after a weekend, short enough that etcd never accumulates finished batches.

Variables

This section is empty.

Functions

func UnitName

func UnitName(eval string, index int) string

UnitName is the deterministic child name for one unit index.

Types

type GateReconciler

type GateReconciler struct {
	client.Client
	Namespace string
	// EnabledHarnesses is the evolve-runner fleet resolved at startup.
	EnabledHarnesses []string
	Now              func() time.Time
	Log              *slog.Logger
}

GateReconciler expands a new Evaluation into its EvaluationUnit children. Creation is idempotent (deterministic names, AlreadyExists adopted), so a crashed expansion resumes where it stopped. Units whose harness preference list has no overlap with the enabled fleet are settled immediately as Failed/HarnessUnavailable, never silently dropped.

func (*GateReconciler) Reconcile

func (r *GateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile creates missing children and moves the parent to Running.

func (*GateReconciler) SetupWithManager

func (r *GateReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the gate.

type Runner

type Runner interface {
	CreateEval(ctx context.Context, spec jobs.EvalSpec) (string, error)
	ResultLines(ctx context.Context, jobName string, fn func(line []byte) error) error
	Status(ctx context.Context, jobName string) (jobs.Status, error)
	Delete(ctx context.Context, jobName string) error
}

Runner is the jobs surface the unit reconciler needs; satisfied by *jobs.Client.

type TTLReconciler

type TTLReconciler struct {
	client.Client
	Namespace string
	// TTL is the default retention. 0 keeps forever; <0 means DefaultTTL.
	// spec.ttlSecondsAfterFinished overrides per evaluation.
	TTL time.Duration
	Now func() time.Time
	Log *slog.Logger
}

TTLReconciler deletes finished Evaluations after their retention; deletion cascades to units, Jobs (via the unit finalizer), and results ConfigMaps. Expiry is deletion, not a phase.

func (*TTLReconciler) Reconcile

func (r *TTLReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile enforces the TTL on one Evaluation.

func (*TTLReconciler) SetupWithManager

func (r *TTLReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the TTL loop.

type UnitReconciler

type UnitReconciler struct {
	client.Client
	Runner     Runner
	Workspaces WorkspaceStat
	Namespace  string
	// MaxConcurrent bounds simultaneously Running units (default 4).
	MaxConcurrent int
	// EnabledHarnesses is the evolve-runner fleet resolved at startup.
	EnabledHarnesses []string
	// ArtifactBaseURL is the public artifact endpoint agent pods fetch
	// bundles from, e.g. http://patchy-source-controller.patchy.svc:9790.
	ArtifactBaseURL string
	Now             func() time.Time
	Log             *slog.Logger
}

UnitReconciler schedules EvaluationUnits into agent Jobs with bounded concurrency and collects their results. Slot accounting comes from the cluster, never memory.

func (*UnitReconciler) Reconcile

func (r *UnitReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile handles both the singleton scheduling request and per-object runs.

func (*UnitReconciler) SetupWithManager

func (r *UnitReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the unit reconciler: every unit and evaluation Job event also fans into the singleton scheduler request.

type WorkspaceStat

type WorkspaceStat interface {
	Stat(ctx context.Context, digest string) (bool, error)
}

WorkspaceStat checks a workspace blob's presence before launch; satisfied by *artifact.Client.

Jump to

Keyboard shortcuts

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