Skip to content

Commit

Permalink
Tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Nov 28, 2024
1 parent ab98617 commit 6c0c4a0
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 64 deletions.
7 changes: 5 additions & 2 deletions src/Serval/src/Serval.Shared/Models/CorpusFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public record CorpusFile

private string? _filename;

public async Task<string> PopulateFilenameAsync(
public async Task PopulateFilenameAsync(
IRequestClient<GetDataFile> getDataFileClient,
string owner,
CancellationToken cancellationToken
Expand All @@ -22,7 +22,10 @@ CancellationToken cancellationToken
{
_filename = result.Message.Filename;
}
throw new InvalidOperationException($"The data file {Id} cannot be found.");
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,6 @@ CancellationToken cancellationToken
/// <param name="corpusId">The corpus id or parallel corpus id</param>
/// <param name="textId">The text id</param>
/// <param name="textOrigin">The source[s] of the data to populate the USFM file with.</param>
/// <param name="getDataFileClient">The data file client</param>
/// <param name="cancellationToken"></param>
/// <response code="200">The book in USFM format</response>
/// <response code="204">The specified book does not exist in the source or target corpus.</response>
Expand All @@ -879,13 +878,11 @@ public async Task<IActionResult> GetPretranslatedUsfmAsync(
[NotNull] string textId,
[FromQuery(Name = "text-origin")] PretranslationUsfmTextOrigin? textOrigin,
[FromQuery] PretranslationUsfmTemplate? template,
[FromServices] IRequestClient<GetDataFile> getDataFileClient,
CancellationToken cancellationToken
)
{
Engine engine = await _engineService.GetAsync(id, cancellationToken);
await AuthorizeAsync(engine);
await engine.PopulateFilenamesAsync(getDataFileClient, cancellationToken);
if (!engine.Corpora.Any(c => c.Id == corpusId) && !engine.ParallelCorpora.Any(c => c.Id == corpusId))
return NotFound();
if (engine.ModelRevision == 0)
Expand Down Expand Up @@ -1034,7 +1031,6 @@ CancellationToken cancellationToken
/// </remarks>
/// <param name="id">The translation engine id</param>
/// <param name="buildConfig">The build config (see remarks)</param>
/// <param name="getDataFileClient">The data file client</param>
/// <param name="cancellationToken"></param>
/// <response code="201">The new build job</response>
/// <response code="400">The build configuration was invalid.</response>
Expand All @@ -1055,15 +1051,13 @@ CancellationToken cancellationToken
public async Task<ActionResult<TranslationBuildDto>> StartBuildAsync(
[NotNull] string id,
[FromBody] TranslationBuildConfigDto buildConfig,
[FromServices] IRequestClient<GetDataFile> getDataFileClient,
CancellationToken cancellationToken
)
{
string deploymentVersion = _configuration.GetValue<string>("deploymentVersion") ?? "Unknown";

Engine engine = await _engineService.GetAsync(id, cancellationToken);
await AuthorizeAsync(engine);
await engine.PopulateFilenamesAsync(getDataFileClient, cancellationToken);
Build build = Map(engine, buildConfig, deploymentVersion);

await _engineService.StartBuildAsync(build, cancellationToken);
Expand Down
3 changes: 3 additions & 0 deletions src/Serval/src/Serval.Translation/Models/ParallelCorpus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ CancellationToken cancellationToken
await Task.WhenAll(
SourceCorpora.Select(corpus => corpus.PopulateFilenamesAsync(getDataFileClient, owner, cancellationToken))
);
await Task.WhenAll(
TargetCorpora.Select(corpus => corpus.PopulateFilenamesAsync(getDataFileClient, owner, cancellationToken))
);
}
}
5 changes: 4 additions & 1 deletion src/Serval/src/Serval.Translation/Services/EngineService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class EngineService(
IOptionsMonitor<DataFileOptions> dataFileOptions,
IDataAccessContext dataAccessContext,
ILoggerFactory loggerFactory,
IScriptureDataFileService scriptureDataFileService
IScriptureDataFileService scriptureDataFileService,
IRequestClient<GetDataFile> getDataFileClient
) : OwnedEntityServiceBase<Engine>(engines), IEngineService
{
private readonly IRepository<Build> _builds = builds;
Expand All @@ -23,6 +24,7 @@ IScriptureDataFileService scriptureDataFileService
private readonly IDataAccessContext _dataAccessContext = dataAccessContext;
private readonly ILogger<EngineService> _logger = loggerFactory.CreateLogger<EngineService>();
private readonly IScriptureDataFileService _scriptureDataFileService = scriptureDataFileService;
private readonly IRequestClient<GetDataFile> _getDataFileClient = getDataFileClient;

public async Task<Models.TranslationResult> TranslateAsync(
string engineId,
Expand Down Expand Up @@ -217,6 +219,7 @@ private Dictionary<string, List<int>> GetChapters(string fileLocation, string sc
public async Task StartBuildAsync(Build build, CancellationToken cancellationToken = default)
{
Engine engine = await GetAsync(build.EngineRef, cancellationToken);
await engine.PopulateFilenamesAsync(_getDataFileClient, cancellationToken);
await _builds.InsertAsync(build, cancellationToken);

TranslationEngineApi.TranslationEngineApiClient client =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ namespace Serval.Translation.Services;
public class PretranslationService(
IRepository<Pretranslation> pretranslations,
IRepository<Engine> engines,
IScriptureDataFileService scriptureDataFileService
IScriptureDataFileService scriptureDataFileService,
IRequestClient<GetDataFile> getDataFileClient
) : EntityServiceBase<Pretranslation>(pretranslations), IPretranslationService
{
private readonly IRepository<Engine> _engines = engines;
private readonly IScriptureDataFileService _scriptureDataFileService = scriptureDataFileService;
private readonly IRequestClient<GetDataFile> _getDataFileClient = getDataFileClient;

public async Task<IEnumerable<Pretranslation>> GetAllAsync(
string engineId,
Expand Down Expand Up @@ -40,6 +42,7 @@ public async Task<string> GetUsfmAsync(
)
{
Engine? engine = await _engines.GetAsync(engineId, cancellationToken);
await engine!.PopulateFilenamesAsync(_getDataFileClient, cancellationToken);
Corpus? corpus = engine?.Corpora.SingleOrDefault(c => c.Id == corpusId);
ParallelCorpus? parallelCorpus = engine?.ParallelCorpora.SingleOrDefault(c => c.Id == corpusId);

Expand Down
Loading

0 comments on commit 6c0c4a0

Please sign in to comment.