Skip to content

Commit 6fb1592

Browse files
authored
Remove adaptive allocations feature flag (#112798)
1 parent 0d8042e commit 6fb1592

File tree

9 files changed

+21
-79
lines changed

9 files changed

+21
-79
lines changed

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/FeatureFlag.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@
1616
*/
1717
public enum FeatureFlag {
1818
TIME_SERIES_MODE("es.index_mode_feature_flag_registered=true", Version.fromString("8.0.0"), null),
19-
FAILURE_STORE_ENABLED("es.failure_store_feature_flag_enabled=true", Version.fromString("8.12.0"), null),
20-
INFERENCE_ADAPTIVE_ALLOCATIONS_ENABLED(
21-
"es.inference_adaptive_allocations_feature_flag_enabled=true",
22-
Version.fromString("8.16.0"),
23-
null
24-
);
19+
FAILURE_STORE_ENABLED("es.failure_store_feature_flag_enabled=true", Version.fromString("8.12.0"), null);
2520

2621
public final String systemProperty;
2722
public final Version from;

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartTrainedModelDeploymentAction.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.elasticsearch.xcontent.XContentParser;
3030
import org.elasticsearch.xpack.core.ml.MlConfigVersion;
3131
import org.elasticsearch.xpack.core.ml.inference.TrainedModelConfig;
32-
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsFeatureFlag;
3332
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsSettings;
3433
import org.elasticsearch.xpack.core.ml.inference.assignment.AllocationStatus;
3534
import org.elasticsearch.xpack.core.ml.inference.assignment.Priority;
@@ -120,14 +119,12 @@ public static class Request extends MasterNodeRequest<Request> implements ToXCon
120119
ObjectParser.ValueType.VALUE
121120
);
122121
PARSER.declareString(Request::setPriority, PRIORITY);
123-
if (AdaptiveAllocationsFeatureFlag.isEnabled()) {
124-
PARSER.declareObjectOrNull(
125-
Request::setAdaptiveAllocationsSettings,
126-
(p, c) -> AdaptiveAllocationsSettings.PARSER.parse(p, c).build(),
127-
null,
128-
ADAPTIVE_ALLOCATIONS
129-
);
130-
}
122+
PARSER.declareObjectOrNull(
123+
Request::setAdaptiveAllocationsSettings,
124+
(p, c) -> AdaptiveAllocationsSettings.PARSER.parse(p, c).build(),
125+
null,
126+
ADAPTIVE_ALLOCATIONS
127+
);
131128
}
132129

133130
public static Request parseRequest(String modelId, String deploymentId, XContentParser parser) {

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateTrainedModelDeploymentAction.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.elasticsearch.xcontent.ToXContentObject;
2121
import org.elasticsearch.xcontent.XContentBuilder;
2222
import org.elasticsearch.xcontent.XContentParser;
23-
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsFeatureFlag;
2423
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsSettings;
2524
import org.elasticsearch.xpack.core.ml.job.messages.Messages;
2625
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
@@ -50,14 +49,12 @@ public static class Request extends AcknowledgedRequest<Request> implements ToXC
5049
static {
5150
PARSER.declareString(Request::setDeploymentId, MODEL_ID);
5251
PARSER.declareInt(Request::setNumberOfAllocations, NUMBER_OF_ALLOCATIONS);
53-
if (AdaptiveAllocationsFeatureFlag.isEnabled()) {
54-
PARSER.declareObjectOrNull(
55-
Request::setAdaptiveAllocationsSettings,
56-
(p, c) -> AdaptiveAllocationsSettings.PARSER.parse(p, c).build(),
57-
AdaptiveAllocationsSettings.RESET_PLACEHOLDER,
58-
ADAPTIVE_ALLOCATIONS
59-
);
60-
}
52+
PARSER.declareObjectOrNull(
53+
Request::setAdaptiveAllocationsSettings,
54+
(p, c) -> AdaptiveAllocationsSettings.PARSER.parse(p, c).build(),
55+
AdaptiveAllocationsSettings.RESET_PLACEHOLDER,
56+
ADAPTIVE_ALLOCATIONS
57+
);
6158
PARSER.declareString((r, val) -> r.ackTimeout(TimeValue.parseTimeValue(val, TIMEOUT.getPreferredName())), TIMEOUT);
6259
}
6360

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

Lines changed: 0 additions & 24 deletions
This file was deleted.

x-pack/plugin/inference/src/internalClusterTest/java/org/elasticsearch/xpack/inference/integration/ModelRegistryIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.elasticsearch.test.ESSingleNodeTestCase;
2626
import org.elasticsearch.xcontent.ToXContentObject;
2727
import org.elasticsearch.xcontent.XContentBuilder;
28-
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsFeatureFlag;
2928
import org.elasticsearch.xpack.inference.InferencePlugin;
3029
import org.elasticsearch.xpack.inference.registry.ModelRegistry;
3130
import org.elasticsearch.xpack.inference.services.elser.ElserInternalModel;
@@ -102,7 +101,6 @@ public void testStoreModelWithUnknownFields() throws Exception {
102101
}
103102

104103
public void testGetModel() throws Exception {
105-
assumeTrue("Only if 'inference_adaptive_allocations' feature flag is enabled", AdaptiveAllocationsFeatureFlag.isEnabled());
106104
String inferenceEntityId = "test-get-model";
107105
Model model = buildElserModelConfig(inferenceEntityId, TaskType.SPARSE_EMBEDDING);
108106
AtomicReference<Boolean> putModelHolder = new AtomicReference<>();

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/ServiceUtils.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.elasticsearch.xpack.core.inference.action.InferenceAction;
2525
import org.elasticsearch.xpack.core.inference.results.InferenceTextEmbeddingFloatResults;
2626
import org.elasticsearch.xpack.core.inference.results.TextEmbedding;
27-
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsFeatureFlag;
2827
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsSettings;
2928
import org.elasticsearch.xpack.inference.services.settings.ApiKeySecrets;
3029

@@ -137,9 +136,6 @@ public static AdaptiveAllocationsSettings removeAsAdaptiveAllocationsSettings(
137136
String key,
138137
ValidationException validationException
139138
) {
140-
if (AdaptiveAllocationsFeatureFlag.isEnabled() == false) {
141-
return null;
142-
}
143139
Map<String, Object> settingsMap = ServiceUtils.removeFromMap(sourceMap, key);
144140
if (settingsMap == null) {
145141
return null;

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/elasticsearch/ElasticsearchInternalServiceSettings.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import org.elasticsearch.inference.ServiceSettings;
1717
import org.elasticsearch.xcontent.ToXContentObject;
1818
import org.elasticsearch.xcontent.XContentBuilder;
19-
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsFeatureFlag;
2019
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsSettings;
2120
import org.elasticsearch.xpack.inference.services.ServiceUtils;
2221

@@ -88,18 +87,12 @@ protected static ElasticsearchInternalServiceSettings.Builder fromMap(
8887
String modelId = extractOptionalString(map, MODEL_ID, ModelConfigurations.SERVICE_SETTINGS, validationException);
8988

9089
if (numAllocations == null && adaptiveAllocationsSettings == null) {
91-
if (AdaptiveAllocationsFeatureFlag.isEnabled()) {
92-
validationException.addValidationError(
93-
ServiceUtils.missingOneOfSettingsErrorMsg(
94-
List.of(NUM_ALLOCATIONS, ADAPTIVE_ALLOCATIONS),
95-
ModelConfigurations.SERVICE_SETTINGS
96-
)
97-
);
98-
} else {
99-
validationException.addValidationError(
100-
ServiceUtils.missingSettingErrorMsg(NUM_ALLOCATIONS, ModelConfigurations.SERVICE_SETTINGS)
101-
);
102-
}
90+
validationException.addValidationError(
91+
ServiceUtils.missingOneOfSettingsErrorMsg(
92+
List.of(NUM_ALLOCATIONS, ADAPTIVE_ALLOCATIONS),
93+
ModelConfigurations.SERVICE_SETTINGS
94+
)
95+
);
10396
}
10497

10598
// if an error occurred while parsing, we'll set these to an invalid value, so we don't accidentally get a

x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/ServiceUtilsTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.elasticsearch.test.ESTestCase;
2222
import org.elasticsearch.xpack.core.inference.results.InferenceTextEmbeddingByteResults;
2323
import org.elasticsearch.xpack.core.inference.results.InferenceTextEmbeddingFloatResults;
24-
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsFeatureFlag;
2524
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsSettings;
2625
import org.elasticsearch.xpack.inference.results.InferenceTextEmbeddingByteResultsTests;
2726
import org.elasticsearch.xpack.inference.results.TextEmbeddingResultsTests;
@@ -290,8 +289,6 @@ public void testRemoveAsOneOfTypesMissingReturnsNull() {
290289
}
291290

292291
public void testRemoveAsAdaptiveAllocationsSettings() {
293-
assumeTrue("Should only run if adaptive allocations feature flag is enabled", AdaptiveAllocationsFeatureFlag.isEnabled());
294-
295292
Map<String, Object> map = new HashMap<>(
296293
Map.of("settings", new HashMap<>(Map.of("enabled", true, "min_number_of_allocations", 7, "max_number_of_allocations", 42)))
297294
);
@@ -314,8 +311,6 @@ public void testRemoveAsAdaptiveAllocationsSettings() {
314311
}
315312

316313
public void testRemoveAsAdaptiveAllocationsSettings_exceptions() {
317-
assumeTrue("Should only run if adaptive allocations feature flag is enabled", AdaptiveAllocationsFeatureFlag.isEnabled());
318-
319314
Map<String, Object> map = new HashMap<>(
320315
Map.of("settings", new HashMap<>(Map.of("enabled", "YES!", "blah", 42, "max_number_of_allocations", -7)))
321316
);

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlInitializationService.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.elasticsearch.telemetry.metric.MeterRegistry;
3434
import org.elasticsearch.threadpool.ThreadPool;
3535
import org.elasticsearch.xpack.core.ml.annotations.AnnotationIndex;
36-
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsFeatureFlag;
3736
import org.elasticsearch.xpack.ml.inference.adaptiveallocations.AdaptiveAllocationsScalerService;
3837
import org.elasticsearch.xpack.ml.notifications.InferenceAuditor;
3938

@@ -126,17 +125,13 @@ public void beforeStop() {
126125

127126
public void onMaster() {
128127
mlDailyMaintenanceService.start();
129-
if (AdaptiveAllocationsFeatureFlag.isEnabled()) {
130-
adaptiveAllocationsScalerService.start();
131-
}
128+
adaptiveAllocationsScalerService.start();
132129
threadPool.executor(MachineLearning.UTILITY_THREAD_POOL_NAME).execute(this::makeMlInternalIndicesHidden);
133130
}
134131

135132
public void offMaster() {
136133
mlDailyMaintenanceService.stop();
137-
if (AdaptiveAllocationsFeatureFlag.isEnabled()) {
138-
adaptiveAllocationsScalerService.stop();
139-
}
134+
adaptiveAllocationsScalerService.stop();
140135
}
141136

142137
@Override

0 commit comments

Comments
 (0)