schedule

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 3 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 schedule ranks pending agent runs for bounded-concurrency slot grants. It is pure arithmetic — the scheduler reconcilers list candidates from the cluster, ask Pick for the winners, and write the grants — so slot policy is fully table-testable and slot accounting is always cluster state, never controller memory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pick

func Pick(pending []Candidate, freeSlots int, now time.Time, aging AgingPolicy) []string

Pick returns the names of the freeSlots highest-ranked candidates, ordered expedited first, then effective-priority descending, then QueuedAt ascending, then Name — a total, deterministic order so concurrent deciders agree.

Types

type AgingPolicy

type AgingPolicy struct {
	// Interval grants one effective-priority point per elapsed interval.
	Interval time.Duration
	// Cap bounds the total aging boost.
	Cap int32
}

AgingPolicy lifts long-waiting candidates so a flood of high-priority work cannot starve low-priority findings forever, while the cap keeps genuinely critical items on top.

type Candidate

type Candidate struct {
	// Name of the run object.
	Name string
	// Priority in [0, 100]; higher runs first.
	Priority int32
	// QueuedAt orders equal priorities first-in-first-out and drives aging.
	QueuedAt time.Time
	// Expedited candidates rank ahead of every non-expedited one regardless
	// of priority or aging (a human asked for the front of the queue);
	// expedited candidates order among themselves as usual.
	Expedited bool
}

Candidate is one pending run.

Jump to

Keyboard shortcuts

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