Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 Oct 16, 2025
ecfe885
Update docs/changelog/136713.yaml
jonathan-buttner Oct 16, 2025
b6928b6
[CI] Auto commit changes from spotless
Oct 16, 2025
59ce7d0
Starting persistent tasks
jonathan-buttner Oct 17, 2025
273d551
Switching to a persistent task, need to create the action though
jonathan-buttner Oct 20, 2025
458664e
Adding master action
jonathan-buttner Oct 21, 2025
a7f0f91
Successful task creation
jonathan-buttner Oct 21, 2025
2e3246c
Starting tests
jonathan-buttner Oct 22, 2025
9e5ed51
More tests
jonathan-buttner Oct 22, 2025
36deff5
Even more tests
jonathan-buttner Oct 23, 2025
83f2c65
[CI] Auto commit changes from spotless
Oct 21, 2025
d39d7ef
Starting integration tests
jonathan-buttner Oct 24, 2025
02d4766
Adding test stub
jonathan-buttner Oct 24, 2025
b41b1d4
[CI] Auto commit changes from spotless
Oct 24, 2025
10ad8f2
Adding integration test
jonathan-buttner Oct 28, 2025
9762fc6
Fixing relocation test
jonathan-buttner Oct 29, 2025
0b1551d
[CI] Auto commit changes from spotless
Oct 29, 2025
6f2c27b
working test
jonathan-buttner Oct 29, 2025
9b764a6
Merge branch 'ml-eis-auth-polling' of github.com:jonathan-buttner/ela…
jonathan-buttner Oct 29, 2025
fd0b0cf
Some clean up
jonathan-buttner Oct 30, 2025
5f99fe2
Removing unneeded tests
jonathan-buttner Oct 30, 2025
75005b7
[CI] Auto commit changes from spotless
Oct 30, 2025
c34ac07
Refactoring tests
jonathan-buttner Oct 30, 2025
acb0620
Merge branch 'ml-eis-auth-polling' of github.com:jonathan-buttner/ela…
jonathan-buttner Oct 30, 2025
a27d2f7
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner Oct 30, 2025
df94ce9
updating transport version
jonathan-buttner Oct 30, 2025
a7e67f8
[CI] Auto commit changes from spotless
Oct 30, 2025
8c2a40a
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner Oct 30, 2025
4b2b33f
Fixing transport version
jonathan-buttner Oct 30, 2025
4b7e6cf
Fixing check for preconfigured endpoints
jonathan-buttner Nov 3, 2025
78c2a5c
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner Nov 3, 2025
909ef5e
[CI] Auto commit changes from spotless
Nov 3, 2025
f16b912
Fixing tests
jonathan-buttner Nov 3, 2025
4d23e3f
Merge branch 'ml-eis-auth-polling' of github.com:jonathan-buttner/ela…
jonathan-buttner Nov 3, 2025
fb2ac58
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner Nov 3, 2025
45d167d
Fixing text embedding test
jonathan-buttner Nov 3, 2025
ad63742
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner Nov 3, 2025
79ce4b1
Merge branch 'main' into ml-eis-auth-polling
jonathan-buttner Nov 4, 2025
bbe6d8b
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner Nov 4, 2025
c3badf1
Merge branch 'ml-eis-auth-polling' of github.com:jonathan-buttner/ela…
jonathan-buttner Nov 4, 2025
a0a07bc
Addressing feedback
jonathan-buttner Nov 6, 2025
b83d2dd
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner Nov 6, 2025
f994811
Marking task as failed
jonathan-buttner Nov 6, 2025
0fe203a
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner Nov 7, 2025
415c23b
Fixing flaky test
jonathan-buttner Nov 7, 2025
61dcee4
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-a…
jonathan-buttner Nov 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/136713.yaml
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: []
18 changes: 17 additions & 1 deletion server/src/main/java/org/elasticsearch/inference/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@

package org.elasticsearch.inference;

import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;

import java.io.IOException;
import java.util.Objects;

public class Model {
public class Model implements Writeable {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model needs to be serialized now because it's going to be sent to the master node to be stored in the inference index by the ModelRegistry.

public static String documentId(String modelId) {
return "model_" + modelId;
}
Expand Down Expand Up @@ -42,6 +47,11 @@ public Model(ModelConfigurations configurations) {
this(configurations, new ModelSecrets());
}

public Model(StreamInput in) throws IOException {
this.configurations = new ModelConfigurations(in);
this.secrets = new ModelSecrets(in);
}

public String getInferenceEntityId() {
return configurations.getInferenceEntityId();
}
Expand Down Expand Up @@ -111,4 +121,10 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(configurations, secrets);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
configurations.writeTo(out);
secrets.writeTo(out);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9215000
2 changes: 1 addition & 1 deletion server/src/main/resources/transport/upper_bounds/9.3.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
transform_preview_as_index_request,9214000
inference_api_eis_authorization_persistent_task,9215000
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);
}
}
}
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()
);
}
}
Loading