symfonic.kernel.deadline¶
deadline ¶
The run's G8 budget, owned by one clock (CXL-6, BP-6).
Its own module because a deadline answers a different question from a teardown
stack. :class:~symfonic.kernel.lifecycle.RunLifecycle decides what a run owns
and in what order it is released; this class knows only how much time is
left, and how to spend a bounded amount of it without the two situations CXL-6
separates — "the backend hung" and "the caller stopped caring" — collapsing
into one exception on the way out.
Two ways to spend the budget are offered, and they are not interchangeable:
- :meth:
scopewraps a whole call in one timeout. It is legal only where one task both enters and leaves the scope — the blocking entry point. - :meth:
boundedwraps one step of forward progress. It is what a streaming entry point uses, because an async generator may be resumed from a different task than the one that suspended it, and a scope spanning that hop cancels a task that never entered it.
Both convert only their own expiry. A TimeoutError the body raised on its
own travels out untouched, which is the same rule pointed the other way.
RunDeadline ¶
One run's remaining time, and the only place it becomes an error.
Source code in src/symfonic/kernel/deadline.py
remaining
property
¶
Seconds left, or None when this run declared no deadline.
Measured from the moment the run began, never from the moment a step began: a budget that restarted on every await would bound one provider call rather than one run.
bounded
async
¶
Await one step of forward progress inside the remaining budget.
Source code in src/symfonic/kernel/deadline.py
expired ¶
Mint — and remember — the error that says this run ran out of time.
Source code in src/symfonic/kernel/deadline.py
owns ¶
True only for the timeout this deadline raised.
Identity, not type: ServiceTimeoutError is also what an adopter's
tool and every inner bounded operation raises, and reporting one of
those as the run's deadline sends the reader to tune a budget nothing
touched.
Source code in src/symfonic/kernel/deadline.py
scope
async
¶
Bound a whole call, translating expiry into an error not a cancel.