diff --git a/docs/BRIEF.md b/docs/BRIEF.md index ec8fbe1e..bd5b398d 100644 --- a/docs/BRIEF.md +++ b/docs/BRIEF.md @@ -1066,9 +1066,9 @@ more than 64 MiB apart), a second line *Write volume* shows its free space. The tooltip names the volume and its file system (on Linux the mount's type from `/proc/self/mountinfo`, so an Unraid share reads `fuse.shfs`); on such a share without a space path it says the figures are the share's primary storage and to map the share's array -view (`/mnt/user0/`) to `/space`. The server's diagnostics report lists the archive, -the space path and `/data`, each with free space, file system and mount (amended -2026-10-26, R2). +view (`/mnt/user0/`) to `/space` and set `CHRONOS_SPACE_PATH=/space`. The server's +diagnostics report lists the archive, the space path and `/data`, each with free space, +file system and mount (amended 2026-10-26, R2). ### 14.9 Configuration and Docker diff --git a/i18n/en/Admin.resx b/i18n/en/Admin.resx index 6b988608..a0f160dc 100644 --- a/i18n/en/Admin.resx +++ b/i18n/en/Admin.resx @@ -107,7 +107,7 @@ Space of the folder set in CHRONOS_SPACE_PATH, shown instead of the archive's own volume Storage Space of the volume that holds the archive - An Unraid share: these figures are its primary storage, often the cache, not the array the mover fills. Map the share's array view (/mnt/user0/<share>) to /space to see the array. + An Unraid share: these figures are its primary storage, often the cache, not the array the mover fills. Map its array view (/mnt/user0/<share>) to /space and set CHRONOS_SPACE_PATH=/space. frames per day · {0} total · peak {1}long Uploads · last 30 days {0} sequence without proxieslong diff --git a/i18n/it/Admin.it.resx b/i18n/it/Admin.it.resx index ebfabb04..cd7a8be5 100644 --- a/i18n/it/Admin.it.resx +++ b/i18n/it/Admin.it.resx @@ -107,7 +107,7 @@ Spazio della cartella indicata in CHRONOS_SPACE_PATH, mostrato al posto del volume dell'archivio Spazio Spazio del volume che contiene l'archivio - Una condivisione Unraid: questi valori sono il suo storage primario, spesso la cache, non l'array che il mover riempie. Mappa la vista array della condivisione (/mnt/user0/<condivisione>) su /space per vedere l'array. + Una condivisione Unraid: questi valori sono il suo storage primario, spesso la cache, non l'array che il mover riempie. Mappa la sua vista array (/mnt/user0/<condivisione>) su /space e imposta CHRONOS_SPACE_PATH=/space. foto al giorno · totale {0} · picco {1} Caricamenti · ultimi 30 giorni {0} sequenza senza proxy diff --git a/tests/Chronos.Server.Tests/Jobs/RenderNodeTests.cs b/tests/Chronos.Server.Tests/Jobs/RenderNodeTests.cs index 99c69a6f..b700bbed 100644 --- a/tests/Chronos.Server.Tests/Jobs/RenderNodeTests.cs +++ b/tests/Chronos.Server.Tests/Jobs/RenderNodeTests.cs @@ -12,7 +12,7 @@ namespace Chronos.Server.Tests.Jobs; [Category("server")] public sealed class RenderNodeTests(TestContext context) { - private static readonly string HevcJob = JsonSerializer.Serialize( + internal static readonly string HevcJob = JsonSerializer.Serialize( new RenderJobParameters("4K HEVC", """{"codec":"hevc","bitrate":60}""", "hevc", 3840, 2160, UseProxies: false, null), ProtocolJson.Default.RenderJobParameters); [Test] @@ -147,7 +147,7 @@ public sealed class RenderNodeTests(TestContext context) new RenderJobParameters("H.264", """{"preset":{"isAuto":false,"manual":"4k-h264"}}""", "h264", width, height, UseProxies: false, null), ProtocolJson.Default.RenderJobParameters); - private static async Task RegisterAsync(HttpClient client, string name, string codec, int maxWidth) + internal static async Task RegisterAsync(HttpClient client, string name, string codec, int maxWidth) { using var response = await client.PostAsJsonAsync("/api/v1/nodes/register", new RegisterNodeRequest(name, [new NodeEncoder(codec, codec.ToUpperInvariant() + " encoder", true, false)], maxWidth, maxWidth), ProtocolJson.Default.RegisterNodeRequest); diff --git a/tests/Chronos.Server.Tests/Storage/VolumeSpaceTests.cs b/tests/Chronos.Server.Tests/Storage/VolumeSpaceTests.cs index 60ee8f38..b2c30813 100644 --- a/tests/Chronos.Server.Tests/Storage/VolumeSpaceTests.cs +++ b/tests/Chronos.Server.Tests/Storage/VolumeSpaceTests.cs @@ -6,6 +6,7 @@ using Microsoft.Extensions.Logging; using Chronos.Protocol; using Chronos.Server.Configuration; using Chronos.Server.Storage; +using Chronos.Server.Tests.Jobs; using Chronos.Testing; namespace Chronos.Server.Tests.Storage; @@ -251,6 +252,48 @@ public sealed class VolumeSpaceTests(TestContext context) await room.ExpectAsync(HttpStatusCode.OK); } + [Test] + public async Task AFullArchiveVolumeRefusesARenderNodeResultUntilThereIsRoom() + { + await using var server = await TestServer.StartAsync(context, o => o.ChunkSizeBytes = 64 * 1024, s => + { + s.AddSingleton(); + s.AddSingleton(sp => sp.GetRequiredService()); + }); + var volumes = server.Services.GetRequiredService(); + var (editor, _, _) = await server.UserAsync("alberto", "editor", renderNode: true); + var frame = await Uploads.UploadAsync(editor, Uploads.Photo(5000, 73), "IMG_0001.CR3"); + var job = await JobApiTests.CreateAsync(editor, "render", frame.SequenceId, RenderNodeTests.HevcJob); + var node = await RenderNodeTests.RegisterAsync(editor, "studio-pc", "hevc", 8192); + using (var claim = await editor.PostAsync($"/api/v1/nodes/{node.Id}/claim", null)) await claim.ExpectAsync(HttpStatusCode.OK); + + var output = Uploads.Photo(3000, 74); + var request = new RenderResultRequest("Roof - 4K HEVC.mp4", output.Length, Uploads.Sha(output), "4K HEVC", "hevc", 3840, 2160, 25, 120); + using var started = await editor.PostAsJsonAsync($"/api/v1/nodes/{node.Id}/jobs/{job.Id}/result", request, ProtocolJson.Default.RenderResultRequest); + await started.ExpectAsync(HttpStatusCode.Created); + var upload = Assert.NotNull((await started.ReadAsync(ProtocolJson.Default.StartUploadResponse)).UploadId); + using (var put = await Uploads.PutChunkAsync(editor, upload, 0, output)) await put.ExpectAsync(HttpStatusCode.OK); + + // Refused before the commit starts: the upload keeps receiving with its chunks and the node keeps the job. + var complete = $"/api/v1/nodes/{node.Id}/jobs/{job.Id}/result/complete"; + volumes.Set(server.Options.ArchivePath, new VolumeFigures(0, 500 * GB)); + using (var full = await editor.PostAsync(complete, null)) + await full.ExpectErrorAsync(HttpStatusCode.InsufficientStorage, "insufficient_storage"); + Assert.Equal(Chronos.Data.Repositories.UploadState.Receiving, Assert.NotNull(await server.Database.Uploads.FindByJobAsync(job.Id)).State); + Assert.True(server.Services.GetRequiredService().Exists(upload)); + var waiting = await JobApiTests.GetAsync(editor, job.Id); + Assert.Equal(("running", node.Id.ToString()), (waiting.State, waiting.NodeId)); + + volumes.Set(server.Options.ArchivePath, null); + using (var room = await editor.PostAsync(complete, null)) + { + await room.ExpectAsync(HttpStatusCode.OK); + Assert.Equal("studio-pc", (await room.ReadAsync(ProtocolJson.Default.RenderDto)).ProducedBy); + } + Assert.Equal("done", (await JobApiTests.GetAsync(editor, job.Id)).State); + Assert.Equal(Chronos.Data.Repositories.UploadState.Committed, Assert.NotNull(await server.Database.Uploads.FindByJobAsync(job.Id)).State); + } + [Test] public void TheSpacePathComesFromTheFileOrTheEnvironment() {