sillsdev / machine

Machine is a natural language processing library for .NET that is focused on providing tools for processing resource-poor languages.
MIT License
26 stars 15 forks source link

Throw error when both languages are unknown and there's no data #205

Closed Enkidu93 closed 5 months ago

Enkidu93 commented 5 months ago

Fixes https://github.com/sillsdev/serval/issues/284

A couple questions regarding the solution:

  1. I noticed that John has it throwing an OperationCanceledException when the engine doesn't exist in NmtPreprocessBuildJob. Is that what we want? Or should this throw some other exception that would cause the build to be marked as failed instead? And if so, should it also do the same in this case? Maybe I'm missing something.
  2. I thought I'd add a test to cover the logic mentioned above, but it seems to be unreachable because if the engine does not exist, it'll get cut short here in the HangfireBuildJob code:
    if (!await BuildJobService.BuildJobStartedAsync(engineId, buildId, cancellationToken)) { completionStatus = JobCompletionStatus.Canceled; return; } What am I missing?

This change is Reviewable

codecov-commenter commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 67.33%. Comparing base (8d84ddd) to head (24d17f3).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #205 +/- ## ========================================== + Coverage 67.27% 67.33% +0.05% ========================================== Files 441 441 Lines 34993 35004 +11 Branches 4694 4695 +1 ========================================== + Hits 23543 23569 +26 + Misses 10361 10346 -15 Partials 1089 1089 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.