forked from elastic/elasticsearch
-
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.
[ML] Include ML processor limits in
_ml/info
response
The _ml/info response now includes two extra fields in its `limits`: 1. `max_single_ml_node_processors` 2. `total_ml_processors` These fields are _only_ included if they can be accurately calculated. If autoscaling is enabled and the ML nodes are not at their maximum size then these fields _cannot_ currently be accurately calculated. (This could potentially be improved in the future with additional settings set by the control plane.)
- Loading branch information
1 parent
18b1bf5
commit f89746f
Showing
4 changed files
with
307 additions
and
0 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
50 changes: 50 additions & 0 deletions
50
...plugin/ml/src/test/java/org/elasticsearch/xpack/ml/action/TransportMlInfoActionTests.java
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,50 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.ml.action; | ||
|
||
import org.elasticsearch.cluster.node.DiscoveryNodeRole; | ||
import org.elasticsearch.cluster.node.DiscoveryNodeUtils; | ||
import org.elasticsearch.common.unit.ByteSizeValue; | ||
import org.elasticsearch.test.ESTestCase; | ||
import org.elasticsearch.xpack.ml.MachineLearning; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import static org.hamcrest.Matchers.is; | ||
|
||
public class TransportMlInfoActionTests extends ESTestCase { | ||
|
||
public void testAreMlNodesBiggestSize() { | ||
boolean expectedResult = randomBoolean(); | ||
long mlNodeSize = randomLongBetween(10000000L, 10000000000L); | ||
long biggestSize = expectedResult ? mlNodeSize : mlNodeSize * randomLongBetween(2, 5); | ||
long otherNodeSize = randomLongBetween(mlNodeSize / 2, biggestSize * 2); | ||
var nodes = List.of( | ||
DiscoveryNodeUtils.builder("n1") | ||
.roles(Set.of(DiscoveryNodeRole.ML_ROLE)) | ||
.attributes(Map.of(MachineLearning.MACHINE_MEMORY_NODE_ATTR, Long.toString(mlNodeSize))) | ||
.build(), | ||
DiscoveryNodeUtils.builder("n2") | ||
.roles(Set.of(DiscoveryNodeRole.DATA_ROLE)) | ||
.attributes(Map.of(MachineLearning.MACHINE_MEMORY_NODE_ATTR, Long.toString(otherNodeSize))) | ||
.build(), | ||
DiscoveryNodeUtils.builder("n3") | ||
.roles(Set.of(DiscoveryNodeRole.ML_ROLE)) | ||
.attributes(Map.of(MachineLearning.MACHINE_MEMORY_NODE_ATTR, Long.toString(mlNodeSize))) | ||
.build(), | ||
DiscoveryNodeUtils.builder("n4") | ||
.roles(Set.of(DiscoveryNodeRole.MASTER_ROLE)) | ||
.attributes(Map.of(MachineLearning.MACHINE_MEMORY_NODE_ATTR, Long.toString(otherNodeSize))) | ||
.build() | ||
); | ||
assertThat(TransportMlInfoAction.areMlNodesBiggestSize(ByteSizeValue.ofBytes(biggestSize), nodes), is(expectedResult)); | ||
|
||
} | ||
} |
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