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

Overshoot compute node targets by rounding up to nearest 10 #420

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion src/TesApi.Web/BatchPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public sealed partial class BatchPool

private const int MaxComputeNodesToRemoveAtOnce = 100; // https://learn.microsoft.com/en-us/rest/api/batchservice/pool/remove-nodes?tabs=HTTP#request-body nodeList description

private const int RoundUpOvershoot = 10;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set this in the YAML config so we can adjust it at runtime


private readonly ILogger _logger;
private readonly IAzureProxy _azureProxy;

Expand Down Expand Up @@ -221,7 +223,9 @@ public static string AutoPoolFormula(bool preemptable, int initialTarget)
"span = TimeInterval_Second * 90;",
"startup = TimeInterval_Minute * 2;",
"ratio = 10;",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{RoundUpOvershoot} should be used here so it's defined once

$"${targetVariable} = (lifespan > startup ? min($PendingTasks.GetSample(span, ratio)) : {initialTarget});"
$"target = (lifespan > startup ? min($PendingTasks.GetSample(span, ratio)) : {initialTarget});",
$"adjusted = target + {Math.Round(RoundUpOvershoot / 2.0)};",
$"${targetVariable} = target == 0 ? 0 : round(adjusted / {RoundUpOvershoot}) * {RoundUpOvershoot};"
});
}

Expand Down