Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added to build properties #632

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@
await UpdateTrainJobStatus(
platformService,
engine.CurrentBuild.BuildId,
new ProgressStatus(step: 0, percentCompleted: 0.0),
new ProgressStatus(
step: 0,
percentCompleted: 0.0,
fineTuneProgress: 0.0,

Check failure on line 101 in src/Machine/src/Serval.Machine.Shared/Services/ClearMLMonitorService.cs

View workflow job for this annotation

GitHub Actions / Build

The best overload for 'ProgressStatus' does not have a parameter named 'fineTuneProgress'

Check failure on line 101 in src/Machine/src/Serval.Machine.Shared/Services/ClearMLMonitorService.cs

View workflow job for this annotation

GitHub Actions / Build

The best overload for 'ProgressStatus' does not have a parameter named 'fineTuneProgress'
inferenceProgress: 0.0
),
//CurrentBuild.BuildId should always equal the corresponding task.Name
queuePositionsPerEngineType[engine.Type][engine.CurrentBuild.BuildId] + 1,
cancellationToken
Expand Down Expand Up @@ -130,13 +135,26 @@
case ClearMLTaskStatus.InProgress:
{
double? percentCompleted = null;
double? fineTuneProgress = null;
double? inferenceProgress = null;

if (task.Runtime.TryGetValue("progress", out string? progressStr))
percentCompleted = int.Parse(progressStr, CultureInfo.InvariantCulture) / 100.0;
if (task.Runtime.TryGetValue("finetune", out string? fineTuneStr))
fineTuneProgress = int.Parse(fineTuneStr, CultureInfo.InvariantCulture) / 100.0;
if (task.Runtime.TryGetValue("inference", out string? inferenceStr))
inferenceProgress = int.Parse(inferenceStr, CultureInfo.InvariantCulture) / 100.0;
task.Runtime.TryGetValue("message", out string? message);
await UpdateTrainJobStatus(
platformService,
engine.CurrentBuild.BuildId,
new ProgressStatus(task.LastIteration ?? 0, percentCompleted, message),
new ProgressStatus(

Check failure on line 151 in src/Machine/src/Serval.Machine.Shared/Services/ClearMLMonitorService.cs

View workflow job for this annotation

GitHub Actions / Build

'ProgressStatus' does not contain a constructor that takes 5 arguments

Check failure on line 151 in src/Machine/src/Serval.Machine.Shared/Services/ClearMLMonitorService.cs

View workflow job for this annotation

GitHub Actions / Build

'ProgressStatus' does not contain a constructor that takes 5 arguments
task.LastIteration ?? 0,
percentCompleted,
fineTuneProgress,
inferenceProgress,
message
),
queueDepth: 0,
cancellationToken
);
Expand All @@ -149,7 +167,13 @@
await UpdateTrainJobStatus(
platformService,
engine.CurrentBuild.BuildId,
new ProgressStatus(task.LastIteration ?? 0, percentCompleted: 1.0, message),
new ProgressStatus(
task.LastIteration ?? 0,
percentCompleted: 1.0,
fineTuneProgress: 0.5,

Check failure on line 173 in src/Machine/src/Serval.Machine.Shared/Services/ClearMLMonitorService.cs

View workflow job for this annotation

GitHub Actions / Build

The best overload for 'ProgressStatus' does not have a parameter named 'fineTuneProgress'

Check failure on line 173 in src/Machine/src/Serval.Machine.Shared/Services/ClearMLMonitorService.cs

View workflow job for this annotation

GitHub Actions / Build

The best overload for 'ProgressStatus' does not have a parameter named 'fineTuneProgress'
inferenceProgress: 0.5,
message
),
queueDepth: 0,
cancellationToken
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
var request = new UpdateBuildStatusRequest { BuildId = buildId, Step = progressStatus.Step };
if (progressStatus.PercentCompleted.HasValue)
request.PercentCompleted = progressStatus.PercentCompleted.Value;
if (progressStatus.FineTuneProgress.HasValue)

Check failure on line 88 in src/Machine/src/Serval.Machine.Shared/Services/ServalPlatformService.cs

View workflow job for this annotation

GitHub Actions / Build

'ProgressStatus' does not contain a definition for 'FineTuneProgress' and no accessible extension method 'FineTuneProgress' accepting a first argument of type 'ProgressStatus' could be found (are you missing a using directive or an assembly reference?)
request.FineTuneProgress = progressStatus.FineTuneProgress.Value;

Check failure on line 89 in src/Machine/src/Serval.Machine.Shared/Services/ServalPlatformService.cs

View workflow job for this annotation

GitHub Actions / Build

'ProgressStatus' does not contain a definition for 'FineTuneProgress' and no accessible extension method 'FineTuneProgress' accepting a first argument of type 'ProgressStatus' could be found (are you missing a using directive or an assembly reference?)
if (progressStatus.InferenceProgress.HasValue)

Check failure on line 90 in src/Machine/src/Serval.Machine.Shared/Services/ServalPlatformService.cs

View workflow job for this annotation

GitHub Actions / Build

'ProgressStatus' does not contain a definition for 'InferenceProgress' and no accessible extension method 'InferenceProgress' accepting a first argument of type 'ProgressStatus' could be found (are you missing a using directive or an assembly reference?)
request.InferenceProgress = progressStatus.InferenceProgress.Value;

Check failure on line 91 in src/Machine/src/Serval.Machine.Shared/Services/ServalPlatformService.cs

View workflow job for this annotation

GitHub Actions / Build

'ProgressStatus' does not contain a definition for 'InferenceProgress' and no accessible extension method 'InferenceProgress' accepting a first argument of type 'ProgressStatus' could be found (are you missing a using directive or an assembly reference?)
if (progressStatus.Message is not null)
request.Message = progressStatus.Message;
if (queueDepth is not null)
Expand Down
6 changes: 6 additions & 0 deletions src/Serval/src/Serval.Client/Client.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7763,6 +7763,12 @@ public partial class TranslationBuild
[Newtonsoft.Json.JsonProperty("percentCompleted", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? PercentCompleted { get; set; } = default!;

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ message UpdateBuildStatusRequest {
string build_id = 1;
int32 step = 2;
optional double percent_completed = 3;
optional string message = 4;
optional int32 queue_depth = 5;
optional double fine_tune_progress = 4;
optional double inference_progress = 5;
optional string message = 6;
optional int32 queue_depth = 7;
}

message BuildStartedRequest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Serval.Translation.Contracts;
namespace Serval.Translation.Contracts;

public record TranslationBuildDto
{
Expand All @@ -11,6 +11,9 @@ public record TranslationBuildDto
public IReadOnlyList<PretranslateCorpusDto>? Pretranslate { get; init; }
public required int Step { get; init; }
public double? PercentCompleted { get; init; }
public double? FineTuneProgress { get; init; }
public double? InferenceProgress { get; init; }

public string? Message { get; init; }

public int? QueueDepth { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,8 @@ private TranslationBuildDto Map(Build source)
Pretranslate = source.Pretranslate?.Select(s => Map(source.EngineRef, s)).ToList(),
Step = source.Step,
PercentCompleted = source.PercentCompleted,
FineTuneProgress = source.FineTuneProgress,
InferenceProgress = source.InferenceProgress,
Message = source.Message,
QueueDepth = source.QueueDepth,
State = source.State,
Expand Down
4 changes: 3 additions & 1 deletion src/Serval/src/Serval.Translation/Models/Build.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Serval.Translation.Models;
namespace Serval.Translation.Models;

public record Build : IInitializableEntity
{
Expand All @@ -10,6 +10,8 @@ public record Build : IInitializableEntity
public IReadOnlyList<PretranslateCorpus>? Pretranslate { get; init; }
public int Step { get; init; }
public double? PercentCompleted { get; init; }
public double? FineTuneProgress { get; init; }
public double? InferenceProgress { get; init; }
public string? Message { get; init; }
public int? QueueDepth { get; init; }
public JobState State { get; init; } = JobState.Pending;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ await _dataAccessContext.WithTransactionAsync(
u.Set(b => b.Message, "Restarting")
.Set(b => b.Step, 0)
.Set(b => b.PercentCompleted, 0)
.Set(b => b.FineTuneProgress, 0)
.Set(b => b.InferenceProgress, 0)
.Set(b => b.State, JobState.Pending),
cancellationToken: ct
);
Expand Down Expand Up @@ -254,6 +256,20 @@ await _builds.UpdateAsync(
Math.Round(request.PercentCompleted, 4, MidpointRounding.AwayFromZero)
);
}
if (request.HasFineTuneProgress)
{
u.Set(
b => b.FineTuneProgress,
Math.Round(request.FineTuneProgress, 4, MidpointRounding.AwayFromZero)
);
}
if (request.HasInferenceProgress)
{
u.Set(
b => b.InferenceProgress,
Math.Round(request.InferenceProgress, 4, MidpointRounding.AwayFromZero)
);
}
if (request.HasMessage)
u.Set(b => b.Message, request.Message);
if (request.HasQueueDepth)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,16 @@ await env.PlatformService.UpdateBuildStatus(
{
BuildId = "b0",
QueueDepth = 1,
PercentCompleted = 0.5
PercentCompleted = 0.5,
FineTuneProgress = 0.25,
InferenceProgress = 0.3,
},
env.ServerCallContext
);
Assert.That(env.Builds.Get("b0").QueueDepth, Is.EqualTo(1));
Assert.That(env.Builds.Get("b0").PercentCompleted, Is.EqualTo(0.5));
Assert.That(env.Builds.Get("b0").FineTuneProgress, Is.EqualTo(0.25));
Assert.That(env.Builds.Get("b0").InferenceProgress, Is.EqualTo(0.3));
}

[Test]
Expand Down
Loading