-
Notifications
You must be signed in to change notification settings - Fork 145
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
Model level quota and throttling feature with in-cache update #1620
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8fefe72
throttling and quota feature on single node cluster
b4sjoo 71879f7
Enabling in-place update on multi-node
b4sjoo 79335ec
Fix confidential rotation in update internal connector
b4sjoo a8629cf
Change rate limiter token capacity setting (#1635)
b4sjoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...on/src/main/java/org/opensearch/ml/common/transport/model/MLInPlaceUpdateModelAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.ml.common.transport.model; | ||
|
||
import org.opensearch.action.ActionType; | ||
|
||
public class MLInPlaceUpdateModelAction extends ActionType<MLInPlaceUpdateModelNodesResponse> { | ||
public static final MLInPlaceUpdateModelAction INSTANCE = new MLInPlaceUpdateModelAction(); | ||
public static final String NAME = "cluster:admin/opensearch/ml/models/in_place_update"; | ||
|
||
private MLInPlaceUpdateModelAction() { super(NAME, MLInPlaceUpdateModelNodesResponse::new);} | ||
} |
32 changes: 32 additions & 0 deletions
32
...c/main/java/org/opensearch/ml/common/transport/model/MLInPlaceUpdateModelNodeRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.ml.common.transport.model; | ||
|
||
import org.opensearch.action.support.nodes.BaseNodeRequest; | ||
import java.io.IOException; | ||
import lombok.Getter; | ||
import org.opensearch.core.common.io.stream.StreamInput; | ||
import org.opensearch.core.common.io.stream.StreamOutput; | ||
|
||
public class MLInPlaceUpdateModelNodeRequest extends BaseNodeRequest { | ||
@Getter | ||
private MLInPlaceUpdateModelNodesRequest mlInPlaceUpdateModelNodesRequest; | ||
|
||
public MLInPlaceUpdateModelNodeRequest(StreamInput in) throws IOException { | ||
super(in); | ||
this.mlInPlaceUpdateModelNodesRequest = new MLInPlaceUpdateModelNodesRequest(in); | ||
} | ||
|
||
public MLInPlaceUpdateModelNodeRequest(MLInPlaceUpdateModelNodesRequest request) { | ||
this.mlInPlaceUpdateModelNodesRequest = request; | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
super.writeTo(out); | ||
mlInPlaceUpdateModelNodesRequest.writeTo(out); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
.../main/java/org/opensearch/ml/common/transport/model/MLInPlaceUpdateModelNodeResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.ml.common.transport.model; | ||
|
||
import lombok.Getter; | ||
import lombok.extern.log4j.Log4j2; | ||
import org.opensearch.action.support.nodes.BaseNodeResponse; | ||
import org.opensearch.cluster.node.DiscoveryNode; | ||
import org.opensearch.core.common.io.stream.StreamInput; | ||
import org.opensearch.core.common.io.stream.StreamOutput; | ||
import org.opensearch.core.xcontent.ToXContentFragment; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
@Getter | ||
@Log4j2 | ||
public class MLInPlaceUpdateModelNodeResponse extends BaseNodeResponse implements ToXContentFragment { | ||
private Map<String, String> modelUpdateStatus; | ||
|
||
public MLInPlaceUpdateModelNodeResponse(DiscoveryNode node, Map<String, String> modelUpdateStatus) { | ||
super(node); | ||
this.modelUpdateStatus = modelUpdateStatus; | ||
} | ||
|
||
public MLInPlaceUpdateModelNodeResponse(StreamInput in) throws IOException { | ||
super(in); | ||
if (in.readBoolean()) { | ||
this.modelUpdateStatus = in.readMap(StreamInput::readString, StreamInput::readString); | ||
} | ||
} | ||
|
||
public static MLInPlaceUpdateModelNodeResponse readStats(StreamInput in) throws IOException { | ||
return new MLInPlaceUpdateModelNodeResponse(in); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
super.writeTo(out); | ||
|
||
if (!isEmpty()) { | ||
out.writeBoolean(true); | ||
out.writeMap(modelUpdateStatus, StreamOutput::writeString, StreamOutput::writeString); | ||
} else { | ||
out.writeBoolean(false); | ||
} | ||
} | ||
|
||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||
builder.startObject("stats"); | ||
if (modelUpdateStatus != null && modelUpdateStatus.size() > 0) { | ||
for (Map.Entry<String, String> stat : modelUpdateStatus.entrySet()) { | ||
builder.field(stat.getKey(), stat.getValue()); | ||
} | ||
} | ||
builder.endObject(); | ||
return builder; | ||
} | ||
|
||
public boolean isEmpty() { | ||
return modelUpdateStatus == null || modelUpdateStatus.size() == 0; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
.../main/java/org/opensearch/ml/common/transport/model/MLInPlaceUpdateModelNodesRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.ml.common.transport.model; | ||
|
||
import lombok.Getter; | ||
import org.opensearch.action.support.nodes.BaseNodesRequest; | ||
import org.opensearch.cluster.node.DiscoveryNode; | ||
import org.opensearch.core.common.io.stream.StreamInput; | ||
import org.opensearch.core.common.io.stream.StreamOutput; | ||
import java.io.IOException; | ||
|
||
public class MLInPlaceUpdateModelNodesRequest extends BaseNodesRequest<MLInPlaceUpdateModelNodesRequest> { | ||
|
||
@Getter | ||
private String modelId; | ||
@Getter | ||
private boolean updatePredictorFlag; | ||
|
||
public MLInPlaceUpdateModelNodesRequest(StreamInput in) throws IOException { | ||
super(in); | ||
this.modelId = in.readString(); | ||
this.updatePredictorFlag = in.readBoolean(); | ||
} | ||
|
||
public MLInPlaceUpdateModelNodesRequest(String[] nodeIds, String modelId, boolean updatePredictorFlag) { | ||
super(nodeIds); | ||
this.modelId = modelId; | ||
this.updatePredictorFlag = updatePredictorFlag; | ||
} | ||
|
||
public MLInPlaceUpdateModelNodesRequest(DiscoveryNode[] nodeIds, String modelId, boolean updatePredictorFlag) { | ||
super(nodeIds); | ||
this.modelId = modelId; | ||
this.updatePredictorFlag = updatePredictorFlag; | ||
} | ||
|
||
public MLInPlaceUpdateModelNodesRequest(DiscoveryNode... nodes) { | ||
super(nodes); | ||
this.updatePredictorFlag = false; | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
super.writeTo(out); | ||
out.writeString(modelId); | ||
out.writeBoolean(updatePredictorFlag); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will rollback when merge.