runqueue

package
v0.97.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package runqueue coordinates CPU-heavy commands across WB processes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Budget

func Budget() int

Budget leaves one logical CPU available for the harness and operating system. Even a single-core machine retains one execution slot.

func Units

func Units(argv []string, budget int) int

Units classifies the CPU share required by argv within budget.

Types

type Lease

type Lease struct {
	// contains filtered or unexported fields
}

Lease holds units machine-wide until Release. Slot files live below the projects root so harnesses already permitted to write repositories can join the same budget without requiring access to the user's home directory.

func Acquire

func Acquire(ctx context.Context, projectsRoot string, units, budget int) (*Lease, time.Duration, error)

Acquire waits for units from one projects-root budget. Each attempt either acquires every requested slot or releases all partial locks before waiting, preventing two multi-unit commands from deadlocking one another.

func (*Lease) Release

func (lease *Lease) Release()

Jump to

Keyboard shortcuts

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