Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Commit 0b253e5

Browse files
authored
issue_961 (#969)
* fix prediction string format * fix test * fix test
1 parent 46dd188 commit 0b253e5

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

frontend/server/src/test/java/com/amazonaws/ml/mms/ModelServerTest.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,20 +1219,9 @@ private void testPredictionCustomErrorCode() throws InterruptedException {
12191219
channel.writeAndFlush(req);
12201220
latch.await();
12211221

1222-
Assert.assertEquals(httpStatus.code(), 599);
1223-
channel.close();
1224-
1225-
// Unload the model
1226-
channel = connect(true);
1227-
httpStatus = null;
1228-
latch = new CountDownLatch(1);
1229-
Assert.assertNotNull(channel);
1230-
req =
1231-
new DefaultFullHttpRequest(
1232-
HttpVersion.HTTP_1_1, HttpMethod.DELETE, "/models/custom-return-code");
1233-
channel.writeAndFlush(req);
1234-
latch.await();
1235-
Assert.assertEquals(httpStatus, HttpResponseStatus.OK);
1222+
ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class);
1223+
Assert.assertEquals(resp.getMessage(), "Some Prediction Error");
1224+
Assert.assertEquals(resp.getCode(), 599);
12361225
}
12371226

12381227
private void testErrorBatch() throws InterruptedException {

mms/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def __init__(self, message, error_code=500):
138138
super(PredictionException, self).__init__(message)
139139

140140
def __str__(self):
141-
return "message : error_code".format(message=self.message, error_code=self.error_code)
141+
return "{message} : {error_code}".format(message=self.message, error_code=self.error_code)
142142

143143

144144
def emit_metrics(metrics):

0 commit comments

Comments
 (0)