feat: jobs run one at a time, parallelism per photo and a priority queue
Owner review 1, phase 2 (docs/requests/2026-10-15-owner-review-1.md, R2). Jobs now run one at a time on the desktop and on the server. Parallelism (Settings > Rendering, TITANO_PARALLELISM) is how many photos the running job processes at once: thumbnail and proxy passes draw that many photos together and still write the pack and checkpoints in frame order, decode tiers are probed that many at a time, the deep analysis measures that many frames and a render decodes that many ahead. Wherever originals are developed whole (TIFF, PNG, RAW without a usable preview), fewer run at once within the memory budget, which the running job now has whole; the server's frame window is sized to the host instead of 1 GiB. A new job waits its turn and pausing the running job starts the next one. An optional priority queue gives each job kind a level (renders, imports and downloads high, verifies and proxies low by default): a queued job of a higher level pauses the running one without asking, and that job goes back to the queue with its checkpoint and resumes by itself afterwards. Jobs of the same level, and a job's own follow-ups, never interrupt it. The Jobs screen and the admin panel show the parallelism and the queue; Settings > Rendering and the admin panel's Settings set them, at once. TITANO_WORKERS and the Workers key of server.json still set the parallelism (1 to 64, with a warning at start for the variable). Titano.Tools gains i18n prune, which removed the renamed keys from the 36 machine-translated languages; the new strings are translated in all 38. Found while testing: uploads and imports failed when a pass read the sidecar while they wrote it (atomic writes now retry the rename while a reader holds the file, and never for a read-only one), and taking a lease just released while another process read it failed on Windows (the create now waits for the reader). Five adversarial review rounds checked the phase before this commit. Also updates BRIEF (12.8, 14.6, 14.8, 14.9, 24), DECISIONS, CHANGELOG, ARCHITECTURE, STATUS, the request file and the compose/Unraid templates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
34d03051f5
commit
43b6871cdc
228 files changed
+3535
-793
No files matched your search
@@ -181,34 +181,39 @@ public sealed class SettingsLogicTests
|
||||
var settings = new Titano.App.Infrastructure.AppSettings { Quality = Titano.App.Infrastructure.QualityProfile.Best, Parallelism = 3, MemoryBudgetGb = 6 };
|
||||
var basis = new Titano.Data.Processing.ProcessingOptions();
|
||||
|
||||
// Three jobs at once share the 6 GB: 2 GB each; the user's 3 also caps the decodes and the analysis threads.
|
||||
// One job runs at a time (owner review 1): it has the whole 6 GB, and decodes and measures 3 photos at once.
|
||||
var best = ProcessingTuning.Apply(basis, settings, 64L << 30, 16, @"C:\cache");
|
||||
Assert.Equal((2L << 30, @"C:\cache", 8, 2), (best.FrameWindow.MemoryBudget, best.FrameWindow.SpillDirectory, best.FrameWindow.Ahead, best.FrameWindow.MaxConcurrentLoads));
|
||||
Assert.Equal((6L << 30, @"C:\cache", 8, 3), (best.FrameWindow.MemoryBudget, best.FrameWindow.SpillDirectory, best.FrameWindow.Ahead, best.FrameWindow.MaxConcurrentLoads));
|
||||
Assert.Equal((1024, Titano.Core.Project.FlowQualitySetting.Best), (best.Render.AnalysisLongEdge, best.Render.DefaultFlowQuality));
|
||||
Assert.Equal(int.Min(3, Titano.Core.Analysis.Deep.DeepAnalysisOptions.Default.MaxDegreeOfParallelism), best.DeepAnalysis.MaxDegreeOfParallelism);
|
||||
Assert.Equal(3, best.DeepAnalysis.MaxDegreeOfParallelism);
|
||||
settings.Parallelism = 1;
|
||||
var single = ProcessingTuning.Apply(basis, settings, 64L << 30, 16, @"C:\cache");
|
||||
Assert.Equal((6L << 30, 1, 1), (single.FrameWindow.MemoryBudget, single.FrameWindow.MaxConcurrentLoads, single.DeepAnalysis.MaxDegreeOfParallelism));
|
||||
// A parallelism beyond the read-ahead widens the window, so the decodes have frames to work on.
|
||||
settings.Parallelism = 12;
|
||||
var wide = ProcessingTuning.Apply(basis, settings, 64L << 30, 16, @"C:\cache");
|
||||
Assert.Equal((12, 12, 12), (wide.FrameWindow.Ahead, wide.FrameWindow.MaxConcurrentLoads, wide.DeepAnalysis.MaxDegreeOfParallelism));
|
||||
|
||||
// Auto: a quarter of 32 GB shared by the engine's 8 workers on 16 cores; the jobs keep their own thread counts.
|
||||
// Auto: a quarter of 32 GB, and half the 16 cores at once, with no cap of the analysis threads.
|
||||
settings.Quality = Titano.App.Infrastructure.QualityProfile.Fast;
|
||||
settings.MemoryBudgetGb = null;
|
||||
settings.Parallelism = null;
|
||||
var fast = ProcessingTuning.Apply(basis, settings, 32L << 30, 16, @"C:\cache");
|
||||
Assert.Equal((1L << 30, 4), (fast.FrameWindow.MemoryBudget, fast.FrameWindow.Ahead));
|
||||
Assert.Equal((basis.FrameWindow.MaxConcurrentLoads, basis.DeepAnalysis.MaxDegreeOfParallelism), (fast.FrameWindow.MaxConcurrentLoads, fast.DeepAnalysis.MaxDegreeOfParallelism));
|
||||
Assert.Equal((8L << 30, 8), (fast.FrameWindow.MemoryBudget, fast.FrameWindow.Ahead));
|
||||
Assert.Equal((8, 8), (fast.FrameWindow.MaxConcurrentLoads, fast.DeepAnalysis.MaxDegreeOfParallelism));
|
||||
Assert.Equal((256, Titano.Core.Project.FlowQualitySetting.Draft), (fast.Render.AnalysisLongEdge, fast.Render.DefaultFlowQuality));
|
||||
Assert.Equal(512, ProcessingTuning.PreparationLongEdge(Titano.App.Infrastructure.QualityProfile.Balanced));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParallelismAutoIsTheJobEnginesDefault()
|
||||
public void ParallelismAutoIsHalfTheCores()
|
||||
{
|
||||
// BRIEF §14.6: workers default to half the cores; a 4-core laptop keeps two, so a long render never blocks a scan.
|
||||
// Photos the running job processes at once (owner review 1): half the cores, the archive engine's own default.
|
||||
Assert.Equal(8, ProcessingTuning.ParallelismAuto(16));
|
||||
Assert.Equal(2, ProcessingTuning.ParallelismAuto(4));
|
||||
Assert.Equal(1, ProcessingTuning.ParallelismAuto(1));
|
||||
Assert.Equal(new Titano.Data.Jobs.JobEngineOptions().Workers, ProcessingTuning.ParallelismAuto(Environment.ProcessorCount));
|
||||
Assert.Equal(Titano.Data.Archiving.ArchiveServiceOptions.DefaultParallelism, ProcessingTuning.ParallelismAuto(Environment.ProcessorCount));
|
||||
Assert.Equal(1, new Titano.Data.Jobs.JobEngineOptions().Workers);
|
||||
Assert.Equal(8, ProcessingTuning.Parallelism(new Titano.App.Infrastructure.AppSettings(), 16));
|
||||
Assert.Equal(5, ProcessingTuning.Parallelism(new Titano.App.Infrastructure.AppSettings { Parallelism = 5 }, 16));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user