-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Merge update model API and model level throttling/quota (#1624) * Update Model API (#1350) * Update Model API POC Signed-off-by: Sicheng Song <[email protected]> * Using GetRequest to get model Signed-off-by: Sicheng Song <[email protected]> * Finalize model update API Signed-off-by: Sicheng Song <[email protected]> * Fix compile Signed-off-by: Sicheng Song <[email protected]> * Fix compileTest Signed-off-by: Sicheng Song <[email protected]> * Add Unit Test Cases for Update Model API Signed-off-by: Sicheng Song <[email protected]> * Tune back test coverage thereshold Signed-off-by: Sicheng Song <[email protected]> * Add more unit tests on Update model API Signed-off-by: Sicheng Song <[email protected]> * Add unit test for TransportUpdateModelAction class Signed-off-by: Sicheng Song <[email protected]> * Fix a test error Signed-off-by: Sicheng Song <[email protected]> * Change exception thrown to failure response Signed-off-by: Sicheng Song <[email protected]> * Move the function judgement to the outter block Signed-off-by: Sicheng Song <[email protected]> * Check if model is undeployed before update model Signed-off-by: Sicheng Song <[email protected]> * Add more unit test for update model API Signed-off-by: Sicheng Song <[email protected]> * Fix unit test due to blocking java 11 CI workflow Signed-off-by: Sicheng Song <[email protected]> * Enabling auto bumping model version during registering to a new model group and address reviewers' other concern Signed-off-by: Sicheng Song <[email protected]> * Autobump new model groups' latest version when register to a new model Signed-off-by: Sicheng Song <[email protected]> * Change the REST API method from POST to PUT Signed-off-by: Sicheng Song <[email protected]> * Change the update REST API endpoint Signed-off-by: Sicheng Song <[email protected]> --------- Signed-off-by: Sicheng Song <[email protected]> * Fix java compile when merging Signed-off-by: Sicheng Song <[email protected]> * Fix model/connector update API to address security concern (#1595) * Fix model/connector update API to address appsec concern Signed-off-by: Sicheng Song <[email protected]> * Fix compile and build failure Signed-off-by: Sicheng Song <[email protected]> * Improve unit test coverage Signed-off-by: Sicheng Song <[email protected]> * Fix spotless Signed-off-by: Sicheng Song <[email protected]> * Merge update connector feature flag to remote inference feature flag Signed-off-by: Sicheng Song <[email protected]> * Fix compile Signed-off-by: Sicheng Song <[email protected]> * Fix exception status Signed-off-by: Sicheng Song <[email protected]> * Keep fixing exception status Signed-off-by: Sicheng Song <[email protected]> * Spotless fix Signed-off-by: Sicheng Song <[email protected]> * Add UT on parsing exception Signed-off-by: Sicheng Song <[email protected]> --------- Signed-off-by: Sicheng Song <[email protected]> * return parsing exception 400 for parsing errors (#1603) add more ut in restupdateconnector Signed-off-by: Xun Zhang <[email protected]> Signed-off-by: Sicheng Song <[email protected]> * throttling and quota feature on single node cluster Signed-off-by: Sicheng Song <[email protected]> * Fix java compile when merging Signed-off-by: Sicheng Song <[email protected]> * Enabling in-place update on multi-node Signed-off-by: Sicheng Song <[email protected]> * Fix confidential rotation in update internal connector Signed-off-by: Sicheng Song <[email protected]> --------- Signed-off-by: Sicheng Song <[email protected]> Signed-off-by: Xun Zhang <[email protected]> Co-authored-by: Xun Zhang <[email protected]> Signed-off-by: Sicheng Song <[email protected]> * merge conflict Signed-off-by: Sicheng Song <[email protected]> * Change rate limiter token capacity setting (#1635) Signed-off-by: Sicheng Song <[email protected]> * support step size for embedding model which outputs less embeddings (#1586) * support step size for embedding model which outputs less embeddings Signed-off-by: Yaliang Wu <[email protected]> * tune parameter name Signed-off-by: Yaliang Wu <[email protected]> * fine tune processed doc to always respect step size Signed-off-by: Yaliang Wu <[email protected]> --------- Signed-off-by: Yaliang Wu <[email protected]> Signed-off-by: Sicheng Song <[email protected]> * validate step size (#1587) Signed-off-by: Yaliang Wu <[email protected]> Signed-off-by: Sicheng Song <[email protected]> * backport to 2.11 (#1639) Signed-off-by: xinyual <[email protected]> Signed-off-by: Sicheng Song <[email protected]> --------- Signed-off-by: Sicheng Song <[email protected]> Signed-off-by: Xun Zhang <[email protected]> Signed-off-by: Yaliang Wu <[email protected]> Signed-off-by: xinyual <[email protected]> Co-authored-by: Xun Zhang <[email protected]> Co-authored-by: Yaliang Wu <[email protected]> Co-authored-by: xinyual <[email protected]>
- Loading branch information
1 parent
17181b7
commit d90ae06
Showing
39 changed files
with
3,150 additions
and
91 deletions.
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.