Titano: editor, import/archive screens, analysis and render jobs, server sync — in progress #2

Merged
Alby96 merged 86 commits from claude/keen-knuth-uhxv8w into main 2026-10-05 23:55:39 +02:00
4 changed files with 10 additions and 6 deletions
Showing only changes of commit 5e2acc9f60 - Show all commits

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Errors.Analysis.Failed" xml:space="preserve"><value>{0} of {1} sequences could not be analysed; see the job log.</value><comment>long; {0} failed count; {1} total count</comment></data>
<data name="Errors.Analysis.Failed" xml:space="preserve"><value>{0} of {1} sequences could not be analysed; see the job log.</value><comment>long; {0} failed count (2 or more); {1} total count</comment></data>
<data name="Errors.Archive.Open" xml:space="preserve"><value>The archive could not be opened.</value><comment>long</comment></data>
<data name="Errors.Number.Range" xml:space="preserve"><value>Enter a whole number from {0} to {1}.</value></data>
<data name="Errors.Path.Empty" xml:space="preserve"><value>Enter a folder.</value></data>
+3 -2
View File
@@ -220,9 +220,10 @@ public sealed class JobEngine : IAsyncDisposable
{
await RunAsync(job, shutdown).ConfigureAwait(false);
}
catch (Exception ex) when (!shutdown.IsCancellationRequested)
catch (Exception ex)
{
// The job's final state could not be stored; it stays running and is requeued at the next start.
// The job's final state could not be stored (also while stopping): it stays running and is requeued at the
// next start. The worker never faults, so disposing the engine never throws.
Log.Error("jobs", $"{job.Kind} job {job.Id} could not be finished", ex);
}
}
@@ -30,6 +30,7 @@ internal sealed class AnalyseJobHandler(TitanoDatabase db, SequenceAnalyser anal
var total = units.Sum();
var done = Enumerable.Range(0, next).Where(i => !retry.Contains(i)).Sum(i => units[i]);
var failed = new List<int>();
string? failure = null;
int[] order = [.. retry, .. Enumerable.Range(next, targets.Count - next)];
for (var k = 0; k < order.Length; k++)
{
@@ -49,7 +50,8 @@ internal sealed class AnalyseJobHandler(TitanoDatabase db, SequenceAnalyser anal
{
await chain.FlushAsync().ConfigureAwait(false);
Core.Diagnostics.Log.Warning("processing", $"Analysis of sequence {targets[i]} failed", ex);
context.Log(Loc.L("Advisor.Log.Failed", await TitleAsync(targets[i], context.Cancellation).ConfigureAwait(false), ex.Message));
failure = Loc.L("Advisor.Log.Failed", await TitleAsync(targets[i], context.Cancellation).ConfigureAwait(false), ex.Message);
context.Log(failure);
failed.Add(i);
}
done += units[i];
@@ -57,7 +59,8 @@ internal sealed class AnalyseJobHandler(TitanoDatabase db, SequenceAnalyser anal
// Failed targets of an earlier attempt not retried yet stay listed.
await context.CheckpointAsync(Format(next, [.. failed, .. retry.Skip(k + 1)]), done, total).ConfigureAwait(false);
}
if (failed.Count > 0) throw new InvalidOperationException(Loc.L("Errors.Analysis.Failed", failed.Count, targets.Count));
// One failure is the job's error as it was logged; several are counted (the log names each).
if (failed.Count > 0) throw new InvalidOperationException(failed.Count == 1 ? failure : Loc.L("Errors.Analysis.Failed", failed.Count, targets.Count));
}
private async Task<string> TitleAsync(Guid sequenceId, CancellationToken cancellationToken) =>
@@ -127,7 +127,7 @@ public sealed class AnalysisJobTests(TestContext context)
var job = await fx.EnqueueAsync(ProcessingJobs.LightAnalysis([a.Id, b.Id, c.Id]));
var failed = await fx.WaitForAsync(job.Id, JobState.Failed);
Assert.Equal(Loc.L("Errors.Analysis.Failed", 1, 3), failed.Error);
Assert.True(failed.Error!.StartsWith(Loc.L("Advisor.Log.Failed", b.DisplayTitle, string.Empty), StringComparison.Ordinal), failed.Error);
Assert.Equal("3;1", failed.Checkpoint);
Assert.SequenceEqual([true, false, true], await AnalysedAsync(fx, a, b, c));