Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e1c0734

Browse files
committedJan 29, 2024
Format logger and exception messages
1 parent 51b1135 commit e1c0734

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed
 

‎frontend/server/src/main/java/org/pytorch/serve/wlm/ModelManager.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,12 @@ private void setupModelVenv(Model model)
244244
StringBuilder outputString = new StringBuilder();
245245
BufferedReader brdr = new BufferedReader(new InputStreamReader(process.getInputStream()));
246246
while ((line = brdr.readLine()) != null) {
247-
outputString.append(line);
247+
outputString.append(line + "\n");
248248
}
249249

250250
if (exitCode == 0) {
251251
logger.info(
252-
"Created virtual environment for model {}: {}",
253-
model.getModelName(),
254-
venvPath);
252+
"Created virtual environment for model {}: {}", model.getModelName(), venvPath);
255253
} else {
256254
logger.error(
257255
"Virtual environment creation for model {} at {} failed:\n{}",
@@ -318,21 +316,21 @@ private void setupModelDependencies(Model model)
318316
BufferedReader brdr =
319317
new BufferedReader(new InputStreamReader(process.getInputStream()));
320318
while ((line = brdr.readLine()) != null) {
321-
outputString.append(line);
319+
outputString.append(line + "\n");
322320
}
323321

324322
if (exitCode == 0) {
325323
logger.info(
326-
"Installed custom dependencies for model {}:\n{}",
324+
"Installed custom pip packages for model {}:\n{}",
327325
model.getModelName(),
328326
outputString.toString());
329327
} else {
330328
logger.error(
331-
"Failed to install custom dependencies for model {}:\n{}",
329+
"Custom pip package installation failed for model {}:\n{}",
332330
model.getModelName(),
333331
outputString.toString());
334332
throw new ModelException(
335-
"Failed to install custom dependencies for model " + model.getModelName());
333+
"Custom pip package installation failed for model " + model.getModelName());
336334
}
337335
}
338336
}

‎frontend/server/src/test/java/org/pytorch/serve/ModelServerTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ public void testModelWithInvalidCustomPythonDependency()
11691169
Assert.assertEquals(TestUtils.getHttpStatus(), HttpResponseStatus.BAD_REQUEST);
11701170
Assert.assertEquals(
11711171
resp.getMessage(),
1172-
"Custom pip package installation failed for custom_invalid_python_dep");
1172+
"Custom pip package installation failed for model custom_invalid_python_dep");
11731173
TestUtils.setConfiguration(configManager, "install_py_dep_per_model", "false");
11741174
channel.close().sync();
11751175
}

‎frontend/server/src/test/java/org/pytorch/serve/WorkflowTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ public void testWorkflowWithInvalidCustomPythonDependencyModel()
424424
Assert.assertEquals(TestUtils.getHttpStatus(), HttpResponseStatus.INTERNAL_SERVER_ERROR);
425425
Assert.assertEquals(
426426
resp.getMessage(),
427-
"Workflow custom_invalid_python_dep has failed to register. Failures: [Workflow Node custom_invalid_python_dep__custom_invalid_python_dep failed to register. Details: Custom pip package installation failed for custom_invalid_python_dep__custom_invalid_python_dep]");
427+
"Workflow custom_invalid_python_dep has failed to register. Failures: [Workflow Node custom_invalid_python_dep__custom_invalid_python_dep failed to register. Details: Custom pip package installation failed for model custom_invalid_python_dep__custom_invalid_python_dep]");
428428
TestUtils.setConfiguration(configManager, "install_py_dep_per_model", "false");
429429
channel.close().sync();
430430
}

0 commit comments

Comments
 (0)
Please sign in to comment.