wip(processing): analysis and render job handlers, render node client (interrupted)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
30 files changed
+2262
-21
No files matched your search
@@ -0,0 +1,48 @@
|
||||
using Titano.Core.Archiving;
|
||||
using Titano.Core.Codecs.Jpeg;
|
||||
using Titano.Core.Diagnostics.Synthetic;
|
||||
using Titano.Core.Metadata;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Server.Storage;
|
||||
using Titano.Testing;
|
||||
|
||||
namespace Titano.Server.Tests.Storage;
|
||||
|
||||
/// <summary>The production composition: frames committed by the archive engine are light-analysed by the processing handlers.</summary>
|
||||
[Category("processing")]
|
||||
public sealed class ProcessingModuleTests(TestContext context)
|
||||
{
|
||||
[Test]
|
||||
public async Task UploadedFramesAreLightAnalysedAndAdvised()
|
||||
{
|
||||
await using var server = await TestServer.StartAsync(context, services: ArchiveModule.Register);
|
||||
var (editor, _, _) = await server.UserAsync("alberto", "editor");
|
||||
var scene = SyntheticSequence.Create(new SyntheticSequenceOptions { FrameCount = 10, StartEv = 0.5, EndEv = -0.5 });
|
||||
Guid sequenceId = default;
|
||||
for (var i = 0; i < scene.Count; i++)
|
||||
{
|
||||
using var image = scene.Render(i);
|
||||
var exif = ExifWriter.BuildJpegApp1(scene.Metadata[i]);
|
||||
var photo = JpegEncoder.Encode(image, new JpegEncodeOptions { Quality = 90, App1Segments = [exif[4..]] });
|
||||
sequenceId = (await Uploads.UploadAsync(editor, photo, $"IMG_{i + 1:0000}.JPG", sessionKey: "roof")).SequenceId;
|
||||
}
|
||||
|
||||
// The commits queue a light analysis; its handler comes from the processing module.
|
||||
var until = DateTime.UtcNow + TimeSpan.FromSeconds(30);
|
||||
Sequence sequence;
|
||||
while (true)
|
||||
{
|
||||
sequence = (await server.Database.Sequences.GetAsync(sequenceId))!;
|
||||
if (sequence.Status.HasFlag(SequenceStatus.AnalyzedLight) && sequence.FrameCount == scene.Count
|
||||
&& !await server.Database.Jobs.IsQueuedAsync(JobKind.LightAnalyse, sequenceId)) break;
|
||||
Assert.True(DateTime.UtcNow < until, $"not analysed: {sequence.Status}, {sequence.FrameCount} frames");
|
||||
await Task.Delay(100);
|
||||
}
|
||||
var project = ProjectSettings.FromJson(Assert.NotNull(sequence.SettingsJson));
|
||||
Assert.True(project.Timing.Mode.HasAdvice, "timing mode advised");
|
||||
var folder = new ArchivePaths(server.Options.ArchivePath).Sequence(sequence.Folder);
|
||||
Assert.FileExists(folder.ProjectPath);
|
||||
Assert.True(ManifestStore.ReadSequence(folder.ManifestPath).Status.HasFlag(SequenceStatus.AnalyzedLight), "sidecar status");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user