Class SpendCap
CostLedger keeps the accounts: subscribed to the dispatcher's events, it
prices every model call a finished job made from the catalog, per workflow, per model and
per call. Registered as the spend gate, it is also the check every job passes before it
starts. The check works on reservations - the input of the job's model calls plus the
output its declaration allows, priced - and a job is refused when the workflow's spend,
plus what its running jobs have reserved, plus this job's reservation would pass the cap.
Counting what is in flight is what keeps a burst of jobs from slipping past the cap
before the first is priced. The refused job never sends a request, and nothing already
running is stopped.
A cap is in one currency and nothing is ever converted: a job whose model is priced in a currency the workflow has no cap for is refused, and so is one whose model has no price at all - a spend nobody can state cannot be admitted.
- Since:
- 0.1 (2026-09-27)
- Author:
- Andrey Santrosyan
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SpendCap
public SpendCap()
-
-
Method Details
-
main
-