Skip to content

Commit

Permalink
Move queueDepth to build property
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Oct 12, 2023
1 parent 3c7d62c commit b7f61e7
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Serval.Client/Client.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4427,6 +4427,9 @@ public partial class TranslationBuild
[Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string? Message { get; set; } = default!;

[Newtonsoft.Json.JsonProperty("queueDepth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? QueueDepth { get; set; } = default!;

/// <summary>
/// The current build job state.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ message UpdateBuildStatusRequest {
int32 step = 2;
optional double percent_completed = 3;
optional string message = 4;
optional int32 queue_depth = 5;
}

message BuildStartedRequest {
Expand Down
2 changes: 2 additions & 0 deletions src/Serval.Translation/Contracts/TranslationBuildDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class TranslationBuildDto
public double? PercentCompleted { get; set; }
public string? Message { get; set; }

public int? QueueDepth { get; set; }

/// <summary>
/// The current build job state.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,7 @@ private TranslationBuildDto Map(Build source)
Step = source.Step,
PercentCompleted = source.PercentCompleted,
Message = source.Message,
QueueDepth = source.QueueDepth,
State = source.State,
DateFinished = source.DateFinished,
Options = JsonSerializer.Serialize(source.Options)
Expand Down
1 change: 1 addition & 0 deletions src/Serval.Translation/Models/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Build : IEntity
public int Step { get; set; }
public double? PercentCompleted { get; set; }
public string? Message { get; set; }
public int? QueueDepth { get; set; }
public JobState State { get; set; } = JobState.Pending;
public DateTime? DateFinished { get; set; }
public IDictionary<string, object>? Options { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ await _builds.UpdateAsync(
}
if (request.HasMessage)
u.Set(b => b.Message, request.Message);
if (request.HasQueueDepth)
u.Set(b => b.QueueDepth, request.QueueDepth);
},
cancellationToken: context.CancellationToken
);
Expand Down
2 changes: 1 addition & 1 deletion tests/Serval.E2ETests/ServalApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public async Task NmtQueueMultiple()
Assert.Multiple(async () =>
{
Assert.That(
int.Parse(newestEngineCurrentBuild.Message?.Split(": ").Last() ?? "0"),
newestEngineCurrentBuild.QueueDepth,
Is.GreaterThan(0),
message: builds
);
Expand Down

0 comments on commit b7f61e7

Please sign in to comment.