Skip to main content

select_ready_runs

Function select_ready_runs 

Source
pub fn select_ready_runs(
    ready_runs: &[ReadyRunSelectionInput],
) -> SelectionResult
Expand description

Default selector that picks runs by priority (descending), FIFO (ascending created_at), and finally by RunId for full ties.

This function takes selector-ready inputs and returns a selection result containing runs ordered by priority (higher first), then by creation time (earlier first), and finally by RunId (deterministic ordering) for runs with identical priority and created_at values.

§Arguments

  • ready_runs - Selector inputs containing run and pre-resolved priority

§Returns

A SelectionResult containing:

  • selected: All ready runs ordered by priority, then FIFO, then RunId
  • remaining: Always empty in this default selector, because all ready runs are selected. Future selectors (e.g., N-of-M selection, capacity- aware selection) may return a non-empty remaining set to indicate runs that were eligible but not selected in this pass.

§Design Note

This is the default selector for v0.1. The selection policy may be made configurable in future versions (Phase 4+).

§Determinism

The selector is fully deterministic. When two runs have identical priority and created_at values (a “full tie”), they are ordered by RunId using lexicographic comparison of the underlying UUID bytes. This guarantees stable ordering regardless of input order.