Skip to content

Commit

Permalink
do not count remote model in checking the max models per node
Browse files Browse the repository at this point in the history
Signed-off-by: Xun Zhang <[email protected]>
  • Loading branch information
Zhangxunmt committed Jul 5, 2023
1 parent 236052d commit 08a5834
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@ public String[] getDeployedModels() {
.toArray(new String[0]);
}

/**
* Get deployed local models on node.
* @return array of model id
*/
public String[] getLocalDeployedModels() {
return modelCaches
.entrySet()
.stream()
.filter(entry -> (entry.getValue().getModelState() == MLModelState.DEPLOYED && entry.getValue().getFunctionName() != FunctionName.REMOTE))
.map(entry -> entry.getKey())
.collect(Collectors.toList())
.toArray(new String[0]);
}

/**
* Check if model is running on node.
* @param modelId model id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,8 @@ public void deployModel(
listener.onResponse("successful");
return;
}
if (modelCacheHelper.getDeployedModels().length >= maxModelPerNode) {
listener.onFailure(new IllegalArgumentException("Exceed max model per node limit"));
if (modelCacheHelper.getLocalDeployedModels().length >= maxModelPerNode) {
listener.onFailure(new IllegalArgumentException("Exceed max local model per node limit"));
return;
}
modelCacheHelper.initModelState(modelId, MLModelState.DEPLOYING, functionName, workerNodes, deployToAllNodes);
Expand Down

0 comments on commit 08a5834

Please sign in to comment.