From cf006d05e7ddce9adc7934cf748e5808850942f4 Mon Sep 17 00:00:00 2001 From: Enkidu93 Date: Mon, 2 Dec 2024 16:14:51 -0500 Subject: [PATCH] Add async suffix to preprocess method --- .../src/EchoTranslationEngine/TranslationEngineServiceV1.cs | 2 +- .../src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs | 2 +- .../Services/IParallelCorpusPreprocessingService.cs | 4 +--- .../Services/ParallelCorpusPreprocessingService.cs | 2 +- .../Services/ParallelCorpusProcessingServiceTests.cs | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Echo/src/EchoTranslationEngine/TranslationEngineServiceV1.cs b/src/Echo/src/EchoTranslationEngine/TranslationEngineServiceV1.cs index 720a0126..3258202a 100644 --- a/src/Echo/src/EchoTranslationEngine/TranslationEngineServiceV1.cs +++ b/src/Echo/src/EchoTranslationEngine/TranslationEngineServiceV1.cs @@ -82,7 +82,7 @@ await client.BuildStartedAsync( try { List pretranslationsRequests = []; - await _parallelCorpusPreprocessingService.Preprocess( + await _parallelCorpusPreprocessingService.PreprocessAsync( request.Corpora.Select(Map).ToList(), row => Task.CompletedTask, (row, corpus) => diff --git a/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs b/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs index 831a6ad0..2d2e06f7 100644 --- a/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs +++ b/src/Machine/src/Serval.Machine.Shared/Services/PreprocessBuildJob.cs @@ -107,7 +107,7 @@ CancellationToken cancellationToken int trainCount = 0; int pretranslateCount = 0; pretranslateWriter.WriteStartArray(); - await _parallelCorpusPreprocessingService.Preprocess( + await _parallelCorpusPreprocessingService.PreprocessAsync( corpora, async row => { diff --git a/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/IParallelCorpusPreprocessingService.cs b/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/IParallelCorpusPreprocessingService.cs index 1be70d5e..5e5fa959 100644 --- a/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/IParallelCorpusPreprocessingService.cs +++ b/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/IParallelCorpusPreprocessingService.cs @@ -1,10 +1,8 @@ -using Nito.AsyncEx; - namespace SIL.ServiceToolkit.Utils; public interface IParallelCorpusPreprocessingService { - Task Preprocess( + Task PreprocessAsync( IReadOnlyList corpora, Func train, Func pretranslate, diff --git a/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs b/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs index 71769985..9d49e45a 100644 --- a/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs +++ b/src/ServiceToolkit/src/SIL.ServiceToolkit/Services/ParallelCorpusPreprocessingService.cs @@ -25,7 +25,7 @@ internal int Seed } } - public async Task Preprocess( + public async Task PreprocessAsync( IReadOnlyList corpora, Func train, Func pretranslate, diff --git a/src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessingServiceTests.cs b/src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessingServiceTests.cs index 033467f4..cdd1884f 100644 --- a/src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessingServiceTests.cs +++ b/src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessingServiceTests.cs @@ -73,7 +73,7 @@ public async Task TestParallelCorpusPreprocessor() ]; int trainCount = 0; int pretranslateCount = 0; - await processor.Preprocess( + await processor.PreprocessAsync( corpora, row => {