feat(pool): no machine-wide width - 128 passes per available account
Jorijn: "there is no need to do a global cap anymore, the cap should be 128 per available account". `--concurrency` no longer defaults to 128: the limits are each OAuth account's 128 (and the local login's), every driver's counted, an API seat's own REVIEW_GATES_API_CONCURRENCY, and free memory. `--concurrency N` still caps the machine when given; a value below 1 is a usage error. The dump's args.concurrency is null then. The board's driver settings read `128 per account`, which every driver's `seats` shows as that driver's width, and the `seats` header says a width is that driver's cap. The Scheduler test runs 300 passes on two accounts: 256 at once, 128 each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c28307601b
commit
61ee4602f4
12 changed files with 98 additions and 19 deletions
|
|
@ -294,8 +294,9 @@ inventory unit, against a frozen commit range.)";
|
|||
{"--units", true, "UNITS", "comma-separated unit ids (test only)"},
|
||||
{"--warm", false, "", "test runs only: let one pass per prompt prefix go first, as a full run does"},
|
||||
{"--concurrency", true, "CONCURRENCY",
|
||||
"lens processes in flight at once across all seats (default 128, 2026-10-15; the pool still places each one by seat headroom, launches a pass only when it fits in free "
|
||||
"memory at its environment's measured cost, and gives a pass with the browser a stack of its own)",
|
||||
"a cap on the lens processes in flight on this machine, every driver's counted (default none: each OAuth account takes at most 128 - "
|
||||
"REVIEW_GATES_OAUTH_CONCURRENCY - and an API seat REVIEW_GATES_API_CONCURRENCY; the pool still places each pass by seat headroom, launches it only when it "
|
||||
"fits in free memory at its environment's measured cost, and gives a pass with the browser a stack of its own)",
|
||||
Kind::Int},
|
||||
{"--effort", true, "EFFORT", effort},
|
||||
{"--reads", true, "READS", reads, Kind::Int},
|
||||
|
|
@ -355,7 +356,10 @@ inventory unit, against a frozen commit range.)";
|
|||
if (namesNothing(a.only)) return UsageError(UsageLine(Prog, specs), Prog, std::format("argument --only: names no lens file ({})", Dyn::Repr(*a.only)));
|
||||
if (namesNothing(parsed.Value("units"))) return UsageError(UsageLine(Prog, specs), Prog, std::format("argument --units: names no unit id ({})", Dyn::Repr(*parsed.Value("units"))));
|
||||
a.warm = parsed.Flag("warm");
|
||||
if (const std::optional<std::string> n = parsed.Value("concurrency")) a.concurrency = *Dyn::ParseInt(*n);
|
||||
if (const std::optional<std::string> n = parsed.Value("concurrency")) {
|
||||
a.concurrency = *Dyn::ParseInt(*n);
|
||||
if (*a.concurrency < 1) return UsageError(UsageLine(Prog, specs), Prog, "argument --concurrency: a number from 1 up (leave it out for no cap)");
|
||||
}
|
||||
a.effort = parsed.Value("effort").value_or("");
|
||||
if (a.effort.empty()) a.effort = std::string(Plan::DefaultEffort());
|
||||
a.noReuse = parsed.Flag("no-reuse");
|
||||
|
|
|
|||
|
|
@ -784,7 +784,7 @@ namespace Crafter::Review::Pool {
|
|||
Sleep(std::min(60.0, Number(pauseUntil) - now));
|
||||
continue;
|
||||
}
|
||||
while (!queue.empty() && static_cast<std::int64_t>(running.size()) < o.concurrency && !paused) {
|
||||
while (!queue.empty() && (!o.concurrency || static_cast<std::int64_t>(running.size()) < *o.concurrency) && !paused) {
|
||||
std::vector<Json*> live;
|
||||
for (Slot& slot : running) live.push_back(&slot.job);
|
||||
// Without a board every queued pass waiting for a stack or
|
||||
|
|
@ -820,8 +820,8 @@ namespace Crafter::Review::Pool {
|
|||
if (o.board) {
|
||||
// The board folded, the seats ranked, the admission
|
||||
// checked against every driver's passes and the pick
|
||||
// registered in one locked section; the pool width is
|
||||
// the machine's cap.
|
||||
// registered in one locked section; a pool width, when
|
||||
// given, is the machine's cap.
|
||||
const SeatPool::Board::Placed placed = o.board->Place(*o.seats, o.now(), o.seatConfig, o.apiConfig,
|
||||
[&](const std::vector<Json*>& c, const SeatPool::Others& others) { return choose(c, &others); }, o.concurrency);
|
||||
cands = placed.ranked;
|
||||
|
|
@ -833,7 +833,7 @@ namespace Crafter::Review::Pool {
|
|||
if (full) {
|
||||
if (roomWait.is_null()) roomWait = pauseUntil;
|
||||
RaisePause(o.now() + o.noRoomWait);
|
||||
Log(std::format("pool: {} passes in flight on this machine, the cap is {} - re-checked in {:g} s, {} queued", full, o.concurrency, o.noRoomWait, queue.size()));
|
||||
Log(std::format("pool: {} passes in flight on this machine, the cap is {} - re-checked in {:g} s, {} queued", full, o.concurrency.value_or(0), o.noRoomWait, queue.size()));
|
||||
paused = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ namespace Crafter::Review::Run {
|
|||
{"without", opt(a.without)},
|
||||
{"units", units},
|
||||
{"warm", a.warm},
|
||||
{"concurrency", a.concurrency},
|
||||
{"concurrency", a.concurrency ? Json(*a.concurrency) : Json()},
|
||||
{"effort", a.effort},
|
||||
{"reads", a.reads},
|
||||
{"no_reuse", a.noReuse},
|
||||
|
|
@ -655,7 +655,9 @@ namespace Crafter::Review::Run {
|
|||
{"dump", Basename(dumpPath)},
|
||||
{"scratch", scratch.string()},
|
||||
{"effort", a.effort},
|
||||
{"settings", {{"maxUtil", pc.at("maxUtil")}, {"apiConcurrency", apiCfg.at("concurrency")}, {"lensCostPct", pc.at("lensCostPct")}, {"concurrency", a.concurrency}}}},
|
||||
{"settings", {{"maxUtil", pc.at("maxUtil")}, {"apiConcurrency", apiCfg.at("concurrency")}, {"lensCostPct", pc.at("lensCostPct")},
|
||||
// Shown as the driver's width by every driver's `seats`.
|
||||
{"concurrency", a.concurrency ? Json(*a.concurrency) : Json(std::format("{} per account", Dyn::Str(pc.at("oauthConcurrency"))))}}}},
|
||||
Platform::Now());
|
||||
}
|
||||
const bool openrouter = std::ranges::any_of(seats, [](const Json& s) { return s.at("kind") == "openrouter"; });
|
||||
|
|
|
|||
|
|
@ -1466,7 +1466,9 @@ namespace Crafter::Review::SeatPool {
|
|||
for (auto it = all.begin(); it != all.end(); ++it) {
|
||||
if (it.key() != me) drivers[it.key()] = it.value();
|
||||
}
|
||||
const std::string width = cap ? std::format("; {} in flight on this machine, the cap is {}", TotalInflight(data), *cap) : std::string();
|
||||
const std::int64_t perAccount = Dyn::Has(config, "oauthConcurrency") ? Int(AsDouble(config.at("oauthConcurrency"))) : OauthConcurrency;
|
||||
const std::string width = cap ? std::format("; {} in flight on this machine, the cap is {}", TotalInflight(data), *cap)
|
||||
: std::format("; {} in flight on this machine, at most {} per account", TotalInflight(data), perAccount);
|
||||
if (drivers.empty()) return {std::format("board: {}; no other driver running{}", path.string(), width)};
|
||||
std::vector<std::string> each;
|
||||
for (auto it = drivers.begin(); it != drivers.end(); ++it) {
|
||||
|
|
|
|||
|
|
@ -1009,6 +1009,6 @@ namespace Crafter::Review::Seats {
|
|||
FormatWhen(NumberOr0(Dyn::Get(d, "since")), now, zone), Dyn::Str(Dyn::Has(d, "inflight") ? d.at("inflight") : zero), held));
|
||||
total += static_cast<std::int64_t>(NumberOr0(Dyn::Get(d, "inflight")));
|
||||
}
|
||||
return std::format("drivers ({} in flight on this machine; the width is the machine's cap): {}", total, Dyn::Join(parts, "; "));
|
||||
return std::format("drivers ({} in flight on this machine; a width is that driver's cap): {}", total, Dyn::Join(parts, "; "));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue