Skip to content

Commit 5cf9498

Browse files
Rename exception and update exception message
1 parent 37ce942 commit 5cf9498

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
6565
import org.elasticsearch.xpack.core.ml.utils.TransportVersionUtils;
6666
import org.elasticsearch.xpack.ml.MachineLearning;
67-
import org.elasticsearch.xpack.ml.inference.assignment.ModelDeploymentScaleUpException;
67+
import org.elasticsearch.xpack.ml.inference.assignment.ModelDeploymentTimeoutException;
6868
import org.elasticsearch.xpack.ml.inference.assignment.TrainedModelAssignmentService;
6969
import org.elasticsearch.xpack.ml.inference.persistence.TrainedModelDefinitionDoc;
7070
import org.elasticsearch.xpack.ml.notifications.InferenceAuditor;
@@ -351,14 +351,14 @@ public void onFailure(Exception e) {
351351
@Override
352352
public void onTimeout(TimeValue timeout) {
353353
onFailure(
354-
new ModelDeploymentScaleUpException(
354+
new ModelDeploymentTimeoutException(
355355
format(
356356
"Timed out after [%s] waiting for trained model deployment [%s] to start. "
357-
+ "Please ensure the trained model deployment has started and try again.",
357+
+ "Use the trained model stats API to track the state of the deployment "
358+
+ "and try again once it has started.",
358359
request.getTimeout(),
359360
request.getDeploymentId()
360-
),
361-
RestStatus.REQUEST_TIMEOUT
361+
)
362362
)
363363
);
364364
}

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import org.elasticsearch.xpack.core.ml.inference.assignment.TrainedModelAssignment;
2222
import org.elasticsearch.xpack.core.ml.inference.assignment.TrainedModelAssignmentMetadata;
2323
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
24-
import org.elasticsearch.xpack.ml.inference.assignment.ModelDeploymentScaleUpException;
24+
import org.elasticsearch.xpack.ml.inference.assignment.ModelDeploymentTimeoutException;
2525
import org.elasticsearch.xpack.ml.inference.assignment.TrainedModelAssignmentService;
2626

2727
import java.util.HashMap;
@@ -194,14 +194,13 @@ public void onFailure(Exception e) {
194194
@Override
195195
public void onTimeout(TimeValue timeout) {
196196
onFailure(
197-
new ModelDeploymentScaleUpException(
197+
new ModelDeploymentTimeoutException(
198198
format(
199199
"Timed out after [%s] waiting for trained model deployment [%s] to start. "
200-
+ "Please ensure the trained model deployment has started and try again.",
200+
+ "Use the trained model stats API to track the state of the deployment and try again once it has started.",
201201
timeout,
202202
request.deploymentId()
203-
),
204-
RestStatus.REQUEST_TIMEOUT
203+
)
205204
)
206205
);
207206
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import org.elasticsearch.ElasticsearchStatusException;
1111
import org.elasticsearch.rest.RestStatus;
1212

13-
public class ModelDeploymentScaleUpException extends ElasticsearchStatusException {
14-
public ModelDeploymentScaleUpException(String message, RestStatus status) {
15-
super(message, status);
13+
public class ModelDeploymentTimeoutException extends ElasticsearchStatusException {
14+
public ModelDeploymentTimeoutException(String message) {
15+
super(message, RestStatus.REQUEST_TIMEOUT);
1616
}
1717
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.elasticsearch.core.Nullable;
2525
import org.elasticsearch.core.TimeValue;
2626
import org.elasticsearch.node.NodeClosedException;
27-
import org.elasticsearch.rest.RestStatus;
2827
import org.elasticsearch.threadpool.ThreadPool;
2928
import org.elasticsearch.transport.ConnectTransportException;
3029
import org.elasticsearch.xpack.core.ml.action.CreateTrainedModelAssignmentAction;
@@ -121,13 +120,12 @@ public void onTimeout(TimeValue timeout) {
121120
public interface WaitForAssignmentListener extends ActionListener<TrainedModelAssignment> {
122121
default void onTimeout(TimeValue timeout) {
123122
onFailure(
124-
new ModelDeploymentScaleUpException(
123+
new ModelDeploymentTimeoutException(
125124
format(
126125
"Timed out after [%s] waiting for trained model deployment to start. "
127-
+ "Please ensure the trained model deployment has started and try again.",
126+
+ "Use the trained model stats API to track the state of the deployment and try again once it has started.",
128127
timeout
129-
),
130-
RestStatus.REQUEST_TIMEOUT
128+
)
131129
)
132130
);
133131
}

0 commit comments

Comments
 (0)