Skip to content

Commit

Permalink
Remove filename from corpus data structure
Browse files Browse the repository at this point in the history
Repopulate filename when building and creating USFM files
  • Loading branch information
johnml1135 committed Nov 28, 2024
1 parent 03e4716 commit ede3bb6
Show file tree
Hide file tree
Showing 31 changed files with 292 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,6 @@ CancellationToken cancellationToken
new CorpusFile
{
Id = fileConfig.FileId,
Filename = result.Message.Filename,
TextId = fileConfig.TextId ?? result.Message.Name,
Format = result.Message.Format
}
Expand Down
9 changes: 0 additions & 9 deletions src/Serval/src/Serval.Assessment/Models/CorpusFile.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Serval/src/Serval.Assessment/Services/EngineService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,13 @@ private V1.Corpus Map(Models.Corpus source)
return new V1.Corpus { Language = source.Language, Files = { source.Files.Select(Map) } };
}

private V1.CorpusFile Map(Models.CorpusFile source)
private V1.CorpusFile Map(Shared.Models.CorpusFile source)
{
return new V1.CorpusFile
{
TextId = source.TextId,
Format = (V1.FileFormat)source.Format,
Location = Path.Combine(_dataFileOptions.CurrentValue.FilesDirectory, source.Filename)
Location = Path.Combine(_dataFileOptions.CurrentValue.FilesDirectory, source.GetFilename())
};
}
}
31 changes: 26 additions & 5 deletions src/Serval/src/Serval.Client/Client.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9293,15 +9293,15 @@ public partial class CorpusFile
{
[Newtonsoft.Json.JsonProperty("file", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required]
public DataFile File { get; set; } = new DataFile();
public DataFileReference File { get; set; } = new DataFileReference();

[Newtonsoft.Json.JsonProperty("textId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string? TextId { get; set; } = default!;

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class DataFile
public partial class DataFileReference
{
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
Expand All @@ -9319,9 +9319,6 @@ public partial class DataFile
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public FileFormat Format { get; set; } = default!;

[Newtonsoft.Json.JsonProperty("revision", Required = Newtonsoft.Json.Required.Always)]
public int Revision { get; set; } = default!;

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
Expand Down Expand Up @@ -9364,6 +9361,30 @@ public partial class CorpusFileConfig

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class DataFile
{
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Id { get; set; } = default!;

[Newtonsoft.Json.JsonProperty("url", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Url { get; set; } = default!;

[Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string? Name { get; set; } = default!;

[Newtonsoft.Json.JsonProperty("format", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public FileFormat Format { get; set; } = default!;

[Newtonsoft.Json.JsonProperty("revision", Required = Newtonsoft.Json.Required.Always)]
public int Revision { get; set; } = default!;

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class TranslationEngine
{
Expand Down
11 changes: 3 additions & 8 deletions src/Serval/src/Serval.DataFiles/Consumers/GetCorpusConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@ await context.RespondAsync(
Name = corpus.Name,
Language = corpus.Language,
Files = corpus
.Files.Select(f => new CorpusFileResult
.Files.Select(f => new Shared.Models.CorpusFile
{
Id = f.FileReference.Id,
TextId = f.TextId!,
File = new DataFileResult
{
DataFileId = f.File.Id,
Filename = f.File.Filename,
Format = f.File.Format,
Name = f.File.Name
}
Format = f.FileReference.Format
})
.ToList()
}
Expand Down
2 changes: 1 addition & 1 deletion src/Serval/src/Serval.DataFiles/Contracts/CorpusFileDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace Serval.DataFiles.Contracts;

public record CorpusFileDto
{
public required DataFileDto File { get; init; }
public required DataFileReferenceDto File { get; init; }
public string? TextId { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Serval.DataFiles.Contracts;

public record DataFileReferenceDto
{
public required string Id { get; init; }
public required string Url { get; init; }
public string? Name { get; init; }
public required FileFormat Format { get; init; }
}
25 changes: 17 additions & 8 deletions src/Serval/src/Serval.DataFiles/Controllers/CorporaController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,18 @@ private async Task<Corpus> MapAsync(CorpusConfigDto corpusConfig, string id, Can
};
}

private async Task<IReadOnlyList<CorpusFile>> MapAsync(
private async Task<IReadOnlyList<Models.CorpusFile>> MapAsync(
IReadOnlyList<CorpusFileConfigDto> files,
CancellationToken cancellationToken
)
{
var dataFiles = new List<CorpusFile>();
var dataFiles = new List<Models.CorpusFile>();
foreach (CorpusFileConfigDto file in files)
{
DataFile? dataFile = await _dataFileService.GetAsync(file.FileId, cancellationToken);
if (dataFile == null)
throw new InvalidOperationException($"DataFile with id {file.FileId} does not exist.");
dataFiles.Add(new CorpusFile { File = dataFile, TextId = file.TextId });
dataFiles.Add(new Models.CorpusFile { FileReference = Map(dataFile), TextId = file.TextId });
}
return dataFiles;
}
Expand All @@ -195,20 +195,29 @@ private CorpusDto Map(Corpus source)
};
}

private CorpusFileDto Map(CorpusFile source)
private CorpusFileDto Map(Models.CorpusFile source)
{
return new CorpusFileDto { File = Map(source.File), TextId = source.TextId };
return new CorpusFileDto { File = Map(source.FileReference), TextId = source.TextId };
}

private DataFileDto Map(DataFile source)
private DataFileReferenceDto Map(DataFileReference source)
{
return new DataFileDto
return new DataFileReferenceDto
{
Id = source.Id,
Url = _urlService.GetUrl(Endpoints.GetDataFile, new { id = source.Id }),
Name = source.Name,
Format = source.Format,
Revision = source.Revision
};
}

private static DataFileReference Map(DataFile source)
{
return new DataFileReference
{
Id = source.Id,
Format = source.Format,
Name = source.Name
};
}
}
2 changes: 1 addition & 1 deletion src/Serval/src/Serval.DataFiles/Models/CorpusFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace Serval.DataFiles.Models;

public record CorpusFile
{
public required DataFile File { get; init; }
public required DataFileReference FileReference { get; init; }
public string? TextId { get; init; }
}
8 changes: 8 additions & 0 deletions src/Serval/src/Serval.DataFiles/Models/DataFileReference.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Serval.DataFiles.Models;

public record DataFileReference
{
public string Id { get; set; } = "";
public required string Name { get; init; }
public required FileFormat Format { get; init; }
}
2 changes: 1 addition & 1 deletion src/Serval/src/Serval.DataFiles/Services/CorpusService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public async Task<Corpus> GetAsync(string id, string owner, CancellationToken ca

public async Task<Corpus> UpdateAsync(
string id,
IReadOnlyList<CorpusFile> files,
IReadOnlyList<Models.CorpusFile> files,
CancellationToken cancellationToken = default
)
{
Expand Down
6 changes: 5 additions & 1 deletion src/Serval/src/Serval.DataFiles/Services/ICorpusService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ public interface ICorpusService
Task<Corpus> GetAsync(string id, CancellationToken cancellationToken = default);
Task<Corpus> GetAsync(string id, string owner, CancellationToken cancellationToken = default);
Task<Corpus> CreateAsync(Corpus corpus, CancellationToken cancellationToken = default);
Task<Corpus> UpdateAsync(string id, IReadOnlyList<CorpusFile> files, CancellationToken cancellationToken = default);
Task<Corpus> UpdateAsync(
string id,
IReadOnlyList<Models.CorpusFile> files,
CancellationToken cancellationToken = default
);
Task DeleteAsync(string id, CancellationToken cancellationToken = default);
}
2 changes: 1 addition & 1 deletion src/Serval/src/Serval.Shared/Contracts/CorpusResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ public record CorpusResult
public required string CorpusId { get; init; }
public required string Language { get; init; }
public string? Name { get; init; }
public required IReadOnlyList<CorpusFileResult> Files { get; set; }
public required IReadOnlyList<CorpusFile> Files { get; set; }
}
43 changes: 43 additions & 0 deletions src/Serval/src/Serval.Shared/Models/CorpusFile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
namespace Serval.Shared.Models;

public record CorpusFile
{
public required string Id { get; set; }
public required FileFormat Format { get; set; }
public required string TextId { get; set; }

private string? _filename;

public async Task PopulateFilenameAsync(
IRequestClient<GetDataFile> getDataFileClient,
string owner,
CancellationToken cancellationToken
)
{
Response<DataFileResult, DataFileNotFound> response = await getDataFileClient.GetResponse<
DataFileResult,
DataFileNotFound
>(new GetDataFile { DataFileId = Id, Owner = owner }, cancellationToken);
if (response.Is(out Response<DataFileResult>? result))
{
_filename = result.Message.Filename;
}
else
{
throw new InvalidOperationException($"The data file {Id} cannot be found.");

Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Translation.Services.EngineServiceTests ► StartBuildAsync_MixedSourceAndTarget_ParallelCorpus

Failed test found in: src/Serval/test/Serval.Translation.Tests/TestResults/test-results.trx Error: System.InvalidOperationException : The data file file1 cannot be found.
Raw output
System.InvalidOperationException : The data file file1 cannot be found.
   at Serval.Shared.Models.CorpusFile.PopulateFilenameAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/CorpusFile.cs:line 27
   at Serval.Shared.Models.MonolingualCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/MonolingualCorpus.cs:line 16
   at Serval.Translation.Models.ParallelCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/ParallelCorpus.cs:line 15
   at Serval.Translation.Models.Engine.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Engine.cs:line 28
   at Serval.Translation.Services.EngineService.StartBuildAsync(Build build, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Services/EngineService.cs:line 222
   at Serval.Translation.Services.EngineServiceTests.StartBuildAsync_MixedSourceAndTarget_ParallelCorpus() in /home/runner/work/serval/serval/src/Serval/test/Serval.Translation.Tests/Services/EngineServiceTests.cs:line 1451
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass3_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Translation.Services.EngineServiceTests ► StartBuildAsync_NoFilters_ParallelCorpus

Failed test found in: src/Serval/test/Serval.Translation.Tests/TestResults/test-results.trx Error: System.InvalidOperationException : The data file file1 cannot be found.
Raw output
System.InvalidOperationException : The data file file1 cannot be found.
   at Serval.Shared.Models.CorpusFile.PopulateFilenameAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/CorpusFile.cs:line 27
   at Serval.Shared.Models.MonolingualCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/MonolingualCorpus.cs:line 16
   at Serval.Translation.Models.ParallelCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/ParallelCorpus.cs:line 15
   at Serval.Translation.Models.Engine.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Engine.cs:line 28
   at Serval.Translation.Services.EngineService.StartBuildAsync(Build build, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Services/EngineService.cs:line 222
   at Serval.Translation.Services.EngineServiceTests.StartBuildAsync_NoFilters_ParallelCorpus() in /home/runner/work/serval/serval/src/Serval/test/Serval.Translation.Tests/Services/EngineServiceTests.cs:line 1612
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass3_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Translation.Services.EngineServiceTests ► StartBuildAsync_NoTargetFilter_ParallelCorpus

Failed test found in: src/Serval/test/Serval.Translation.Tests/TestResults/test-results.trx Error: System.InvalidOperationException : The data file file1 cannot be found.
Raw output
System.InvalidOperationException : The data file file1 cannot be found.
   at Serval.Shared.Models.CorpusFile.PopulateFilenameAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/CorpusFile.cs:line 27
   at Serval.Shared.Models.MonolingualCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/MonolingualCorpus.cs:line 16
   at Serval.Translation.Models.ParallelCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/ParallelCorpus.cs:line 15
   at Serval.Translation.Models.Engine.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Engine.cs:line 28
   at Serval.Translation.Services.EngineService.StartBuildAsync(Build build, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Services/EngineService.cs:line 222
   at Serval.Translation.Services.EngineServiceTests.StartBuildAsync_NoTargetFilter_ParallelCorpus() in /home/runner/work/serval/serval/src/Serval/test/Serval.Translation.Tests/Services/EngineServiceTests.cs:line 1807
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass3_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Translation.Services.EngineServiceTests ► StartBuildAsync_OneOfMultipleCorpora

Failed test found in: src/Serval/test/Serval.Translation.Tests/TestResults/test-results.trx Error: System.InvalidOperationException : The data file file1 cannot be found.
Raw output
System.InvalidOperationException : The data file file1 cannot be found.
   at Serval.Shared.Models.CorpusFile.PopulateFilenameAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/CorpusFile.cs:line 27
   at Serval.Translation.Models.Corpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Corpus.cs:line 18
   at Serval.Translation.Models.Engine.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Engine.cs:line 25
   at Serval.Translation.Services.EngineService.StartBuildAsync(Build build, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Services/EngineService.cs:line 222
   at Serval.Translation.Services.EngineServiceTests.StartBuildAsync_OneOfMultipleCorpora() in /home/runner/work/serval/serval/src/Serval/test/Serval.Translation.Tests/Services/EngineServiceTests.cs:line 400
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass3_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Translation.Services.EngineServiceTests ► StartBuildAsync_ParallelCorpus_OneOfMultipleCorpora

Failed test found in: src/Serval/test/Serval.Translation.Tests/TestResults/test-results.trx Error: System.InvalidOperationException : The data file file1 cannot be found.
Raw output
System.InvalidOperationException : The data file file1 cannot be found.
   at Serval.Shared.Models.CorpusFile.PopulateFilenameAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/CorpusFile.cs:line 27
   at Serval.Shared.Models.MonolingualCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/MonolingualCorpus.cs:line 16
   at Serval.Translation.Models.ParallelCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/ParallelCorpus.cs:line 15
   at Serval.Translation.Models.Engine.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Engine.cs:line 28
   at Serval.Translation.Services.EngineService.StartBuildAsync(Build build, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Services/EngineService.cs:line 222
   at Serval.Translation.Services.EngineServiceTests.StartBuildAsync_ParallelCorpus_OneOfMultipleCorpora() in /home/runner/work/serval/serval/src/Serval/test/Serval.Translation.Tests/Services/EngineServiceTests.cs:line 911
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass3_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Translation.Services.EngineServiceTests ► StartBuildAsync_ParallelCorpus_TextFiles

Failed test found in: src/Serval/test/Serval.Translation.Tests/TestResults/test-results.trx Error: System.InvalidOperationException : The data file file1 cannot be found.
Raw output
System.InvalidOperationException : The data file file1 cannot be found.
   at Serval.Shared.Models.CorpusFile.PopulateFilenameAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/CorpusFile.cs:line 27
   at Serval.Shared.Models.MonolingualCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/MonolingualCorpus.cs:line 16
   at Serval.Translation.Models.ParallelCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/ParallelCorpus.cs:line 15
   at Serval.Translation.Models.Engine.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Engine.cs:line 28
   at Serval.Translation.Services.EngineService.StartBuildAsync(Build build, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Services/EngineService.cs:line 222
   at Serval.Translation.Services.EngineServiceTests.StartBuildAsync_ParallelCorpus_TextFiles() in /home/runner/work/serval/serval/src/Serval/test/Serval.Translation.Tests/Services/EngineServiceTests.cs:line 780
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass3_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Translation.Services.EngineServiceTests ► StartBuildAsync_ParallelCorpus_TrainOnOnePretranslateTheOther

Failed test found in: src/Serval/test/Serval.Translation.Tests/TestResults/test-results.trx Error: System.InvalidOperationException : The data file file1 cannot be found.
Raw output
System.InvalidOperationException : The data file file1 cannot be found.
   at Serval.Shared.Models.CorpusFile.PopulateFilenameAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/CorpusFile.cs:line 27
   at Serval.Shared.Models.MonolingualCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/MonolingualCorpus.cs:line 16
   at Serval.Translation.Models.ParallelCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/ParallelCorpus.cs:line 15
   at Serval.Translation.Models.Engine.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Engine.cs:line 28
   at Serval.Translation.Services.EngineService.StartBuildAsync(Build build, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Services/EngineService.cs:line 222
   at Serval.Translation.Services.EngineServiceTests.StartBuildAsync_ParallelCorpus_TrainOnOnePretranslateTheOther() in /home/runner/work/serval/serval/src/Serval/test/Serval.Translation.Tests/Services/EngineServiceTests.cs:line 1011
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass3_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Translation.Services.EngineServiceTests ► StartBuildAsync_ScriptureRange_ParallelCorpus

Failed test found in: src/Serval/test/Serval.Translation.Tests/TestResults/test-results.trx Error: System.InvalidOperationException : The data file file1 cannot be found.
Raw output
System.InvalidOperationException : The data file file1 cannot be found.
   at Serval.Shared.Models.CorpusFile.PopulateFilenameAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/CorpusFile.cs:line 27
   at Serval.Shared.Models.MonolingualCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/MonolingualCorpus.cs:line 16
   at Serval.Translation.Models.ParallelCorpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/ParallelCorpus.cs:line 15
   at Serval.Translation.Models.Engine.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Engine.cs:line 28
   at Serval.Translation.Services.EngineService.StartBuildAsync(Build build, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Services/EngineService.cs:line 222
   at Serval.Translation.Services.EngineServiceTests.StartBuildAsync_ScriptureRange_ParallelCorpus() in /home/runner/work/serval/serval/src/Serval/test/Serval.Translation.Tests/Services/EngineServiceTests.cs:line 1290
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass3_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Translation.Services.EngineServiceTests ► StartBuildAsync_ScriptureRangeEmptyString

Failed test found in: src/Serval/test/Serval.Translation.Tests/TestResults/test-results.trx Error: System.InvalidOperationException : The data file file1 cannot be found.
Raw output
System.InvalidOperationException : The data file file1 cannot be found.
   at Serval.Shared.Models.CorpusFile.PopulateFilenameAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/CorpusFile.cs:line 27
   at Serval.Translation.Models.Corpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Corpus.cs:line 18
   at Serval.Translation.Models.Engine.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Engine.cs:line 25
   at Serval.Translation.Services.EngineService.StartBuildAsync(Build build, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Services/EngineService.cs:line 222
   at Serval.Translation.Services.EngineServiceTests.StartBuildAsync_ScriptureRangeEmptyString() in /home/runner/work/serval/serval/src/Serval/test/Serval.Translation.Tests/Services/EngineServiceTests.cs:line 707
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass3_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.Translation.Services.EngineServiceTests ► StartBuildAsync_ScriptureRangeSpecified

Failed test found in: src/Serval/test/Serval.Translation.Tests/TestResults/test-results.trx Error: System.InvalidOperationException : The data file file1 cannot be found.
Raw output
System.InvalidOperationException : The data file file1 cannot be found.
   at Serval.Shared.Models.CorpusFile.PopulateFilenameAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Shared/Models/CorpusFile.cs:line 27
   at Serval.Translation.Models.Corpus.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, String owner, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Corpus.cs:line 18
   at Serval.Translation.Models.Engine.PopulateFilenamesAsync(IRequestClient`1 getDataFileClient, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Models/Engine.cs:line 25
   at Serval.Translation.Services.EngineService.StartBuildAsync(Build build, CancellationToken cancellationToken) in /home/runner/work/serval/serval/src/Serval/src/Serval.Translation/Services/EngineService.cs:line 222
   at Serval.Translation.Services.EngineServiceTests.StartBuildAsync_ScriptureRangeSpecified() in /home/runner/work/serval/serval/src/Serval/test/Serval.Translation.Tests/Services/EngineServiceTests.cs:line 612
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass3_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()
}
}

public void SetFilename(string filename)
{
_filename = filename;
}

public string GetFilename()
{
return _filename
?? throw new InvalidOperationException(
"The filename has not been populated. It is not stored in the database."
);
}
}
20 changes: 20 additions & 0 deletions src/Serval/src/Serval.Shared/Models/MonolingualCorpus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Serval.Shared.Models;

public record MonolingualCorpus
{
public required string Id { get; set; }
public string? Name { get; set; }
public required string Language { get; set; }
public required IReadOnlyList<CorpusFile> Files { get; set; }

public async Task PopulateFilenamesAsync(
IRequestClient<GetDataFile> getDataFileClient,
string owner,
CancellationToken cancellationToken
)
{
await Task.WhenAll(
Files.Select(file => file.PopulateFilenameAsync(getDataFileClient, owner, cancellationToken))
);
}
}
1 change: 1 addition & 0 deletions src/Serval/src/Serval.Shared/Serval.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.65.0" />
<PackageReference Include="SIL.Machine" Version="3.5.2" Condition="!Exists('..\..\..\..\..\machine\src\SIL.Machine\SIL.Machine.csproj')" />
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="3.5.0" />
<PackageReference Include="MassTransit" Version="8.0.14" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Serval/src/Serval.Shared/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
global using System.Text.Json.Serialization;
global using Grpc.Core;
global using Grpc.Net.ClientFactory;
global using MassTransit;
global using Microsoft.AspNetCore.Authorization;
global using Microsoft.AspNetCore.Http;
global using Microsoft.AspNetCore.Mvc;
Expand All @@ -12,6 +13,7 @@
global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Options;
global using Serval.Shared.Configuration;
global using Serval.Shared.Contracts;
global using Serval.Shared.Models;
global using Serval.Shared.Services;
global using Serval.Shared.Utils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ CancellationToken cancellationToken
}

private async Task<ParallelCorpus> MapAsync(
IRequestClient<GetCorpus> getDataFileClient,
IRequestClient<GetCorpus> getCorpusClient,
string corpusId,
TranslationParallelCorpusConfigDto source,
CancellationToken cancellationToken
Expand All @@ -1229,8 +1229,8 @@ CancellationToken cancellationToken
return new ParallelCorpus
{
Id = corpusId,
SourceCorpora = await MapAsync(getDataFileClient, source.SourceCorpusIds, cancellationToken),
TargetCorpora = await MapAsync(getDataFileClient, source.TargetCorpusIds, cancellationToken)
SourceCorpora = await MapAsync(getCorpusClient, source.SourceCorpusIds, cancellationToken),
TargetCorpora = await MapAsync(getCorpusClient, source.TargetCorpusIds, cancellationToken)
};
}

Expand All @@ -1253,7 +1253,6 @@ CancellationToken cancellationToken
new CorpusFile
{
Id = fileConfig.FileId,
Filename = result.Message.Filename,
TextId = fileConfig.TextId ?? result.Message.Name,
Format = result.Message.Format
}
Expand Down Expand Up @@ -1291,9 +1290,8 @@ CancellationToken cancellationToken
Files = result
.Message.Files.Select(f => new CorpusFile
{
Id = f.File.DataFileId,
Filename = f.File.Filename,
Format = f.File.Format,
Id = f.Id,
Format = f.Format,
TextId = f.TextId
})
.ToList(),
Expand Down
14 changes: 14 additions & 0 deletions src/Serval/src/Serval.Translation/Models/Corpus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,18 @@ public record Corpus
public required string TargetLanguage { get; set; }
public required IReadOnlyList<CorpusFile> SourceFiles { get; set; }
public required IReadOnlyList<CorpusFile> TargetFiles { get; set; }

public async Task PopulateFilenamesAsync(
IRequestClient<GetDataFile> getDataFileClient,
string owner,
CancellationToken cancellationToken
)
{
await Task.WhenAll(
SourceFiles.Select(file => file.PopulateFilenameAsync(getDataFileClient, owner, cancellationToken))
);
await Task.WhenAll(
TargetFiles.Select(file => file.PopulateFilenameAsync(getDataFileClient, owner, cancellationToken))
);
}
}
9 changes: 0 additions & 9 deletions src/Serval/src/Serval.Translation/Models/CorpusFile.cs

This file was deleted.

Loading

0 comments on commit ede3bb6

Please sign in to comment.