-
Notifications
You must be signed in to change notification settings - Fork 138
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
Merge update model API and model level throttling/quota #1624
Merged
ylwu-amzn
merged 8 commits into
opensearch-project:feature/agent_framework_dev
from
b4sjoo:agent_framework_throttling_update
Nov 13, 2023
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ef3af69
Update Model API (#1350)
b4sjoo 23d6a5e
Fix java compile when merging
b4sjoo 948b38a
Fix model/connector update API to address security concern (#1595)
b4sjoo f83ef2c
return parsing exception 400 for parsing errors (#1603)
Zhangxunmt 43d4598
throttling and quota feature on single node cluster
b4sjoo 60d2e76
Fix java compile when merging
b4sjoo 777fede
Enabling in-place update on multi-node
b4sjoo c5af0c9
Fix confidential rotation in update internal connector
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
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.
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.
no need to fix in this PR. Suggest merge
RATE_LIMIT_NUMBER_FIELD
andRATE_LIMIT_UNIT_FIELD
into one filed