Documentation
¶
Overview ¶
Package forecastremote is the CALLER side of the fleet forecast lane: it decides where ONE time-series forecast runs (this box's own forecast seat, or a fleet node's) and drives the wire when the answer is a node. The node side is fleetnode's POST /fleet/forecast. It is textremote's shape, for a forecast payload, with one rule of its own.
The route vocabulary is textremote's:
- local: run in-process, exactly as before the route existed; a box with no forecast model defers as config there, and nothing leaves the box.
- auto (the default of offload_forecast): this box's own seat when it binds a forecast_model AND its card is not lease-blocked. A box that binds no model, or whose card is held, FORWARDS to a fleet node that advertises the lane. This differs from the text, vision and stt lanes, which defer on a model-less box in auto: a forecast needs a torch card, and a box that cannot run one (an NPU board, an AMD or CPU-only machine) reaches the model only through the fleet. A box that has the model but a held card, and no eligible node, still runs local: queued-local beats ineligible-remote, as everywhere. A box with no model and no node defers with the placement reason, never a silent local failure.
- remote: force a fleet node; with none eligible the call DEFERS (defer_class capacity, or config when no remotes are configured at all), never a local run.
A node is eligible only when its health lists "forecast". The node's answer is the full core.Result its own pipeline produced (defers included), stamped with the node id and the placement reason (Meta.Node / Meta.Placement). The series travels inside the job; the caller writes any large result file on ITS box.
Index ¶
Constants ¶
const ( RouteLocal = "local" RouteAuto = "auto" RouteRemote = "remote" )
Route values. RouteLocal is the zero route: an empty route means local.
const Budget = 300 * time.Second
Budget bounds one remote call end to end: a cold seat load on the node (about 20 s), the forecast itself, and room for a queued dispatch. It matches the node's forecast_request_timeout_sec default.
Variables ¶
var HTTPClient = &http.Client{Transport: netguard.SafeTransport(nil), Timeout: Budget, CheckRedirect: rosterprobe.NoRedirect}
HTTPClient is the transport every request uses; tests swap it. It rides netguard.SafeTransport for the same reason the delegator's health client does: the lane may only ever reach loopback or the operator's tailnet (never-cloud, ADR 0001), enforced at dial time.
Functions ¶
func Call ¶
Call runs req on the best eligible fleet node. A placement or wire failure is an error the caller maps to a defer class; the node's own result, including its defers, comes back as the core.Result it produced.
func NormalizeRoute ¶
NormalizeRoute maps the caller's route to one of the three values; ok is false for anything unrecognized. "" is local.
func Run ¶
func Run(ctx context.Context, cfg config.Config, runner Runner, req core.Request, route string) core.Result
Run is THE entry point the MCP handler and the CLI verb share: it applies the route rule above to req and returns the result exactly as the pipeline would, plus Meta.Node / Meta.Placement when the route made a decision. A local run under the local route carries neither.