pairworkloads

package
v0.209.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 31 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 pairworkloads reports the harness's work to NVIDIA Personal AI Router (PAIR) so it appears in PAIR's Jobs list on every cluster member and counts in PAIR's scheduler as pending work on the node that runs it.

PAIR's Jobs list is a stream of workload lifecycle frames that only PAIR's own proxies produce; the harness routes around those proxies (llama-swap :11436, the fleet nodes over the tailnet), so until 2026-09-17 nothing it ran was visible there. PAIR's workload manager accepts the same frames on a loopback ingress (our patch: fork dmmdea/Personal-AI-Router, branch feat/workload-local-ingress, worker 0.14.0; upstream PR "workload-manager: opt-in loopback ingress"); this package posts them.

It is fire-and-forget by construction: a 2 s timeout, one warning per process on the first failure, and never a harness result changed. PAIR being absent or down is normal, not an incident.

Identity comes from PAIR's own app-data files, never from configuration: node-id.json (this box's PAIR UUID = originatedFrom) and cluster/members.json (member name -> UUID = scheduledOn). Harness node names equal PAIR member names (the hostname each box advertises), compared case-insensitively.

Index

Constants

View Source
const (

	// OpenMaxAge is the leak cap: a marker this old is closed whatever its pid
	// says. The longest harness job is a delegation's 900 s cap; a seat-watch
	// stretch closes after two idle polls. Past a day a marker is a leak.
	OpenMaxAge = 24 * time.Hour

	// OrphanSweepInterval is fleet-serve's periodic sweep.
	OrphanSweepInterval = 45 * time.Second
	// OrphanError is the failure text an orphaned card is closed with.
	OrphanError = "harness process exited before the job finished"
)
View Source
const (
	// RelayPath is the member's route.
	RelayPath = "/fleet/pair-relay"
	// RelayBodyMax caps one relayed frame. A frame is a few hundred bytes; the cap only stops a
	// token holder from making the member read megabytes per call.
	RelayBodyMax = 64 << 10
	// RelayOpenMaxAge is the age past which a RELAYED in-flight marker is closed by the member's
	// sweep. The member cannot see whether the producer's process is alive (it is on another
	// box), so a relayed card closes by its terminal frame or by this cap, never by a pid probe.
	// It is the register's own leak cap: a lease card legitimately runs for hours.
	RelayOpenMaxAge = OpenMaxAge
)
View Source
const (
	ModeLocal    = "local ingress"
	ModeNodeInfo = "node-info fallback"
	ModeRelay    = "relay"
	ModeOff      = "off"
)

Modes an emitter reports (Emitter.Mode).

View Source
const (
	RelayOpenPerAsker = 128
	RelayOpenGlobal   = 512
)

Open relayed cards a member holds at once: per asker and over every asker. A box runs a handful of jobs at a time (a lease card, a few delegations), so the per-asker cap is far above any honest producer and the global one is a few honest boxes' worth.

View Source
const CardErrorMax = 140

CardErrorMax bounds the failure text a PAIR card shows. A jsonschema re-pack dump or a full acceptance report runs to hundreds of characters and turned the Jobs list into a wall of red (2026-09-17, first live day); the card wants the verdict, the ledger keeps the whole reason.

View Source
const (
	// DefaultEndpoint is the ingress every node's workload-ingress.json binds.
	DefaultEndpoint = "http://127.0.0.1:14324/v1/workloads/events"
)
View Source
const (
	// DefaultNodeInfoURL is PAIR's node-info on its default loopback port.
	DefaultNodeInfoURL = "http://127.0.0.1:14318/v1/node-info"
)
View Source
const FleetDoor = "fleet"

FleetDoor is the door a fleet node stamps on work it serves FOR another box (fleetnode.dispatchDoor, register A-102). The box that asked reports that work; the serving node reporting it too would show one job as two cards. Skipping it is what lets every box, not only the delegators, run with pair_workloads_enabled (0.140.6).

View Source
const RelayBuckets = 1024

RelayBuckets bounds the askers a limiter tracks; the least recently seen is dropped past it.

View Source
const (

	// SeatRequester is the requesterId a seat-activity card carries.
	SeatRequester = "llama-swap/direct"
)
View Source
const TestCardsEnv = "LOCAL_OFFLOAD_PAIR_TEST_CARDS"

TestCardsEnv, set to anything, keeps the cards of a process that declares a non-production run class (ledger.EnvRunClass): for the operator who is testing PAIR itself with a labelled run. Unset, a bake, a measurement and a test run open no card on the production dashboard (register F48 / C23).

View Source
const UnderLeaseEnv = "OFFLOAD_PAIR_UNDER_LEASE"

UnderLeaseEnv is set by `gpu reserve -- <cmd>` on the command it wraps. The lease owns that job's card (queued in the lease queue, running once the command starts, closed with its exit), so a harness command running under it reports nothing of its own: one job, one card (0.140.6).

Variables

This section is empty.

Functions

func CardError

func CardError(reason string) string

CardError collapses a failure reason to one short line: whitespace folded, cut at CardErrorMax with an ellipsis.

func CardOutcome

func CardOutcome(res core.Result, started bool) (state, errText string)

CardOutcome is the terminal state and error text of the PAIR card of a call that ended with res; started says whether its lane ever held the engine (the card ran). Every writer of a call's closing frame maps its outcome through here (Begin's end, the ledger row, RemoteCall.Finish, the node's card), so a call is closed the same way whichever of them gets there first.

func EngineFor

func EngineFor(task, seat string) string

EngineFor names the real engine behind a harness task and seat with the identifiers PAIR's upstream engine PRs use (llamacpp, vllm) plus the two non-text engines the harness drives (whispercpp, comfyui) and the accelerators (coral-edgetpu, hailo-8l, rknpu): an NPU call is not a llama.cpp job, and the card's engine badge is how PAIR tells them apart. An rkllm seat (chat and vision on the RK3588 NPU, named "<model>-npu") is the same device.

func LogSeatWatch

func LogSeatWatch(cfg config.Config)

LogSeatWatch prints the one startup line fleet-serve shows when it is on.

func MethodFor

func MethodFor(state string) string

MethodFor maps a workload state to the lifecycle method PAIR expects.

func NodeName

func NodeName(base, fallback string) string

NodeName is the name a remote placement is reported under BEFORE the node has answered: the host of its dispatch URL (the tailnet name the fleet config lists, which is the hostname PAIR's members.json carries), lowercased and without the port. The fleet node id is not a PAIR member name and resolves to nothing. fallback is used when base has no usable host.

func RelayJobID

func RelayJobID(asker, id string) string

RelayJobID is the id a member posts for a relayed job: "relay-<asker>-<id>", bounded, with a short digest of the exact (asker, id) pair appended so two different pairs can never map to one card ("n" + "led-1" and "n-led" + "1" would otherwise both read relay-n-led-1), whatever the bound cut.

func RelayRequester

func RelayRequester(asker, original string) string

RelayRequester is the requesterId a member posts for a relayed job: offload-harness/fleet:<asker>, plus "/" and the relayed requester's own suffix (its session) when it has one, bounded.

func Requester

func Requester(session string) string

Requester is the requesterId the harness stamps: its own name plus the session that asked, when one is known.

func RunOrphanSweeper

func RunOrphanSweeper(ctx context.Context, e *Emitter, every time.Duration)

RunOrphanSweeper sweeps the register every interval until ctx ends (fleet-serve). It returns at once when the emitter is disabled.

func WireHeadersFor

func WireHeadersFor(cfg config.Config, h http.Header)

WireHeadersFor is SetWireHeaders for a caller that holds a config and no emitter (the accelerator lane, the remote lanes' request builders). The emitter it asks is cached per (enabled, endpoint, app dir, node-info URL, relay), so the identity files are read once per identityTTL, not per call. A box that reports through a card relay (relay.go) has an enabled emitter, so it sends no X-Offload-Pair-Card: the asker cards the job through its relay and the serving node must not card it too (one job, one card).

Types

type CardAdmission

type CardAdmission int

CardAdmission is AdmitCard's verdict on one relayed frame.

const (
	// CardAdmitted: post the frame.
	CardAdmitted CardAdmission = iota
	// CardCapped: the frame would open a card past the open-card cap (answer 429).
	CardCapped
	// CardStale: an in-flight frame of a card whose terminal frame already arrived. Answer it as
	// received and post nothing.
	CardStale
)

type Config

type Config struct {
	Enabled  bool
	Endpoint string
	// AppDir overrides PAIR's per-user app-data dir (tests). "" = the
	// platform default, mirroring PAIR's shared/appdir.
	AppDir string
	// VLLMSeats is the box's declared `vllm_seats` and SwapEndpoint the
	// llama-swap its seats sit behind. Together they label a LOCAL seat bound
	// by alias: <node-b>'s agent seat is `agent-pool`, an alias of
	// `qwen3.8-27b-vllm-3card`, so the name alone reads as llama.cpp and PAIR
	// showed a vLLM job as "llamacpp".
	VLLMSeats    []string
	SwapEndpoint string
	// StateDir is the operator's state_dir: the open-card register (orphans.go)
	// lives under the machine-wide state root it resolves to, beside
	// seat-inflight. OpenDir, when set, names the register directory outright
	// (tests).
	StateDir string
	OpenDir  string
	// NodeInfoURL is PAIR's loopback node-info, read for this node's UUID when node-id.json is
	// missing or unreadable (the harness runs as a different OS user than PAIR; nodeinfo.go).
	// "" = no fallback. FromConfig sets it; a bare Config does not, so a test that builds an emitter
	// without it can never reach a live PAIR.
	NodeInfoURL string
	// Relay is the card relay (relay.go): where frames go when this box has no PAIR identity of
	// its own (neither node-id.json nor the node-info fallback). The zero value is no relay.
	Relay RelayConfig
	// Suppressed says the emitter is off because this process declares a non-production run class
	// (ledger.EnvRunClass, or a class-prefixed origin; register F48 / C23): a bake or measurement opens no
	// card. It is not the same as Enabled=false for a box that does not use PAIR: a suppressed run also asks
	// no fleet node to card its jobs (SetWireHeaders), where an ordinary disabled asker does.
	Suppressed bool
}

Config is the emitter's configuration, normally built by FromConfig.

func FromConfig

func FromConfig(cfg config.Config) Config

FromConfig reads the two harness config keys.

func OrphanSweepConfig

func OrphanSweepConfig(cfg config.Config) Config

OrphanSweepConfig is the emitter configuration fleet-serve's periodic sweep uses: the PAIR ingress, enabled when either PAIR key is on (a box that only serves vLLM seats still owns seat-watch cards).

func SeatWatchConfig

func SeatWatchConfig(cfg config.Config) Config

SeatWatchConfig is the emitter configuration for the seat watcher: the same ingress, enabled by its own key (pair_seat_activity_enabled). It is separate from pair_workloads_enabled on purpose — that key belongs on delegator boxes, while seat activity belongs on every box that SERVES a vLLM seat.

type Emitter

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

Emitter posts frames to PAIR's loopback ingress.

func New

func New(c Config) *Emitter

New builds an emitter. It reads nothing until the first use.

func (*Emitter) AskerName

func (e *Emitter) AskerName() string

AskerName is the name this box sends as core.AskerHeader: its PAIR member name when the emitter is enabled and the box is a member (so the node's row and card name the same machine PAIR does), else the short lowercase hostname. Always sanitized; never empty unless the OS reports no hostname.

func (*Emitter) AttachLedger

func (e *Emitter) AttachLedger(l *ledger.Ledger)

AttachLedger turns every non-delegation ledger row into one terminal frame.

Skipped on purpose: inner rows (ParentJobID set: one window of a video_watch, an escalating attempt, a nested sub-call; the call's own row is its card); agent_delegate rows (the delegate runner emits those, together with the in-flight states, under one identity so PAIR shows one card); agent rows (this box serving SOMEONE ELSE's delegation, already reported by the box that asked); cache hits (no GPU work happened).

func (*Emitter) Begin

func (e *Emitter) Begin(task, door string) (callID string, working func(), end func(res core.Result))

Begin opens a queued card for a call of task admitted through door, and returns the call id (the card's job id: the caller stamps it on the call's ledger row so that row closes THIS card) and the two functions that move the card on: working (the lane holds its engine: the card turns running, once) and end (the call returned with res: the card closes with its outcome, unless the call's ledger row already closed it, in which case end waits for that frame). end returns after the close is on the wire, so the caller may answer and be killed. The id is "" and both functions are nil when nothing was opened: emitter disabled, a task whose engine is not fixed by the task, work this box serves for another (FleetDoor), or a door that makes test traffic.

func (*Emitter) Emit

func (e *Emitter) Emit(ev Event)

Emit posts in the background and never blocks the caller on PAIR. The first failure per process logs one line; later ones are silent — PAIR being down is normal.

The frame is built and the open-card register updated HERE, on the caller's goroutine, so a job's markers follow its frames in order (queued, running, terminal) whatever order the background posts finish in. The first Emit of an emitter also sweeps the register once for cards a dead process left open.

func (*Emitter) EmitSync

func (e *Emitter) EmitSync(ev Event)

EmitSync is Emit that returns once the post was attempted (bounded by sendTimeout), for the frame a caller's ANSWER must not outrun: the terminal frame of a call whose door replies the moment it returns. A caller that runs the other way (answers, then its process is killed: an MCP client that closes stdin and kills the door after each reply) loses a background Emit that has not posted yet, and the card it opened is then closed by the orphan sweep as "harness process exited before the job finished", whatever the call's outcome was (2026-10-09). The marker work is the same as Emit's: the terminal verdict is parked on disk before the post (track), and removed after it (untrack).

func (*Emitter) Enabled

func (e *Emitter) Enabled() bool

Enabled is true when the config opts in AND frames have somewhere to go: PAIR is installed on this box (its node-id.json exists and names a UUID, or PAIR's node-info answers on loopback beside a live ingress), or, with no identity of its own, a card relay member is reachable (relay.go).

func (*Emitter) FromLedger

func (e *Emitter) FromLedger(row ledger.Entry) Event

FromLedger builds the terminal event for a finished tool call: the row's timestamp is the completion, and the latency walks it back to the start.

func (*Emitter) LocalEngine

func (e *Emitter) LocalEngine(task, seat string) string

LocalEngine is EngineFor for a seat served by THIS box's llama-swap: a seat the name reads as llama.cpp is labelled vllm when the box declares it in vllm_seats, directly or through the alias the roster resolves it to. Only a local seat can be resolved — a remote node's aliases live in ITS roster — so remote placements keep EngineFor. A roster that cannot be read leaves the name-based answer, which is what every card carried before.

func (*Emitter) LocalIdentity

func (e *Emitter) LocalIdentity() bool

LocalIdentity reports whether this emitter has a PAIR identity of its own (a readable node-id.json, or PAIR's node-info with the ingress answering) and is enabled. A fleet-serve serves the relay only then: a node that itself relays never relays for another.

func (*Emitter) Mode

func (e *Emitter) Mode() ModeInfo

Mode reports which way this emitter reports: PAIR's loopback ingress with the identity from node-id.json, the same ingress with the identity from PAIR's node-info, a card relay on a member, or nothing.

func (*Emitter) Send

func (e *Emitter) Send(ctx context.Context, ev Event) error

Send posts one frame synchronously. A disabled emitter is a silent no-op. An in-flight frame is recorded in the open-card register before it is posted; a terminal frame's marker is removed once the post was attempted.

func (*Emitter) SetWireHeaders

func (e *Emitter) SetWireHeaders(h http.Header)

SetWireHeaders stamps the attribution headers on a request that creates work on a fleet node: always the asker's name, the node-carding signal only when this emitter will not card the job, and the session and run class of this process when it has them (core.OriginHeader, core.RunClassHeader). A nil emitter is a disabled one.

func (*Emitter) SweepOrphans

func (e *Emitter) SweepOrphans(ctx context.Context) int

SweepOrphans closes every card whose producer is gone: it claims the marker, sends the terminal "failed" frame the producer never sent, and deletes the marker. It returns the number of frames delivered. It leaves every marker of another endpoint alone. A marker whose closing frame cannot be built, and a post PAIR REJECTED (HTTP 400, 413 or 422), drop that marker and go on; any other failed post releases the claim and skips every later marker of the SAME endpoint for the rest of the pass (that ingress or relay is down; the next sweep retries), while the markers of the other endpoints go on: with several relays, one dead relay must not starve the healthy ones' cards or the local ingress's. A disabled emitter does nothing.

func (*Emitter) SweepOrphansAsync

func (e *Emitter) SweepOrphansAsync()

SweepOrphansAsync runs one sweep in the background, once per emitter. Emit calls it, so every harness process that reports anything closes what a dead process left open; the process's Wait covers it.

func (*Emitter) Wait

func (e *Emitter) Wait()

Wait blocks until every background Emit has finished (tests, shutdown).

type Event

type Event struct {
	JobID  string
	Model  string
	Engine string
	Node   string // harness node name; "" = this box
	// NodeAliases are other names the same node is known by (the fleet node
	// id from its health, the host of its dispatch URL, the name it reported
	// on the wire). The frame resolves Node first, then each alias, against
	// PAIR's member names and addresses; a remote run none of them resolves
	// is stamped with NO node rather than with this box (0.131.2).
	NodeAliases []string
	State       string // queued | running | completed | failed
	Error       string
	Requester   string
	CreatedAt   int64
	StartedAt   int64
	CompletedAt int64
	// Remote marks a frame a card relay delivered on behalf of ANOTHER box's process (the member's
	// side of relay.go). Its producer is not a process of this box, so its open-card marker carries
	// no pid and is closed by its terminal frame or the age cap, never by a local pid probe.
	Remote bool
}

Event is one workload lifecycle frame's content. JobID doubles as PAIR's runId so the store key (origin, engine, runId, id) is unique per harness job. Timestamps are epoch milliseconds; StartedAt / CompletedAt 0 = null.

func ParseRelay

func ParseRelay(body []byte, asker string) (Event, error)

ParseRelay is the member's strict decode of one relayed frame sent by asker (already sanitized, non-empty). It accepts exactly the frame the relaying box builds (a JSON-RPC notification whose workloadInfo carries the documented keys) plus the top-level node and node_aliases, refuses anything else, and returns the Event the member's own emitter posts: id namespaced per asker, requester rewritten, node hint carried for the member's resolver. originatedFrom and scheduledOn in the body are checked for shape and then ignored: the member's emitter stamps its own identity and resolves the node itself.

type ModeInfo

type ModeInfo struct {
	// Mode is one of ModeLocal, ModeNodeInfo, ModeRelay, ModeOff.
	Mode string `json:"mode"`
	// Relay is the route URL frames go to, in relay mode.
	Relay string `json:"relay,omitempty"`
	// Reason says why the emitter is off.
	Reason string `json:"reason,omitempty"`
}

Mode is what an emitter's frames currently do.

func ModeFor

func ModeFor(cfg config.Config) ModeInfo

ModeFor is the mode of the emitter a box with this config reports through (Emitter.Mode), read from the same per-config cached emitter WireHeadersFor asks, so a status call does not re-probe the relay members' health on every call: the probes cost once per process, then once per verdict TTL in the background.

type RelayConfig

type RelayConfig struct {
	// Bases are explicit member fleet-serve base URLs (pair_workloads_relay entries).
	Bases []string
	// Auto adds every delegate_remotes base whose /fleet/health advertises `pair_relay`.
	Auto bool
	// Remotes are the delegate_remotes bases Auto considers.
	Remotes []string
	// Token is the fleet bearer the member's route requires.
	Token string
}

RelayConfig is the relaying side's configuration (FromConfig builds it from `pair_workloads_relay` and `delegate_remotes`). The zero value is no relay.

func RelayFromConfig

func RelayFromConfig(cfg config.Config) RelayConfig

RelayFromConfig reads `pair_workloads_relay`: absent or empty is auto, "auto" is auto, "off" turns the relay off, and any other entry is an explicit member base URL (a box with no delegate_remotes sets this by hand). "off" wins over every other entry.

type RelayError

type RelayError struct{ Msg string }

RelayError is a relayed frame the member refuses: a 400 with Msg.

func (*RelayError) Error

func (e *RelayError) Error() string

type RelayLimiter

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

RelayLimiter is the member's token bucket: one per asker name, and one over every asker, because the asker name is a header a token holder chooses (a fresh name per call would otherwise be a fresh bucket per call).

func DefaultRelayLimiter

func DefaultRelayLimiter() *RelayLimiter

DefaultRelayLimiter is the member's production limit: 5 frames/s per asker (burst 60), 50/s overall (burst 200). A job is two or three frames, so a busy box stays well inside it.

func NewRelayLimiter

func NewRelayLimiter(rate float64, burst int, gRate float64, gBurst int) *RelayLimiter

NewRelayLimiter builds a limiter: rate frames per second per asker with a burst, and a global rate and burst over all askers together.

func (*RelayLimiter) Admit

func (l *RelayLimiter) Admit(asker, jobID, state string) CardAdmission

Admit is AdmitCard with the reason a frame is not admitted: CardCapped (over the open-card cap) or CardStale (an in-flight frame of a card its terminal frame already closed, see closed).

func (*RelayLimiter) AdmitCard

func (l *RelayLimiter) AdmitCard(asker, jobID, state string) bool

AdmitCard accounts one relayed frame against the open-card caps and reports whether the member may post it. A terminal frame closes its card and is always admitted (refusing it would strand the card it ends). A non-terminal frame of a card already open only refreshes it; one that would open a NEW card is refused once the asker, or the member as a whole, holds its cap of open cards. An entry ages out after RelayOpenMaxAge, the same age at which the member's sweep closes its marker, so the count and the register agree; a member restart empties the count, and the markers it leaves are the sweep's.

func (*RelayLimiter) Allow

func (l *RelayLimiter) Allow(asker string) (bool, time.Duration)

Allow spends one token of asker's bucket and of the global one. A refusal says how long to wait.

func (*RelayLimiter) OpenCards

func (l *RelayLimiter) OpenCards(asker string) int

OpenCards is how many relayed cards the limiter counts as open for asker ("" = every asker).

func (*RelayLimiter) SetOpenCaps

func (l *RelayLimiter) SetOpenCaps(perAsker, global int)

SetOpenCaps replaces the open-card caps (a value <= 0 leaves that cap as it was).

type RemoteCall

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

RemoteCall implements core.RemoteAttribution.

func NewRemoteCall

func NewRemoteCall(e *Emitter, led *ledger.Ledger, req core.Request, route string) *RemoteCall

NewRemoteCall begins attributing a remote call of req. e and led may each be nil (no PAIR card, no ledger row). route is the normalized route the caller asked for.

func (*RemoteCall) Bounce

func (c *RemoteCall) Bounce(res core.Result)

Bounce closes the card of an attempt a node took and handed back (it answered "another job holds my card", or that it could not take its lease) and arms the handle for the next node. The card closes quiet (completed, never started, the reason in `error`) WHATEVER the answer's err_class, because what decides is that nothing ran on that node, not why: a class that is not core.CardHeld (gpu_lease_unavailable) bounces the same way, and a call that a second node then serves must not show the first node's card red. It carries no ledger row: a call is one row, written by its Finish with the node that served it. The next Dispatched opens a new card (PAIR keys a card on its job id, and the next attempt carries a fresh one). Before a dispatch, or once the call has ended, it does nothing.

func (*RemoteCall) Discard

func (c *RemoteCall) Discard(reason string)

Discard ends an attempt that is not the final answer (the auto route fell back to a local run). An attempt that never reached a node writes nothing; one that did is finished as a deferred call.

func (*RemoteCall) Dispatched

func (c *RemoteCall) Dispatched(base, nodeID, fleetJobID string)

Dispatched opens the call's card, queued, on the node named by the dispatch URL (Event.Node) and the fleet node id its health reported (an alias). Only the first call counts.

func (*RemoteCall) Finish

func (c *RemoteCall) Finish(res core.Result)

Finish ends the call: one terminal frame when a node was chosen, and always one asker ledger row.

func (*RemoteCall) Ran

func (c *RemoteCall) Ran(base, nodeID, fleetJobID string)

Ran names the node the call ran on and the job it carried WITHOUT opening a card (core.NodeNamer): the row Finish writes then carries node, node_id and fleet_job_id as a dispatched call's does. It is for the adopter of a ticket whose owner ended, which never dispatches because the card is already open. A call that was dispatched keeps the node it was dispatched to, and one that has ended is left alone.

func (*RemoteCall) Running

func (c *RemoteCall) Running()

Running turns the card running, once, when the node reports the job started.

type SeatWatcher

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

SeatWatcher polls this box's vLLM seats and reports direct traffic to PAIR.

func NewSeatWatcher

func NewSeatWatcher(em *Emitter, cfg config.Config) *SeatWatcher

NewSeatWatcher builds a watcher over the llama-swap cfg.Endpoint names.

func (*SeatWatcher) Poll

func (w *SeatWatcher) Poll(ctx context.Context)

Poll reads the seats once and emits whatever changed.

func (*SeatWatcher) Run

func (w *SeatWatcher) Run(ctx context.Context)

Run polls until ctx ends, then closes every open card and waits for the frames to leave. It returns at once when the emitter is disabled.

Jump to

Keyboard shortcuts

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