worker

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MPL-2.0 Imports: 29 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 worker is one warm live-rung worker process: a long-lived process that keeps its GPU context (CUDA, when the machine has one) and makes one job at a time through the media libraries (go-astiav on FFmpeg 7.1): decode, scale, tone-map and encode in-process, the CMAF written in Go. The supervisor runs one such process per encode slot, so a crash, a kill or a stall costs that one job, which the supervisor makes again elsewhere.

It answers the API of package api over a Unix socket (or TCP), to the supervisor only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cfg Config) error

Run runs a worker process until ctx ends.

Types

type Config

type Config struct {
	ID     string
	Socket string // a Unix socket path; else Addr
	Addr   string
	// HW is auto (CUDA when a device opens, else the CPU), cuda,
	// videotoolbox (a local smoke test on macOS) or none.
	HW     string
	Device string // the CUDA device
	// Slots is how many jobs run at once (the supervisor sends one at a
	// time; 1 makes a crash cost one job).
	Slots         int
	Queue         int
	DecodeThreads int
	EncodeThreads int
	FilterThreads int
	ExtraHWFrames int
	Stall         time.Duration
	Deadline      time.Duration
	MaxRSS        int64 // bytes; refuse new jobs above it (0: no limit)
	PoolInputs    int
	PoolDecoders  int
	GPUTonemap    string // auto | interop | roundtrip | cpu
	LogLevel      string
	Roots         []string
	// Faults are failures to have, for the chaos tests (leak:MBPS,
	// crash-after:N, stall-after:N). Never set in service.
	Faults string
}

Config is a worker process's configuration.

func (*Config) Defaults

func (c *Config) Defaults()

Defaults fills a config's zero values.

type Health

type Health struct {
	OK        bool    `json:"ok"`
	ID        string  `json:"id"`
	Backend   string  `json:"backend"`
	Note      string  `json:"note,omitempty"`
	FFmpeg    string  `json:"ffmpeg"`
	Slots     int     `json:"slots"`
	Busy      int     `json:"busy"`
	Jobs      int     `json:"jobs"` // in the registry: queued, running, or aborted and not returned
	Waiting   int64   `json:"waiting"`
	UptimeSec float64 `json:"uptimeSec"`
	Wedged    string  `json:"wedged,omitempty"`
	PID       int     `json:"pid"`
	RSS       int64   `json:"rss"`
}

Health is a worker process's /healthz.

Directories

Path Synopsis
Package ffx fills the gaps of the go-astiav binding (v0.39.0, the last release for FFmpeg 7.x) the worker needs, with small cgo calls into the same libraries.
Package ffx fills the gaps of the go-astiav binding (v0.39.0, the last release for FFmpeg 7.x) the worker needs, with small cgo calls into the same libraries.

Jump to

Keyboard shortcuts

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