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

set model state as partially loaded if unload model from partial nodes #806

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

ylwu-amzn
Copy link
Collaborator

@ylwu-amzn ylwu-amzn commented Mar 16, 2023

Description

If user deploy model to multiple ML nodes, then unload model from one ML node, the model state will become UNLOADED. This is not correct. We should set the model state as PARTIALLY_LOADED. This PR fixed this bug.

Issues Resolved

#805

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@ylwu-amzn ylwu-amzn requested a review from a team March 16, 2023 16:01
@@ -128,7 +139,11 @@ protected UnloadModelNodesResponse newResponse(
BulkRequest bulkRequest = new BulkRequest();
for (String modelId : removedNodeMap.keySet()) {
UpdateRequest updateRequest = new UpdateRequest();
updateRequest.index(ML_MODEL_INDEX).id(modelId).doc(ImmutableMap.of(MODEL_STATE_FIELD, MLModelState.UNLOADED));
int removedNodeCount = removedNodeMap.get(modelId).size();
MLModelState mlModelState = modelWorkNodeCounts.get(modelId) > removedNodeCount
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to check if removedNodeCount > 0 here?
modelWorkNodeCounts.get(modelId) > removedNodeCount && removedNodeCount > 0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removedNodeCount will always > 0, check line 121

@ylwu-amzn ylwu-amzn merged commit 894f983 into opensearch-project:2.x Mar 16, 2023
ylwu-amzn added a commit to ylwu-amzn/ml-commons that referenced this pull request Mar 16, 2023
ylwu-amzn added a commit that referenced this pull request Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants