Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error message #1967

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,12 @@ public void downloadAndSplit(
DownloadUtils.download(url, modelPath, new ProgressBar());
verifyModelZipFile(modelFormat, modelPath, modelName, functionName);
String hash = calculateFileHash(modelZipFile);
if (hash.equals(modelContentHash)) {
if (modelContentHash == null) {
log.error("Hash code need to be provided when register via url.");
throw (new IllegalArgumentException(
"Model content Hash code need to be provided when register via url. Please calculate sha 256 Hash code."
));
} else if (hash.equals(modelContentHash)) {
List<String> chunkFiles = splitFileIntoChunks(modelZipFile, modelPartsPath, CHUNK_SIZE);
Map<String, Object> result = new HashMap<>();
result.put(CHUNK_FILES, chunkFiles);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ public void testDownloadAndSplit() throws URISyntaxException {
assertNotEquals(0, argumentCaptor.getValue().size());
}

@Test
public void testDownloadAndSplit_nullHashCode() throws URISyntaxException {
String modelUrl = getClass().getResource("traced_small_model.zip").toURI().toString();
modelHelper.downloadAndSplit(modelFormat, modelId, "model_name", "1", modelUrl, null, FunctionName.TEXT_EMBEDDING, actionListener);
ArgumentCaptor<Exception> argumentCaptor = ArgumentCaptor.forClass(Exception.class);
verify(actionListener).onFailure(argumentCaptor.capture());
assertEquals(IllegalArgumentException.class, argumentCaptor.getValue().getClass());
}

@Test
public void testDownloadAndSplit_HashFailure() throws URISyntaxException {
String modelUrl = getClass().getResource("traced_small_model.zip").toURI().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ private void deployModel(
"Model already deployed to these nodes: "
+ Arrays.toString(difference.toArray(new String[0]))
+ ", but they are not included in target node ids. Undeploy model from these nodes if don't need them any more."
+ "Undeploy from old nodes before try to deploy model on new nodes. Or include all old nodes on your target nodes."

)
);
return;
Expand Down
Loading