Skip to content

Commit efd0251

Browse files
authored
Merge branch 'main' into fix/SearchWithRandomDisconnectsIT_testSearchWithRandomDisconnects
2 parents e6608ce + 89adec1 commit efd0251

File tree

15 files changed

+92
-139
lines changed

15 files changed

+92
-139
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ expensive messages that will usually be discarded:
467467

468468
Logging is an important behaviour of the system and sometimes deserves its own
469469
unit tests, especially if there is complex logic for computing what is logged
470-
and when to log it. You can use a `org.elasticsearch.test.MockLogAppender` to
470+
and when to log it. You can use a `org.elasticsearch.test.MockLog` to
471471
make assertions about the logs that are being emitted.
472472

473473
Logging is a powerful diagnostic technique, but it is not the only possibility.

docs/changelog/125477.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 125477
2+
summary: Prevent get datafeeds stats API returning an error when local tasks are slow to stop
3+
area: Machine Learning
4+
type: bug
5+
issues:
6+
- 104160

server/src/main/java/org/elasticsearch/inference/InferenceServiceResults.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,12 @@ public interface InferenceServiceResults extends NamedWriteable, ChunkedToXConte
2424

2525
/**
2626
* <p>Transform the result to match the format required for the TransportCoordinatedInferenceAction.
27-
* For the inference plugin TextEmbeddingResults, the {@link #transformToLegacyFormat()} transforms the
28-
* results into an intermediate format only used by the plugin's return value. It doesn't align with what the
29-
* TransportCoordinatedInferenceAction expects. TransportCoordinatedInferenceAction expects an ml plugin
30-
* TextEmbeddingResults.</p>
31-
*
32-
* <p>For other results like SparseEmbeddingResults, this method can be a pass through to the transformToLegacyFormat.</p>
27+
* TransportCoordinatedInferenceAction expects an ml plugin TextEmbeddingResults or SparseEmbeddingResults.</p>
3328
*/
3429
default List<? extends InferenceResults> transformToCoordinationFormat() {
3530
throw new UnsupportedOperationException("transformToCoordinationFormat() is not implemented");
3631
}
3732

38-
/**
39-
* Transform the result to match the format required for versions prior to
40-
* {@link org.elasticsearch.TransportVersions#V_8_12_0}
41-
*/
42-
default List<? extends InferenceResults> transformToLegacyFormat() {
43-
throw new UnsupportedOperationException("transformToLegacyFormat() is not implemented");
44-
}
45-
4633
/**
4734
* Convert the result to a map to aid with test assertions
4835
*/

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/action/InferenceAction.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -580,12 +580,8 @@ public Flow.Publisher<InferenceServiceResults.Result> publisher() {
580580

581581
@Override
582582
public void writeTo(StreamOutput out) throws IOException {
583-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
584-
out.writeNamedWriteable(results);
585-
} else {
586-
out.writeNamedWriteable(results.transformToLegacyFormat().get(0));
587-
}
588583
// streaming isn't supported via Writeable yet
584+
out.writeNamedWriteable(results);
589585
}
590586

591587
@Override

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ChatCompletionResults.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ public List<? extends InferenceResults> transformToCoordinationFormat() {
6868
return results;
6969
}
7070

71-
@Override
72-
public List<? extends InferenceResults> transformToLegacyFormat() {
73-
throw new UnsupportedOperationException();
74-
}
75-
7671
public List<Result> getResults() {
7772
return results;
7873
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/RankedDocsResults.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,6 @@ public List<? extends InferenceResults> transformToCoordinationFormat() {
196196
throw new UnsupportedOperationException("Coordination format not supported by " + NAME);
197197
}
198198

199-
@Override
200-
public List<? extends InferenceResults> transformToLegacyFormat() {
201-
throw new UnsupportedOperationException("Legacy format not supported by " + NAME);
202-
}
203-
204199
@Override
205200
public Map<String, Object> asMap() {
206201
Map<String, Object> map = new LinkedHashMap<>();

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/SparseEmbeddingResults.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ public Map<String, Object> asMap() {
100100

101101
@Override
102102
public List<? extends InferenceResults> transformToCoordinationFormat() {
103-
return transformToLegacyFormat();
104-
}
105-
106-
@Override
107-
public List<? extends InferenceResults> transformToLegacyFormat() {
108103
return embeddings.stream()
109104
.map(
110105
embedding -> new TextExpansionResults(

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/TextEmbeddingBitResults.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,6 @@ public List<? extends InferenceResults> transformToCoordinationFormat() {
8383
.toList();
8484
}
8585

86-
@Override
87-
@SuppressWarnings("deprecation")
88-
public List<? extends InferenceResults> transformToLegacyFormat() {
89-
var legacyEmbedding = new LegacyTextEmbeddingResults(
90-
embeddings.stream().map(embedding -> new LegacyTextEmbeddingResults.Embedding(embedding.toFloatArray())).toList()
91-
);
92-
93-
return List.of(legacyEmbedding);
94-
}
95-
9686
public Map<String, Object> asMap() {
9787
Map<String, Object> map = new LinkedHashMap<>();
9888
map.put(TEXT_EMBEDDING_BITS, embeddings);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/TextEmbeddingByteResults.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,6 @@ public List<? extends InferenceResults> transformToCoordinationFormat() {
8585
.toList();
8686
}
8787

88-
@Override
89-
@SuppressWarnings("deprecation")
90-
public List<? extends InferenceResults> transformToLegacyFormat() {
91-
var legacyEmbedding = new LegacyTextEmbeddingResults(
92-
embeddings.stream().map(embedding -> new LegacyTextEmbeddingResults.Embedding(embedding.toFloatArray())).toList()
93-
);
94-
95-
return List.of(legacyEmbedding);
96-
}
97-
9888
public Map<String, Object> asMap() {
9989
Map<String, Object> map = new LinkedHashMap<>();
10090
map.put(TEXT_EMBEDDING_BYTES, embeddings);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/TextEmbeddingFloatResults.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,6 @@ public List<? extends InferenceResults> transformToCoordinationFormat() {
122122
return embeddings.stream().map(embedding -> new MlTextEmbeddingResults(TEXT_EMBEDDING, embedding.asDoubleArray(), false)).toList();
123123
}
124124

125-
@Override
126-
@SuppressWarnings("deprecation")
127-
public List<? extends InferenceResults> transformToLegacyFormat() {
128-
var legacyEmbedding = new LegacyTextEmbeddingResults(
129-
embeddings.stream().map(embedding -> new LegacyTextEmbeddingResults.Embedding(embedding.values)).toList()
130-
);
131-
132-
return List.of(legacyEmbedding);
133-
}
134-
135125
public Map<String, Object> asMap() {
136126
Map<String, Object> map = new LinkedHashMap<>();
137127
map.put(TEXT_EMBEDDING, embeddings);

0 commit comments

Comments
 (0)