Files
Chronos/src/Titano.Protocol/Jobs.cs
T
Claude 1e255fb075 fix(render-node): match job sizes per encoder; blank batch entries name no preset
A node announced one size limit, the largest of all its encoders (managed
MJPEG at 65535 px), so it claimed H.264 jobs larger than its H.264 encoder
takes. Each offered encoder now carries its own limit and the server matches
codec and size per encoder; the node-wide limit is the largest offered one,
for encoders that announce none. A hand-written batch with null or blank
entries no longer throws when a job is posted or examined.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-03 09:39:17 +00:00

68 lines
3.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace Titano.Protocol;
public sealed record JobDto(
Guid Id,
string Kind,
IReadOnlyList<Guid> TargetIds,
string? TargetLabel,
string State,
string Priority,
long ProgressDone,
long ProgressTotal,
double? ItemsPerSecond,
double? EtaSeconds,
string? LogTail,
string? NodeId,
int Attempts,
string? Error,
DateTimeOffset Created,
DateTimeOffset? Started,
DateTimeOffset? Finished);
/// <summary><c>POST /api/v1/jobs</c>: kind = render, deep-analyse, proxies, thumbs, verify, scan, rebuild, maintenance…</summary>
public sealed record CreateJobRequest(string Kind, IReadOnlyList<Guid> Target, string? ParametersJson);
/// <summary>
/// <c>POST /api/v1/nodes/register</c>: a client offers its GPU encoders (BRIEF §14.7). <see cref="MaxWidth"/> ×
/// <see cref="MaxHeight"/> is the largest output of any of them, for encoders that announce no limit of their own.
/// </summary>
public sealed record RegisterNodeRequest(string ClientName, IReadOnlyList<NodeEncoder> Encoders, int MaxWidth, int MaxHeight);
/// <summary>
/// One encoder of a render node. <see cref="MaxWidth"/> × <see cref="MaxHeight"/> is its largest output (0 = not announced:
/// the node's own limit applies), so jobs go only to a node with an encoder of their codec that takes their size.
/// </summary>
public sealed record NodeEncoder(string Codec, string Name, bool Hardware, bool TenBit, int MaxWidth = 0, int MaxHeight = 0);
public sealed record RenderNodeDto(Guid Id, string ClientName, string Username, IReadOnlyList<NodeEncoder> Encoders, DateTimeOffset LastHeartbeat, string State);
/// <summary><c>POST /api/v1/nodes/{id}/claim</c>: the job and everything needed to run it, or 204 when none matches.</summary>
public sealed record ClaimedJob(JobDto Job, Guid SequenceId, string SettingsJson, string PresetJson, bool UseProxies, IReadOnlyList<ManifestFrame> Frames);
/// <summary><c>POST /api/v1/nodes/{id}/jobs/{jobId}/progress</c>.</summary>
public sealed record NodeProgress(long Done, long Total, double? ItemsPerSecond, string? LogLine);
/// <summary><c>POST /api/v1/jobs/{id}/priority</c>: background, normal or user.</summary>
public sealed record JobPriorityRequest(string Priority);
/// <summary>
/// <c>parametersJson</c> of a render job: what to encode. Render nodes claim the job when they have an encoder for
/// <see cref="Codec"/> at <see cref="Width"/> × <see cref="Height"/> (BRIEF §14.7).
/// </summary>
public sealed record RenderJobParameters(string PresetName, string PresetJson, string Codec, int Width, int Height, bool UseProxies, string? SettingsJson);
/// <summary><c>POST /api/v1/nodes/{id}/jobs/{jobId}/result</c>: the finished output a node is about to upload in chunks.</summary>
public sealed record RenderResultRequest(
string FileName,
long Size,
string Sha256,
string PresetName,
string? Codec,
int Width,
int Height,
double Fps,
double DurationSeconds);
/// <summary><c>POST /api/v1/nodes/{id}/jobs/{jobId}/failed</c>: the node could not render the job.</summary>
public sealed record NodeJobFailure(string Error);