-
-
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
14f5047
commit c464179
Showing
49 changed files
with
388 additions
and
418 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
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
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
namespace Serval.Assessment.Models; | ||
|
||
public record AssessmentEngine : Engine | ||
public record AssessmentEngine : IEngine | ||
{ | ||
public string Id { get; set; } = ""; | ||
public int Revision { get; set; } = 1; | ||
public required string Owner { get; init; } | ||
public string? Name { get; init; } | ||
public required string Type { get; init; } | ||
public required Corpus Corpus { get; init; } | ||
public Corpus? ReferenceCorpus { get; init; } | ||
} |
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 |
---|---|---|
@@ -1,7 +1,16 @@ | ||
namespace Serval.Assessment.Models; | ||
|
||
public record AssessmentJob : Job | ||
public record AssessmentJob : IJob | ||
{ | ||
public string Id { get; set; } = ""; | ||
public int Revision { get; set; } = 1; | ||
public string? Name { get; init; } | ||
public required string EngineRef { get; init; } | ||
public IReadOnlyList<string>? TextIds { get; set; } | ||
public string? ScriptureRange { get; set; } | ||
public double? PercentCompleted { get; init; } | ||
public string? Message { get; init; } | ||
public JobState State { get; init; } = JobState.Pending; | ||
public DateTime? DateFinished { get; init; } | ||
public IReadOnlyDictionary<string, object>? Options { get; init; } | ||
} |
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.Assessment/Services/AssessmentJobService.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.Assessment.Services; | ||
|
||
public class AssessmentJobService( | ||
IDataAccessContext dataAccessContext, | ||
IRepository<AssessmentJob> jobs, | ||
IRepository<Result> results | ||
) : JobService<AssessmentJob>(jobs) | ||
{ | ||
private readonly IDataAccessContext _dataAccessContext = dataAccessContext; | ||
private readonly IRepository<Result> _results = results; | ||
|
||
public override Task DeleteAsync(string id, CancellationToken cancellationToken = default) | ||
{ | ||
return _dataAccessContext.WithTransactionAsync( | ||
async ct => | ||
{ | ||
IJob? job = await Entities.DeleteAsync(id, ct); | ||
if (job is null) | ||
throw new EntityNotFoundException($"Could not find the Job '{id}'."); | ||
await _results.DeleteAllAsync(r => r.JobRef == id, ct); | ||
}, | ||
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
18 changes: 18 additions & 0 deletions
18
src/Serval/src/Serval.Assessment/Services/IAssessmentEngineService.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,18 @@ | ||
namespace Serval.Assessment.Services; | ||
|
||
public interface IAssessmentEngineService : IEngineServiceBase | ||
{ | ||
Task<IEnumerable<AssessmentEngine>> GetAllAsync(string owner, CancellationToken cancellationToken = default); | ||
Task<AssessmentEngine> GetAsync(string engineId, CancellationToken cancellationToken = default); | ||
|
||
Task<AssessmentEngine> CreateAsync(AssessmentEngine engine, CancellationToken cancellationToken = default); | ||
Task DeleteAsync(string engineId, CancellationToken cancellationToken = default); | ||
Task StartJobAsync(AssessmentJob build, CancellationToken cancellationToken = default); | ||
Task<bool> CancelJobAsync(string engineId, string jobId, CancellationToken cancellationToken = default); | ||
Task<Corpus> ReplaceCorpusAsync(string id, Corpus corpus, CancellationToken cancellationToken = default); | ||
Task<Corpus> ReplaceReferenceCorpusAsync( | ||
string id, | ||
Corpus referenceCorpus, | ||
CancellationToken cancellationToken = default | ||
); | ||
} |
13 changes: 0 additions & 13 deletions
13
src/Serval/src/Serval.Assessment/Services/IEngineService.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.