Split the trial judge into units and run them on a resumable worker pool

The tournament of Phase 13 needs many trials to run on more than one thread
and to survive a restart without redoing finished work. The judge was one
monolithic call on one thread, so a restart redid the whole trial.

TrialRunner.Run is now Judge(Variants()): Variants does every engine execution
as a keyed unit in two stages (grid and outside-grid run, then, after the
plateau choice, costed runs, benchmark and look-ahead), and Judge is the old
pure judging code working on runs assembled by key. Both Run overloads keep
their signatures; on one thread the engine is called in the order of today,
and the three golden reports do not move.

The single low-priority worker becomes a pool of N threads (setting
laboratory.workers, default 1, at most one less than the processors, shown in
Impostazioni > Sistema). The Laboratory records each unit in the new
tournament_units table (migration 0016, which also creates tournaments for the
next part of the phase): claimed as running, then done with the gzip of its
run. A resumed trial drops its running units, reloads the done ones and runs
only the rest; a run reloaded from storage gives the same report byte for
byte. Plain trials drop their unit outcomes when they finish or fail. The pool
no longer disposes its queue while a thread may still read it.

refs #122

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-04 13:07:14 +01:00
1 parent e0a438a0b2
commit b564871391
15 files changed
+1233 -115

No files matched your search

+6 -1
View File
@@ -274,7 +274,7 @@ internal static partial class Forms
var model = Anubis.News.NewsModelSettings.All.Any(d => d.Key == key);
var rules = key == Anubis.News.ExternalRules.Setting.Key;
if (key != SettingsStore.Theme.Key && key != SettingsStore.Currency.Key && key != SettingsStore.CentralBankMeetings.Key && key != SettingsStore.TelegramStatus.Key && key != Anubis.Trading.TaxExport.MethodSetting.Key &&
!news && !model && !rules)
key != Anubis.Backtest.LaboratorySettings.Workers.Key && !news && !model && !rules)
{
return Results.Redirect(With(back, "errore", "impostazione"));
}
@@ -324,6 +324,11 @@ internal static partial class Forms
return Results.Redirect(With(back, "errore", refusal));
}
if (key == Anubis.Backtest.LaboratorySettings.Workers.Key && Anubis.Backtest.LaboratorySettings.Workers.Check!(form["valore"].ToString()) is not null)
{
return Results.Redirect(With(back, "errore", "operai"));
}
if (key == SettingsStore.CentralBankMeetings.Key && Anubis.Data.CentralBanks.Check(form["valore"].ToString()) is not null)
{
return Results.Redirect(With(back, "errore", "riunioni"));