-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[ML] Transition EIS auth polling to persistent task on a single node #136713
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
jonathan-buttner
merged 46 commits into
elastic:main
from
jonathan-buttner:ml-eis-auth-polling
Nov 10, 2025
Merged
Changes from 21 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
c6fc960
Creating new cluster state listener to kick off polling logic
jonathan-buttner ecfe885
Update docs/changelog/136713.yaml
jonathan-buttner b6928b6
[CI] Auto commit changes from spotless
59ce7d0
Starting persistent tasks
jonathan-buttner 273d551
Switching to a persistent task, need to create the action though
jonathan-buttner 458664e
Adding master action
jonathan-buttner a7f0f91
Successful task creation
jonathan-buttner 2e3246c
Starting tests
jonathan-buttner 9e5ed51
More tests
jonathan-buttner 36deff5
Even more tests
jonathan-buttner 83f2c65
[CI] Auto commit changes from spotless
d39d7ef
Starting integration tests
jonathan-buttner 02d4766
Adding test stub
jonathan-buttner b41b1d4
[CI] Auto commit changes from spotless
10ad8f2
Adding integration test
jonathan-buttner 9762fc6
Fixing relocation test
jonathan-buttner 0b1551d
[CI] Auto commit changes from spotless
6f2c27b
working test
jonathan-buttner 9b764a6
Merge branch 'ml-eis-auth-polling' of github.com:jonathan-buttner/ela…
jonathan-buttner fd0b0cf
Some clean up
jonathan-buttner 5f99fe2
Removing unneeded tests
jonathan-buttner 75005b7
[CI] Auto commit changes from spotless
c34ac07
Refactoring tests
jonathan-buttner acb0620
Merge branch 'ml-eis-auth-polling' of github.com:jonathan-buttner/ela…
jonathan-buttner a27d2f7
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner df94ce9
updating transport version
jonathan-buttner a7e67f8
[CI] Auto commit changes from spotless
8c2a40a
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner 4b2b33f
Fixing transport version
jonathan-buttner 4b7e6cf
Fixing check for preconfigured endpoints
jonathan-buttner 78c2a5c
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner 909ef5e
[CI] Auto commit changes from spotless
f16b912
Fixing tests
jonathan-buttner 4d23e3f
Merge branch 'ml-eis-auth-polling' of github.com:jonathan-buttner/ela…
jonathan-buttner fb2ac58
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner 45d167d
Fixing text embedding test
jonathan-buttner ad63742
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner 79ce4b1
Merge branch 'main' into ml-eis-auth-polling
jonathan-buttner bbe6d8b
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner c3badf1
Merge branch 'ml-eis-auth-polling' of github.com:jonathan-buttner/ela…
jonathan-buttner a0a07bc
Addressing feedback
jonathan-buttner b83d2dd
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner f994811
Marking task as failed
jonathan-buttner 0fe203a
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner 415c23b
Fixing flaky test
jonathan-buttner 61dcee4
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner 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 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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 136713 | ||
| summary: Transition EIS auth polling to persistent task on a single node | ||
| area: Machine Learning | ||
| type: enhancement | ||
| issues: [] |
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
1 change: 1 addition & 0 deletions
1
...urces/transport/definitions/referable/inference_api_eis_authorization_persistent_task.csv
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 9205000 |
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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| esql_resolve_fields_response_used,9204000 | ||
| inference_api_eis_authorization_persistent_task,9205000 |
105 changes: 105 additions & 0 deletions
105
...ain/java/org/elasticsearch/xpack/core/inference/action/StoreInferenceEndpointsAction.java
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 |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| package org.elasticsearch.xpack.core.inference.action; | ||
|
|
||
| import org.elasticsearch.action.ActionResponse; | ||
| import org.elasticsearch.action.ActionType; | ||
| import org.elasticsearch.action.support.master.AcknowledgedRequest; | ||
| import org.elasticsearch.common.io.stream.StreamInput; | ||
| import org.elasticsearch.common.io.stream.StreamOutput; | ||
| import org.elasticsearch.core.TimeValue; | ||
| import org.elasticsearch.inference.Model; | ||
| import org.elasticsearch.xpack.core.inference.results.ModelStoreResponse; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Internal action to store inference endpoints and return the results of the store operation. This should only be used internally and not | ||
| * exposed via a REST API. | ||
| * For the exposed REST API action see {@link PutInferenceModelAction}. | ||
| */ | ||
| public class StoreInferenceEndpointsAction extends ActionType<StoreInferenceEndpointsAction.Response> { | ||
|
|
||
| public static final StoreInferenceEndpointsAction INSTANCE = new StoreInferenceEndpointsAction(); | ||
| public static final String NAME = "cluster:internal/xpack/inference/create_endpoints"; | ||
|
|
||
| public StoreInferenceEndpointsAction() { | ||
| super(NAME); | ||
| } | ||
|
|
||
| public static class Request extends AcknowledgedRequest<Request> { | ||
| private final List<Model> models; | ||
|
|
||
| public Request(List<Model> models, TimeValue timeout) { | ||
| super(timeout, DEFAULT_ACK_TIMEOUT); | ||
| this.models = Objects.requireNonNull(models); | ||
| } | ||
|
|
||
| public Request(StreamInput in) throws IOException { | ||
| super(in); | ||
| models = in.readCollectionAsImmutableList(Model::new); | ||
| } | ||
|
|
||
| @Override | ||
| public void writeTo(StreamOutput out) throws IOException { | ||
| super.writeTo(out); | ||
| out.writeCollection(models); | ||
| } | ||
|
|
||
| public List<Model> getModels() { | ||
| return models; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (o == null || getClass() != o.getClass()) return false; | ||
| Request request = (Request) o; | ||
| return Objects.equals(models, request.models); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hashCode(models); | ||
| } | ||
| } | ||
|
|
||
| public static class Response extends ActionResponse { | ||
| private final List<ModelStoreResponse> results; | ||
|
|
||
| public Response(List<ModelStoreResponse> results) { | ||
| this.results = results; | ||
| } | ||
|
|
||
| public Response(StreamInput in) throws IOException { | ||
| results = in.readCollectionAsImmutableList(ModelStoreResponse::new); | ||
| } | ||
|
|
||
| public List<ModelStoreResponse> getResults() { | ||
| return results; | ||
| } | ||
|
|
||
| @Override | ||
| public void writeTo(StreamOutput out) throws IOException { | ||
| out.writeCollection(results); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (o == null || getClass() != o.getClass()) return false; | ||
| Response response = (Response) o; | ||
| return Objects.equals(results, response.results); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(results); | ||
| } | ||
| } | ||
| } |
65 changes: 65 additions & 0 deletions
65
...core/src/main/java/org/elasticsearch/xpack/core/inference/results/ModelStoreResponse.java
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 |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| package org.elasticsearch.xpack.core.inference.results; | ||
|
|
||
| import org.elasticsearch.common.io.stream.StreamInput; | ||
| import org.elasticsearch.common.io.stream.StreamOutput; | ||
| import org.elasticsearch.common.io.stream.Writeable; | ||
| import org.elasticsearch.core.Nullable; | ||
| import org.elasticsearch.rest.RestStatus; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Response for storing a model in the model registry using the bulk API. | ||
| */ | ||
| public record ModelStoreResponse(String inferenceId, RestStatus status, @Nullable Exception failureCause) implements Writeable { | ||
|
|
||
| public ModelStoreResponse(StreamInput in) throws IOException { | ||
| this(in.readString(), RestStatus.readFrom(in), in.readException()); | ||
| } | ||
|
|
||
| public boolean failed() { | ||
| return failureCause != null; | ||
| } | ||
|
|
||
| @Override | ||
| public void writeTo(StreamOutput out) throws IOException { | ||
| out.writeString(inferenceId); | ||
| RestStatus.writeTo(out, status); | ||
| out.writeException(failureCause); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (o == null || getClass() != o.getClass()) return false; | ||
| ModelStoreResponse that = (ModelStoreResponse) o; | ||
| return status == that.status && Objects.equals(inferenceId, that.inferenceId) | ||
| // Exception does not have hashCode() or equals() so assume errors are equal iff class and message are equal | ||
| && Objects.equals( | ||
| failureCause == null ? null : failureCause.getMessage(), | ||
| that.failureCause == null ? null : that.failureCause.getMessage() | ||
| ) | ||
| && Objects.equals( | ||
| failureCause == null ? null : failureCause.getClass(), | ||
| that.failureCause == null ? null : that.failureCause.getClass() | ||
| ); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash( | ||
| inferenceId, | ||
| status, | ||
| // Exception does not have hashCode() or equals() so assume errors are equal iff class and message are equal | ||
| failureCause == null ? null : failureCause.getMessage(), | ||
| failureCause == null ? null : failureCause.getClass() | ||
| ); | ||
| } | ||
| } |
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.
Modelneeds to be serialized now because it's going to be sent to the master node to be stored in the inference index by theModelRegistry.