-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b9c983
commit 84a9c72
Showing
14 changed files
with
202 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
"hmac", | ||
"HMACSHA", | ||
"inferencing", | ||
"Initializable", | ||
"keyterms", | ||
"MATSRC", | ||
"MATTRG", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/Serval/src/Serval.WordAlignment/Consumers/CorpusUpdatedConsumer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace Serval.WordAlignment.Consumers; | ||
|
||
public class CorpusUpdatedConsumer(IEngineService engineService) : IConsumer<CorpusUpdated> | ||
{ | ||
private readonly IEngineService _engineService = engineService; | ||
|
||
public async Task Consume(ConsumeContext<CorpusUpdated> context) | ||
{ | ||
await _engineService.UpdateCorpusFilesAsync( | ||
context.Message.CorpusId, | ||
context.Message.Files.Select(Map).ToList(), | ||
context.CancellationToken | ||
); | ||
} | ||
|
||
private static CorpusFile Map(CorpusFileResult corpusFile) | ||
{ | ||
return new CorpusFile | ||
{ | ||
Id = corpusFile.File.DataFileId, | ||
TextId = corpusFile.TextId ?? corpusFile.File.Name, | ||
Filename = corpusFile.File.Filename, | ||
Format = corpusFile.File.Format, | ||
}; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Serval/src/Serval.WordAlignment/Consumers/DataFileUpdatedConsumer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Serval.WordAlignment.Consumers; | ||
|
||
public class DataFileUpdatedConsumer(IEngineService engineService) : IConsumer<DataFileUpdated> | ||
{ | ||
private readonly IEngineService _engineService = engineService; | ||
|
||
public async Task Consume(ConsumeContext<DataFileUpdated> context) | ||
{ | ||
await _engineService.UpdateDataFileFilenameFilesAsync( | ||
context.Message.DataFileId, | ||
context.Message.Filename, | ||
context.CancellationToken | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/Serval/src/Serval.WordAlignment/Services/BuildCleanupService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Serval.WordAlignment.Services; | ||
|
||
public class BuildCleanupService( | ||
IServiceProvider services, | ||
ILogger<BuildCleanupService> logger, | ||
TimeSpan? timeout = null | ||
) : UninitializedCleanupService<Build>(services, logger, timeout) { } |
7 changes: 7 additions & 0 deletions
7
src/Serval/src/Serval.WordAlignment/Services/EngineCleanupService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Serval.WordAlignment.Services; | ||
|
||
public class EngineCleanupService( | ||
IServiceProvider services, | ||
ILogger<EngineCleanupService> logger, | ||
TimeSpan? timeout = null | ||
) : UninitializedCleanupService<Engine>(services, logger, timeout) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.