The model batches are isolated with a deadline, so a Kill or a hang ends them
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
c63f348dc9
commit
b73a0fc2cb
6 files changed
+54
-9
No files matched your search
+13
-2
@@ -216,10 +216,21 @@ TASK: ModelTask[ExtractResult] = ModelTask(
|
||||
)
|
||||
|
||||
|
||||
@job(f"{TASK.kind}_batch", "Extracting a batch", resource="llm")
|
||||
# One call is bounded at AgentConfig.timeout (300s by default), and a batch
|
||||
# is one call, plus a few short ones when a refusal halves it down
|
||||
# (desk/modeltask.py `_narrow`). A batch of 20 still running after 30
|
||||
# minutes is stuck, not slow.
|
||||
@job(f"{TASK.kind}_batch", "Extracting a batch", resource="llm",
|
||||
isolate=True, timeout=1800)
|
||||
def run_batch(config: Config, store: Store, *, context: RunContext = NULL,
|
||||
uids: list[str] | None = None) -> dict[str, Any]:
|
||||
"""One model call over one batch of the roles that were waiting."""
|
||||
"""One model call over one batch of the roles that were waiting.
|
||||
|
||||
Isolated so a Kill lands even while the call itself is in flight: `one`
|
||||
only checks between calls, and a hung request — the CLI backend spawns a
|
||||
process of its own, the API one blocks on a socket — has no such gap for
|
||||
a thread to be ended at.
|
||||
"""
|
||||
return modeltask.one(TASK, config, store, uids or [], context=context).model_dump()
|
||||
|
||||
|
||||
|
||||
+12
-2
@@ -177,11 +177,21 @@ TASK: ModelTask[SummariseResult] = ModelTask(
|
||||
)
|
||||
|
||||
|
||||
@job(f"{TASK.kind}_batch", "Summarising a batch", resource="llm")
|
||||
# One call is bounded at AgentConfig.timeout (300s by default), and a batch
|
||||
# is one call, plus a few short ones when a refusal halves it down
|
||||
# (desk/modeltask.py `_narrow`). A batch of 10 still running after 15
|
||||
# minutes is stuck, not slow.
|
||||
@job(f"{TASK.kind}_batch", "Summarising a batch", resource="llm",
|
||||
isolate=True, timeout=900)
|
||||
def run_batch(config: Config, store: Store, *, context: RunContext = NULL,
|
||||
uids: list[str] | None = None) -> dict[str, Any]:
|
||||
"""One model call over one batch. Queued by the task's finder, or with
|
||||
one uid by the read page's Summarise button."""
|
||||
one uid by the read page's Summarise button.
|
||||
|
||||
Isolated for the same reason as `extract.run_batch`: a Kill only reaches
|
||||
`one` between calls, and a call that hangs — on either backend — is
|
||||
otherwise unkillable short of restarting the server.
|
||||
"""
|
||||
return modeltask.one(TASK, config, store, uids or [], context=context).model_dump()
|
||||
|
||||
|
||||
|
||||
@@ -213,14 +213,15 @@
|
||||
fresh.slice(0, MAX_ON_LOAD).forEach((n) => show(fromNotice(n)));
|
||||
if (fresh.length > MAX_ON_LOAD) {
|
||||
toast.info(`${fresh.length - MAX_ON_LOAD} more messages since your last visit.`,
|
||||
{ link: { label: "all messages", href: "/messages" } });
|
||||
{ link: { label: "all messages", href: "/settings/sources#messages" } });
|
||||
}
|
||||
if (fresh.length) markSeen(fresh[0].last_at);
|
||||
}
|
||||
|
||||
document.addEventListener("app:notice", (e) => onNotice(e.detail));
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// Not on Messages: the table is right there, in full, already.
|
||||
if (location.pathname !== "/login" && location.pathname !== "/messages") missed();
|
||||
// Not on Sources: the messages table is right there, in full, already.
|
||||
// `/messages` itself only redirects now, so the browser never lands there.
|
||||
if (location.pathname !== "/login" && location.pathname !== "/settings/sources") missed();
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user