-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[ML] Flag updates from Inference #131725
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
Merged
Merged
[ML] Flag updates from Inference #131725
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b124b8f
[ML] Use adaptive allocations in test
prwhelan 061cc5e
Merge branch 'main' into block-updates
prwhelan 9ddaec4
Flag when updates come from the inference endpoint
prwhelan b97a4ca
Merge branch 'main' of github.com:elastic/elasticsearch into block-up…
prwhelan 0107a7c
Change booleans to enum
prwhelan 00f7ba7
Merge branch 'main' into block-updates
prwhelan fd87934
Merge branch 'main' of github.com:prwhelan/elasticsearch into block-u…
prwhelan e9bc931
[CI] Update transport version definitions
87b4a29
Merge branch 'main' of github.com:elastic/elasticsearch into block-up…
prwhelan c14ed68
Merge branch 'main' of github.com:elastic/elasticsearch into block-up…
prwhelan 0e05b7a
rename transport version
prwhelan e671686
relocate source under request; rename to inference api
prwhelan 8dd8d94
Merge branch 'main' of github.com:elastic/elasticsearch into block-up…
prwhelan 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ | |
| import java.io.IOException; | ||
| import java.util.Objects; | ||
|
|
||
| import static org.elasticsearch.TransportVersions.INFERENCE_UPDATE_ML; | ||
| import static org.elasticsearch.xpack.core.ml.action.StartTrainedModelDeploymentAction.Request.ADAPTIVE_ALLOCATIONS; | ||
| import static org.elasticsearch.xpack.core.ml.action.StartTrainedModelDeploymentAction.Request.MODEL_ID; | ||
| import static org.elasticsearch.xpack.core.ml.action.StartTrainedModelDeploymentAction.Request.NUMBER_OF_ALLOCATIONS; | ||
|
|
@@ -74,6 +75,7 @@ public static Request parseRequest(String deploymentId, XContentParser parser) { | |
| private Integer numberOfAllocations; | ||
| private AdaptiveAllocationsSettings adaptiveAllocationsSettings; | ||
| private boolean isInternal; | ||
| private boolean fromInference; | ||
prwhelan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| private Request() { | ||
| super(TRAPPY_IMPLICIT_DEFAULT_MASTER_NODE_TIMEOUT, DEFAULT_ACK_TIMEOUT); | ||
|
|
@@ -96,6 +98,7 @@ public Request(StreamInput in) throws IOException { | |
| adaptiveAllocationsSettings = in.readOptionalWriteable(AdaptiveAllocationsSettings::new); | ||
| isInternal = in.readBoolean(); | ||
| } | ||
| fromInference = in.getTransportVersion().onOrAfter(INFERENCE_UPDATE_ML) && in.readBoolean(); | ||
| } | ||
|
|
||
| public final void setDeploymentId(String deploymentId) { | ||
|
|
@@ -126,6 +129,15 @@ public void setIsInternal(boolean isInternal) { | |
| this.isInternal = isInternal; | ||
| } | ||
|
|
||
| public boolean fromInference() { | ||
| return fromInference; | ||
| } | ||
|
|
||
| public void setFromInference(boolean fromInference) { | ||
| this.fromInference = fromInference; | ||
| this.isInternal = fromInference; | ||
|
||
| } | ||
|
|
||
| public AdaptiveAllocationsSettings getAdaptiveAllocationsSettings() { | ||
| return adaptiveAllocationsSettings; | ||
| } | ||
|
|
@@ -141,6 +153,9 @@ public void writeTo(StreamOutput out) throws IOException { | |
| out.writeOptionalWriteable(adaptiveAllocationsSettings); | ||
| out.writeBoolean(isInternal); | ||
| } | ||
| if (out.getTransportVersion().onOrAfter(INFERENCE_UPDATE_ML)) { | ||
| out.writeBoolean(fromInference); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -183,7 +198,7 @@ public ActionRequestValidationException validate() { | |
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(deploymentId, numberOfAllocations, adaptiveAllocationsSettings, isInternal); | ||
| return Objects.hash(deploymentId, numberOfAllocations, adaptiveAllocationsSettings, isInternal, fromInference); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -198,7 +213,8 @@ public boolean equals(Object obj) { | |
| return Objects.equals(deploymentId, other.deploymentId) | ||
| && Objects.equals(numberOfAllocations, other.numberOfAllocations) | ||
| && Objects.equals(adaptiveAllocationsSettings, other.adaptiveAllocationsSettings) | ||
| && isInternal == other.isInternal; | ||
| && isInternal == other.isInternal | ||
| && fromInference == other.fromInference; | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
This file contains hidden or 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 hidden or 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
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.
I'm missing a bit of context: why do we need to distinguish between these cases?
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.
Is there a corresponding Serverless PR?
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.
Yeah, let me ping you with the internal documentation
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.
We need to allow updates to
num_allocationsin serverless that originate from theAdaptiveAllocationsScalerService(ADAPTIVE_ALLOCATIONS), but we want to disallow updates from users (APIandINFERENCE). The only alternative I thought of was refactoringAdaptiveAllocationsScalerServiceto update directly rather than through the API, but that felt more intrusive.