flybrain/infra/units/fly-recap.service
acamilo ab537d1045 infra: the sim's cpus are exclusive to the sim (PERF-02 review N1)
A pinned sweep worker cannot leave its cpu, so any sustained cpu-bound process allowed there
collapsed the session runtime to 0.14x real time. flysim and flysim-session now run in
flysim.slice (AllowedCPUs = the sim's set) and bin/fly-cpu-confine, run by their ExecStartPre,
confines system.slice, user.slice and init.scope to the other cpus. It refuses while a sim unit
still sits outside the slice (shrinking system.slice under it would make it float). Without a
partition the deploy writes FLY_SESSION_PIN=0. fly-recap and fly-retention run at SCHED_IDLE.
The drop-in plan is one function (cpuset_dropin_plan) shared by the deploy and lint; lint covers the
plan, the units, the deploy wiring and fly-cpu-confine against a stub systemctl and a fake /proc.
Runbook and README updated.
2026-10-01 15:01:47 +00:00

19 lines
730 B
Desktop File

# infra/units/fly-recap.service — triggered by fly-recap.timer.
# docs/design/infra.md section 3: "Nice=19, IOSchedulingClass=idle,
# CPUWeight=20 so it can never starve the live stream."
[Unit]
Description=Cut the daily highlight reel
[Service]
Type=oneshot
User=fly
Environment=FLY_STATE_DIR=/srv/fly/state
Environment=FLY_MEDIA_DIR=/srv/fly/media
ExecStart=/opt/fly/bin/fly-recap
Nice=19
IOSchedulingClass=idle
CPUWeight=20
# Batch work never competes with anything: idle policy (Nice and CPUWeight are moot under it). The
# sim's CPUs are out of its reach anyway (fly-cpu-confine); this keeps it off the page's and the
# encoder's too. SCHED_IDLE measured harmless beside the pinned sweep workers.
CPUSchedulingPolicy=idle