feat(jobs): progress detail contract and a 2/s publish throttle
Mass passes need to say what they do now (photo x of y, sequence n of m) without slowing down. This adds the contract and the engine side; handlers and displays follow in their own parcels. - Core: JobDetail (step, item, item x of y, part n of m with unit), JobStep and JobPartUnit appended-only and stored by kebab name; Job.Detail. - Protocol: JobDetailDto, appended as JobDto.Detail, JobProgressEvent.Detail and NodeProgress.Detail, so older peers ignore it and newer ones fall back. - Data: JobContext keeps a detail across reports (ReportAsync with a detail, ReportItemAsync without allocating, CheckpointAsync with a detail) and publishes at most once per ProgressInterval (500 ms on the engine's TimeProvider), at once for the first report, a new step or a completed count; a dropped report costs no allocation or lock, and the persist that falls due publishes what it saves. Persist stays at most every 5 s. JobWire maps steps, units and details; an unknown name reads as none. - Migration 0011 adds jobs.progress_detail (nullable JSON text); an unreadable cell reads as no detail. Lists return it. - Server: ProgressGate (500 ms per job, step-change and completion bypass) shared by the engine host and render nodes; node details are stored and broadcast, an older node without one still works. Refs #65 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
58ed737310
commit
ee9505df22
20 files changed
+968
-63
No files matched your search
@@ -139,6 +139,24 @@ public abstract class MigrationTests(TestContext context) : RepositoryTest(conte
|
||||
Assert.Equal(0L, await session.ScalarAsync<long>("SELECT bytes FROM render_copies WHERE path = $1", ["C:/Videos/b"], Ct));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TheProgressDetailColumnJoinsAnIndexOfTheVideosRelease()
|
||||
{
|
||||
var database = await OpenDatabaseAsync();
|
||||
var all = MigrationRunner.Load(Dialect);
|
||||
Assert.Equal(10, await MigrationRunner.MigrateAsync(database, [.. all.Where(m => m.Version <= 10)], Ct));
|
||||
var id = Guid.CreateVersion7();
|
||||
await using (var session = await database.OpenAsync(Ct))
|
||||
await session.ExecuteAsync("INSERT INTO jobs (id, kind, state, priority, created) VALUES ($1, $2, $3, $4, $5)",
|
||||
[id, (int)JobKind.Verify, (int)JobState.Paused, (int)JobPriority.Normal, DateTimeOffset.UtcNow], Ct);
|
||||
|
||||
Assert.Equal(11, all.Single(m => m.Name == "job_progress_detail").Version);
|
||||
Assert.Equal(all[^1].Version, await MigrationRunner.MigrateAsync(database, Ct));
|
||||
await using var after = await database.OpenAsync(Ct);
|
||||
// No backfill: a job of 1.0 has no detail.
|
||||
Assert.Equal(1L, await after.ScalarAsync<long>("SELECT count(*) FROM jobs WHERE id = $1 AND progress_detail IS NULL", [id], Ct));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AppliesOnlyPendingMigrations()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user