process

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstalledRVersions

func InstalledRVersions() []string

InstalledRVersions returns the R versions installed under rigBase. Each entry is the directory name (e.g. "4.5.0", "4.4.3").

func ResolveRBinary

func ResolveRBinary(version, fallback string) (string, bool)

ResolveRBinary maps a requested R version (e.g. "4.5.0") to the full path of a rig-managed R binary. Resolution order:

  1. Exact match: /opt/R/<version>/bin/R
  2. Minor match: highest /opt/R/<major>.<minor>.*/bin/R
  3. Fallback: the configured default R path

Returns the resolved path and whether the fallback was used. When version is empty the fallback is returned directly (not considered a miss).

func RunPreflight

func RunPreflight(cfg *config.ProcessConfig, fullCfg *config.Config) *preflight.Report

RunPreflight verifies the process backend prerequisites. Called by (*ProcessBackend).Preflight() with the full config so the egress probe can read Redis/OpenBao/database addresses and the resource- limit check can read server-level defaults.

Check ordering matters: bwrap/R/userns are prerequisites for checkBwrapHostUIDMapping (it spawns bwrap), and that check is a prerequisite for checkWorkerEgress (which also spawns bwrap and whose results are meaningful only if the host UID mapping is effective). If a prerequisite fails we still run the later checks — they'll fail too, and emitting all failures at once is more useful than bailing at the first.

Types

type ProcessBackend

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

ProcessBackend implements backend.Backend using bubblewrap.

func New

func New(fullCfg *config.Config, rc *redisstate.Client) (*ProcessBackend, error)

New creates a ProcessBackend. Verifies that bwrap exists at the configured path and that the worker mount point can be reached from inside the bwrap sandbox. The full config is stored so Preflight() can read the addresses of Redis/OpenBao/database for the egress probe and the server-level resource-limit fields for the warning check.

When rc is non-nil the backend uses Redis-backed port and UID allocators to coordinate with concurrent peers during rolling- update overlap. When rc is nil (single-node deployment without redis) it falls back to in-memory bitset allocators, which are correct because without the cutover window there are no cross- server collisions.

func (*ProcessBackend) Addr

func (b *ProcessBackend) Addr(_ context.Context, id string) (string, error)

func (*ProcessBackend) Build

func (*ProcessBackend) CheckRVersion

func (b *ProcessBackend) CheckRVersion(version string) error

func (*ProcessBackend) CleanupOrphanResources

func (b *ProcessBackend) CleanupOrphanResources(ctx context.Context) error

CleanupOrphanResources implements backend.Backend. Workers from a previous run are already dead (Pdeathsig killed them with the server), so the in-memory variants have nothing to clean up. The Redis variants, however, carry owned claims across server restarts and need a scan-and-delete at startup to return crashed-session ports and UIDs to the pool.

func (*ProcessBackend) HealthCheck

func (b *ProcessBackend) HealthCheck(ctx context.Context, id string) bool

func (*ProcessBackend) ListManaged

func (b *ProcessBackend) ListManaged(_ context.Context) ([]backend.ManagedResource, error)

func (*ProcessBackend) Logs

func (*ProcessBackend) Preflight

func (b *ProcessBackend) Preflight(_ context.Context) (*preflight.Report, error)

Preflight implements backend.Backend by delegating to RunPreflight.

func (*ProcessBackend) RemoveResource

func (b *ProcessBackend) RemoveResource(_ context.Context, r backend.ManagedResource) error

func (*ProcessBackend) Spawn

func (*ProcessBackend) Stop

func (b *ProcessBackend) Stop(_ context.Context, id string) error

func (*ProcessBackend) UpdateResources

func (b *ProcessBackend) UpdateResources(_ context.Context, _ string, _ int64, _ int64) error

UpdateResources is not supported by the process backend: we do not enforce per-worker cgroup limits (decision #6), so there is nothing to update. Returning ErrNotSupported lets callers distinguish "cannot do this" from "ran into a real error"; api/apps.go checks for ErrNotSupported and skips its warning log so app-update requests do not spam one noisy warning per worker.

func (*ProcessBackend) WorkerResourceUsage

func (b *ProcessBackend) WorkerResourceUsage(_ context.Context, id string) (*backend.WorkerResourceUsageResult, error)

Jump to

Keyboard shortcuts

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