Skip to content

Commit 20d56d0

Browse files
[ML][backport] Warn for model load failures if they have a status code <500 (elastic#113410)
* [ML][backport] Warn for model load failures if they have a status code <500 * On model load failure, warn if the failure status code was less tahn 500 * Update docs/changelog/113280.yaml # Conflicts: # x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/assignment/TrainedModelAssignmentNodeService.java * Update docs/changelog/113410.yaml * fix merge
1 parent 6ee49a3 commit 20d56d0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

docs/changelog/113410.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 113410
2+
summary: "[ML][backport] Warn for model load failures if they have a status code <500"
3+
area: Machine Learning
4+
type: bug
5+
issues: []

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import org.apache.logging.log4j.LogManager;
1111
import org.apache.logging.log4j.Logger;
12+
import org.elasticsearch.ElasticsearchException;
1213
import org.elasticsearch.ResourceNotFoundException;
1314
import org.elasticsearch.action.ActionListener;
1415
import org.elasticsearch.action.search.SearchPhaseExecutionException;
@@ -753,7 +754,11 @@ private void updateStoredState(String deploymentId, RoutingInfoUpdate update, Ac
753754
}
754755

755756
private void handleLoadFailure(TrainedModelDeploymentTask task, Exception ex) {
756-
logger.error(() -> "[" + task.getDeploymentId() + "] model [" + task.getParams().getModelId() + "] failed to load", ex);
757+
if (ex instanceof ElasticsearchException esEx && esEx.status().getStatus() < 500) {
758+
logger.warn(() -> "[" + task.getDeploymentId() + "] model [" + task.getParams().getModelId() + "] failed to load", ex);
759+
} else {
760+
logger.error(() -> "[" + task.getDeploymentId() + "] model [" + task.getParams().getModelId() + "] failed to load", ex);
761+
}
757762
if (task.isStopped()) {
758763
logger.debug(
759764
() -> format(

0 commit comments

Comments
 (0)