Skip to content

Commit 6664c56

Browse files
[ML] Warn for model load failures if they have a status code <500 (#113280) (#113381)
* On model load failure, warn if the failure status code was less tahn 500 * Update docs/changelog/113280.yaml
1 parent 662bb70 commit 6664c56

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

docs/changelog/113280.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 113280
2+
summary: 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;
@@ -775,7 +776,11 @@ private void updateStoredState(String deploymentId, RoutingInfoUpdate update, Ac
775776
}
776777

777778
private void handleLoadFailure(TrainedModelDeploymentTask task, Exception ex, ActionListener<Boolean> retryListener) {
778-
logger.error(() -> "[" + task.getDeploymentId() + "] model [" + task.getParams().getModelId() + "] failed to load", ex);
779+
if (ex instanceof ElasticsearchException esEx && esEx.status().getStatus() < 500) {
780+
logger.warn(() -> "[" + task.getDeploymentId() + "] model [" + task.getParams().getModelId() + "] failed to load", ex);
781+
} else {
782+
logger.error(() -> "[" + task.getDeploymentId() + "] model [" + task.getParams().getModelId() + "] failed to load", ex);
783+
}
779784
if (task.isStopped()) {
780785
logger.debug(
781786
() -> format(

0 commit comments

Comments
 (0)