feat: single setup, mass-pass progress, per-server homes, Desktop shares its library (owner review 5, v1.1.0) (#68)
CI / Build and test (push) Successful in 11m36s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 12s
Release / Build, test and publish (push) Successful in 14m56s
CI / PostgreSQL 16 integration (push) Successful in 10m11s
CI / PostgreSQL 17 integration (push) Successful in 10m15s
CI / Docker image (push) Successful in 45s
Release / Server image (push) Successful in 4m55s
CI / Build and test (push) Successful in 11m36s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 12s
Release / Build, test and publish (push) Successful in 14m56s
CI / PostgreSQL 16 integration (push) Successful in 10m11s
CI / PostgreSQL 17 integration (push) Successful in 10m15s
CI / Docker image (push) Successful in 45s
Release / Server image (push) Successful in 4m55s
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #68.
This commit is contained in:
1 parent
988068ee8e
commit
20d64af4a4
793 files changed
+23882
-2096
No files matched your search
@@ -28,6 +28,46 @@ namespace Chronos.Data.Processing.Jobs;
|
||||
/// </summary>
|
||||
internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions options, FrameTiers tiers) : IJobHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// A render's progress as the job's (owner review 5, #65): the frames measured first (<see cref="JobStep.Analyse"/>),
|
||||
/// then each output encoded, frame x of y when it is the last one left (the frames of an earlier one are not told
|
||||
/// apart from the next one's), output n of m, then its file hashed (<see cref="JobStep.Verify"/>). The detail carries
|
||||
/// keys and data only; the message keeps the host's own words for the desktop's log line, as before. Shared with the
|
||||
/// workspace's local render.
|
||||
/// </summary>
|
||||
internal sealed class RenderReporter(JobContext context, string title, IReadOnlyList<(int Index, ExportTarget Target)> entries)
|
||||
{
|
||||
private long _start = -1;
|
||||
private int _part;
|
||||
private bool _last;
|
||||
|
||||
private int Parts => entries.Count > 1 ? entries.Count : 0;
|
||||
|
||||
public ValueTask PreparingAsync() => context.ReportAsync(context.Done, context.Total, new JobDetail(JobStep.Analyse, title), context.Message);
|
||||
|
||||
/// <summary>Output <paramref name="index"/> starts: the checkpoint names it, and the detail says which of the outputs it is.</summary>
|
||||
public async ValueTask StartingAsync(int index, string checkpoint)
|
||||
{
|
||||
var at = 0;
|
||||
while (at < entries.Count && entries[at].Index != index) at++;
|
||||
(_part, _last, _start) = (at + 1, at + 1 >= entries.Count, context.Done);
|
||||
await context.ReportAsync(context.Done, context.Total, new JobDetail(JobStep.Encode, title, 0, _last ? Math.Max(0, context.Total - _start) : 0,
|
||||
Parts > 0 ? _part : 0, Parts, Parts > 0 ? JobPartUnit.Render : JobPartUnit.None), at < entries.Count ? entries[at].Target.PresetName : null)
|
||||
.ConfigureAwait(false);
|
||||
await context.CheckpointAsync(checkpoint, context.Done, context.Total).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>The render's own progress: frames measured, then frames encoded (counts only, the output's detail stays).</summary>
|
||||
public ValueTask ReportAsync(long done, long total, string? message) =>
|
||||
_start < 0
|
||||
? context.ReportAsync(done, total, message)
|
||||
: context.ReportItemAsync(done, total, Math.Max(0, done - _start), _last ? Math.Max(0, total - _start) : 0);
|
||||
|
||||
public ValueTask VerifyingAsync(string output) =>
|
||||
context.ReportAsync(context.Done, context.Total, new JobDetail(JobStep.Verify, output, 0, 0, Parts > 0 ? _part : 0, Parts,
|
||||
Parts > 0 ? JobPartUnit.Render : JobPartUnit.None), Loc.L("Export.Job.Verifying"));
|
||||
}
|
||||
|
||||
public JobKind Kind => JobKind.Render;
|
||||
|
||||
public Task RunAsync(JobContext context) => RunAsync(context, (target, _) => target);
|
||||
@@ -83,6 +123,8 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
|
||||
if (targets.Count == 0) return;
|
||||
|
||||
var companions = await GprCompanions.FindAsync(db, archive, frames.Frames, cancellation).ConfigureAwait(false);
|
||||
var reporter = new RenderReporter(context, sequence.DisplayTitle, targets);
|
||||
await reporter.PreparingAsync().ConfigureAwait(false);
|
||||
IReadOnlyList<TargetOutcome> outcomes;
|
||||
await using (var render = new SequenceRender(frames, project, SequenceAnalyser.ReadReport(folder, frames), options, originals: !parameters.UseProxies,
|
||||
companions))
|
||||
@@ -94,7 +136,7 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
|
||||
string? sha = null;
|
||||
if (File.Exists(result.OutputPath))
|
||||
{
|
||||
await context.ReportAsync(context.Done, context.Total, Loc.L("Export.Job.Verifying")).ConfigureAwait(false);
|
||||
await reporter.VerifyingAsync(Path.GetFileName(result.OutputPath)).ConfigureAwait(false);
|
||||
sha = await ContentHash.Sha256Async(result.OutputPath, cancellationToken: CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
var entity = result.ToEntity(sequence.Id, target.PresetName, settingsJson, options.ProducedBy) with
|
||||
@@ -118,14 +160,14 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
|
||||
}
|
||||
|
||||
if (parameters.IsStill)
|
||||
outcomes = [await StillAsync(context, render, targets[0], still, sequence, project.Export, folder, names, done, Record).ConfigureAwait(false)];
|
||||
outcomes = [await StillAsync(context, reporter, render, targets[0], still, sequence, project.Export, folder, names, done, Record).ConfigureAwait(false)];
|
||||
else
|
||||
outcomes = await render.RenderAllAsync(
|
||||
targets,
|
||||
(target, setup) => names.Reserve(taken => ExportNaming.OutputPath(project.Export, folder.Exports, SequenceRender.NameContext(sequence, target, setup), taken)),
|
||||
(index, path) => context.CheckpointAsync(new RenderCheckpoint(done, index, path, sequence.Folder).ToJson(), context.Done, context.Total),
|
||||
(index, path) => reporter.StartingAsync(index, new RenderCheckpoint(done, index, path, sequence.Folder).ToJson()),
|
||||
Record,
|
||||
context.ReportAsync,
|
||||
reporter.ReportAsync,
|
||||
cancellation).ConfigureAwait(false);
|
||||
if (render.StandIns.Count > 0)
|
||||
context.Log(Loc.L("Export.Log.StandIns", string.Join(", ", render.StandIns.Select(i => (i + 1).ToString(Loc.Culture)))));
|
||||
@@ -153,7 +195,7 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
|
||||
/// The still of a still job: frame <paramref name="frame"/> saved through the job's preset under the export's name and
|
||||
/// the frame number (<see cref="SequenceRender.StillPath"/>), checkpointed and recorded like a video's output.
|
||||
/// </summary>
|
||||
private static async Task<TargetOutcome> StillAsync(JobContext context, SequenceRender render, (int Index, ExportTarget Target) entry, int frame,
|
||||
private static async Task<TargetOutcome> StillAsync(JobContext context, RenderReporter reporter, SequenceRender render, (int Index, ExportTarget Target) entry, int frame,
|
||||
Sequence sequence, ExportSettings export, SequencePaths folder, OutputNames names, List<int> done,
|
||||
Func<int, ExportTarget, RenderResult, ValueTask> record)
|
||||
{
|
||||
@@ -164,8 +206,8 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
|
||||
target,
|
||||
frame,
|
||||
setup => names.Reserve(taken => SequenceRender.StillPath(export, folder.Exports, SequenceRender.NameContext(sequence, target, setup), frame, taken)),
|
||||
path => context.CheckpointAsync(new RenderCheckpoint(done, index, path, sequence.Folder).ToJson(), context.Done, context.Total),
|
||||
context.ReportAsync,
|
||||
path => reporter.StartingAsync(index, new RenderCheckpoint(done, index, path, sequence.Folder).ToJson()),
|
||||
reporter.ReportAsync,
|
||||
context.Cancellation).ConfigureAwait(false);
|
||||
await record(index, target, result).ConfigureAwait(false);
|
||||
return new TargetOutcome(target, result, null);
|
||||
|
||||
Reference in new issue
Block a user