From d7071ef8393761f0dc37f106e47ebcf55f30eeb8 Mon Sep 17 00:00:00 2001 From: John Lambert Date: Tue, 10 Sep 2024 13:29:08 -0400 Subject: [PATCH] preserve fix fro #468 --- .../Services/PostprocessBuildJob.cs | 4 +++- .../Services/SmtTransferPostprocessBuildJob.cs | 12 +++++++++++- .../Services/NmtEngineServiceTests.cs | 3 ++- .../Services/SmtTransferEngineServiceTests.cs | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Machine/src/Serval.Machine.Shared/Services/PostprocessBuildJob.cs b/src/Machine/src/Serval.Machine.Shared/Services/PostprocessBuildJob.cs index 8237295a..c9922e41 100644 --- a/src/Machine/src/Serval.Machine.Shared/Services/PostprocessBuildJob.cs +++ b/src/Machine/src/Serval.Machine.Shared/Services/PostprocessBuildJob.cs @@ -6,10 +6,12 @@ public class PostprocessBuildJob( IDataAccessContext dataAccessContext, IBuildJobService buildJobService, ILogger logger, - ISharedFileService sharedFileService + ISharedFileService sharedFileService, + IOptionsMonitor options ) : HangfireBuildJob<(int, double)>(platformService, engines, dataAccessContext, buildJobService, logger) { protected ISharedFileService SharedFileService { get; } = sharedFileService; + private readonly BuildJobOptions _buildJobOptions = options.CurrentValue; protected override async Task DoWorkAsync( string engineId, diff --git a/src/Machine/src/Serval.Machine.Shared/Services/SmtTransferPostprocessBuildJob.cs b/src/Machine/src/Serval.Machine.Shared/Services/SmtTransferPostprocessBuildJob.cs index 8d2c12ca..8b30dc6d 100644 --- a/src/Machine/src/Serval.Machine.Shared/Services/SmtTransferPostprocessBuildJob.cs +++ b/src/Machine/src/Serval.Machine.Shared/Services/SmtTransferPostprocessBuildJob.cs @@ -11,8 +11,18 @@ public class SmtTransferPostprocessBuildJob( IRepository trainSegmentPairs, ISmtModelFactory smtModelFactory, ITruecaserFactory truecaserFactory, + IOptionsMonitor buildOptions, IOptionsMonitor engineOptions -) : PostprocessBuildJob(platformService, engines, dataAccessContext, buildJobService, logger, sharedFileService) +) + : PostprocessBuildJob( + platformService, + engines, + dataAccessContext, + buildJobService, + logger, + sharedFileService, + buildOptions + ) { private readonly ISmtModelFactory _smtModelFactory = smtModelFactory; private readonly ITruecaserFactory _truecaserFactory = truecaserFactory; diff --git a/src/Machine/test/Serval.Machine.Shared.Tests/Services/NmtEngineServiceTests.cs b/src/Machine/test/Serval.Machine.Shared.Tests/Services/NmtEngineServiceTests.cs index f601e9f5..19a15a25 100644 --- a/src/Machine/test/Serval.Machine.Shared.Tests/Services/NmtEngineServiceTests.cs +++ b/src/Machine/test/Serval.Machine.Shared.Tests/Services/NmtEngineServiceTests.cs @@ -315,7 +315,8 @@ public override object ActivateJob(Type jobType) new MemoryDataAccessContext(), _env.BuildJobService, Substitute.For>(), - _env.SharedFileService + _env.SharedFileService, + buildJobOptions ); } return base.ActivateJob(jobType); diff --git a/src/Machine/test/Serval.Machine.Shared.Tests/Services/SmtTransferEngineServiceTests.cs b/src/Machine/test/Serval.Machine.Shared.Tests/Services/SmtTransferEngineServiceTests.cs index 095f9448..1a798d97 100644 --- a/src/Machine/test/Serval.Machine.Shared.Tests/Services/SmtTransferEngineServiceTests.cs +++ b/src/Machine/test/Serval.Machine.Shared.Tests/Services/SmtTransferEngineServiceTests.cs @@ -697,6 +697,7 @@ public override object ActivateJob(Type jobType) _env.TrainSegmentPairs, _env.SmtModelFactory, _env._truecaserFactory, + buildJobOptions, engineOptions ); }