Skip to content

Commit 0221a2b

Browse files
author
elasticsearchmachine
committed
[CI] Auto commit changes from spotless
1 parent 914381c commit 0221a2b

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/assignment/TrainedModelAssignmentRebalancer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ private static void copyAssignments(
147147
for (Map.Entry<AssignmentPlan.Node, Integer> sourceAssignment : sourceNodeAssignments.entrySet()) {
148148
AssignmentPlan.Node node = originalNodeById.get(sourceAssignment.getKey().id());
149149
dest.assignModelToNode(deployment, node, sourceAssignment.getValue());
150-
// if (deployment.currentAllocationsByNodeId().containsKey(node.id())) {
151-
// // TODO (#101612) requiredMemory should be calculated by the AssignmentPlan.Builder
152-
// // As the node has all its available memory we need to manually account memory of models with
153-
// // current allocations.
154-
// long requiredMemory = deployment.estimateMemoryUsageBytes(deployment.currentAllocationsByNodeId().get(node.id()));
155-
// dest.accountMemory(deployment, node, requiredMemory);
156-
// }
150+
// if (deployment.currentAllocationsByNodeId().containsKey(node.id())) {
151+
// // TODO (#101612) requiredMemory should be calculated by the AssignmentPlan.Builder
152+
// // As the node has all its available memory we need to manually account memory of models with
153+
// // current allocations.
154+
// long requiredMemory = deployment.estimateMemoryUsageBytes(deployment.currentAllocationsByNodeId().get(node.id()));
155+
// dest.accountMemory(deployment, node, requiredMemory);
156+
// }
157157
}
158158
}
159159
}

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/assignment/planning/AssignmentPlan.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -461,20 +461,20 @@ public Builder assignModelToNode(Deployment deployment, Node node, int allocatio
461461
}
462462

463463
private int getAssignedAllocations(Deployment deployment, Node node) {
464-
// int currentAllocations = getCurrentAllocations(deployment, node);
464+
// int currentAllocations = getCurrentAllocations(deployment, node);
465465
return assignments.get(deployment).get(node);
466-
// return currentAllocations + assignmentAllocations;
466+
// return currentAllocations + assignmentAllocations;
467467
}
468468

469-
// private static int getCurrentAllocations(Deployment m, Node n) {
470-
// return m.currentAllocationsByNodeId.containsKey(n.id()) ? m.currentAllocationsByNodeId.get(n.id()) : 0;
471-
// }
469+
// private static int getCurrentAllocations(Deployment m, Node n) {
470+
// return m.currentAllocationsByNodeId.containsKey(n.id()) ? m.currentAllocationsByNodeId.get(n.id()) : 0;
471+
// }
472472

473-
// public void accountMemory(Deployment m, Node n) {
474-
// // TODO (#101612) remove or refactor unused method
475-
// long requiredMemory = getDeploymentMemoryRequirement(m, n, getCurrentAllocations(m, n));
476-
// accountMemory(m, n, requiredMemory);
477-
// }
473+
// public void accountMemory(Deployment m, Node n) {
474+
// // TODO (#101612) remove or refactor unused method
475+
// long requiredMemory = getDeploymentMemoryRequirement(m, n, getCurrentAllocations(m, n));
476+
// accountMemory(m, n, requiredMemory);
477+
// }
478478

479479
public void accountMemory(Deployment m, Node n, long requiredMemory) {
480480
// TODO (#101612) computation of required memory should be done internally

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/assignment/planning/ZoneAwareAssignmentPlanner.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,15 @@ private AssignmentPlan swapOriginalDeploymentsInPlan(
212212
for (Map.Entry<Node, Integer> assignment : nodeAssignments.entrySet()) {
213213
Node originalNode = originalNodeById.get(assignment.getKey().id());
214214
finalPlanBuilder.assignModelToNode(originalDeployment, originalNode, assignment.getValue());
215-
// if (originalDeployment.currentAllocationsByNodeId().containsKey(originalNode.id())) {
216-
// // TODO (#101612) requiredMemory should be calculated by the AssignmentPlan.Builder
217-
// // As the node has all its available memory we need to manually account memory of models with
218-
// // current allocations.
219-
// long requiredMemory = originalDeployment.estimateMemoryUsageBytes(
220-
// originalDeployment.currentAllocationsByNodeId().get(originalNode.id())
221-
// );
222-
// finalPlanBuilder.accountMemory(planDeployment, originalNode, requiredMemory);
223-
// }
215+
// if (originalDeployment.currentAllocationsByNodeId().containsKey(originalNode.id())) {
216+
// // TODO (#101612) requiredMemory should be calculated by the AssignmentPlan.Builder
217+
// // As the node has all its available memory we need to manually account memory of models with
218+
// // current allocations.
219+
// long requiredMemory = originalDeployment.estimateMemoryUsageBytes(
220+
// originalDeployment.currentAllocationsByNodeId().get(originalNode.id())
221+
// );
222+
// finalPlanBuilder.accountMemory(planDeployment, originalNode, requiredMemory);
223+
// }
224224
}
225225
}
226226
return finalPlanBuilder.build();

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/inference/assignment/planning/AssignmentPlanTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ public void testAssignModelToNode_GivenNewPlanDoesNotSatisfyCurrentAssignment()
217217
builder.assignModelToNode(m, n, 1);
218218

219219
assertThat(builder.getRemainingCores(n), equalTo(2));
220-
// base memory: 240+2*25 = 290MB
221-
//since perDeployment memory is specified, we compute the new memory format usage:
220+
// base memory: 240+2*25 = 290MB
221+
// since perDeployment memory is specified, we compute the new memory format usage:
222222
// 250 (perDeployment) + 1*25 (perAllocation) + 25 (modelDefinition) = 300MB
223223
// Then we take the maximum of 290 and 300, which is 300MB
224224
assertThat(builder.getRemainingMemory(n), equalTo(ByteSizeValue.ofMb(0).getBytes()));
@@ -383,7 +383,7 @@ public void testCanAssign_GivenPreviouslyAssignedModelDoesNotFit() {
383383
// old memory format
384384
Deployment m = new Deployment("m_1", "m_1", ByteSizeValue.ofMb(31).getBytes(), 1, 1, Map.of("n_1", 1), 0, null, 0, 0);
385385
AssignmentPlan.Builder builder = AssignmentPlan.builder(List.of(n), List.of(m));
386-
//240 + 2*31 = 302MB, this doesn't fit in 300MB. We don't care that the deployment is currently allocated since
386+
// 240 + 2*31 = 302MB, this doesn't fit in 300MB. We don't care that the deployment is currently allocated since
387387
// only previous assignments should be considered
388388
assertThat(builder.canAssign(m, n, 1), is(false));
389389
}

0 commit comments

Comments
 (0)