Skip to content

Commit

Permalink
fix no permission to update model group index (#948)
Browse files Browse the repository at this point in the history
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit da5db17)
  • Loading branch information
ylwu-amzn authored and github-actions[bot] committed Jun 1, 2023
1 parent b152ad3 commit 72149c4
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,19 @@ private void updateModelGroup(

UpdateRequest updateModelGroupRequest = new UpdateRequest();
updateModelGroupRequest.index(ML_MODEL_GROUP_INDEX).id(modelGroupId).doc(source);
client
.update(
updateModelGroupRequest,
ActionListener.wrap(r -> { listener.onResponse(new MLUpdateModelGroupResponse("Updated")); }, e -> {
log.error("Failed to update Model Group", e);
throw new MLException("Failed to update Model Group", e);
})
);
try (ThreadContext.StoredContext context = client.threadPool().getThreadContext().stashContext()) {
client
.update(
updateModelGroupRequest,
ActionListener.wrap(r -> { listener.onResponse(new MLUpdateModelGroupResponse("Updated")); }, e -> {
log.error("Failed to update Model Group", e);
throw new MLException("Failed to update Model Group", e);
})
);
} catch (Exception e) {
logException("Failed to Update model group ", e, log);
listener.onFailure(e);
}
}

private void validateRequestForAccessControl(MLUpdateModelGroupInput input, User user, MLModelGroup mlModelGroup) {
Expand Down

0 comments on commit 72149c4

Please sign in to comment.