4
4
*/
5
5
package org .opensearch .neuralsearch .bwc .rolling ;
6
6
7
- import org .opensearch .neuralsearch .stats .events .EventStatName ;
8
- import org .opensearch .neuralsearch .stats .info .InfoStatName ;
9
-
10
- import java .nio .file .Files ;
11
- import java .nio .file .Path ;
12
- import java .util .ArrayList ;
13
- import java .util .Map ;
14
-
15
- import static org .opensearch .neuralsearch .util .TestUtils .NODES_BWC_CLUSTER ;
16
- import static org .opensearch .neuralsearch .util .TestUtils .TEXT_EMBEDDING_PROCESSOR ;
17
- import static org .opensearch .neuralsearch .util .TestUtils .getModelId ;
18
-
19
7
public class RestNeuralStatsActionIT extends AbstractRollingUpgradeTestCase {
20
8
private static final String PIPELINE_NAME = "nlp-pipeline-stats" ;
21
9
private static final String TEST_FIELD = "passage_text" ;
@@ -32,91 +20,91 @@ public class RestNeuralStatsActionIT extends AbstractRollingUpgradeTestCase {
32
20
// TODO: There is a bug in stats api which need to be fixed before enabling following tests
33
21
// https://github.com/opensearch-project/neural-search/issues/1368
34
22
35
- // public void testStats_E2EFlow() throws Exception {
36
- //
37
- // waitForClusterHealthGreen(NODES_BWC_CLUSTER, 90);
38
- // updateClusterSettings("plugins.neural_search.stats_enabled", true);
39
- //
40
- // // Get initial stats
41
- // String responseBody = executeNeuralStatRequest(new ArrayList<>(), new ArrayList<>());
42
- // logger.info("Initial:" + responseBody);
43
- // Map<String, Object> infoStats = parseInfoStatsResponse(responseBody);
44
- // Map<String, Object> aggregatedNodeStats = parseAggregatedNodeStatsResponse(responseBody);
45
- //
46
- // int numberOfExecution = (int) getNestedValue(aggregatedNodeStats, EventStatName.TEXT_EMBEDDING_PROCESSOR_EXECUTIONS);
47
- // int numberOfProcessor = (int) getNestedValue(infoStats, InfoStatName.TEXT_EMBEDDING_PROCESSORS);
48
- //
49
- // switch (getClusterType()) {
50
- // case OLD:
51
- // modelId = uploadTextEmbeddingModel();
52
- // loadModel(modelId);
53
- // createPipelineProcessor(modelId, PIPELINE_NAME);
54
- // createIndexWithConfiguration(
55
- // getIndexNameForTest(),
56
- // Files.readString(Path.of(classLoader.getResource("processor/IndexMappings.json").toURI())),
57
- // PIPELINE_NAME
58
- // );
59
- // addDocument(getIndexNameForTest(), "0", TEST_FIELD, TEXT, null, null);
60
- // addDocument(getIndexNameForTest(), "1", TEST_FIELD, TEXT, null, null);
61
- // addDocument(getIndexNameForTest(), "2", TEST_FIELD, TEXT, null, null);
62
- //
63
- // responseBody = executeNeuralStatRequest(new ArrayList<>(), new ArrayList<>());
64
- // logger.info("Old after insert:" + responseBody);
65
- // assertEquals(
66
- // numberOfExecution + 3,
67
- // getNestedValue(parseAggregatedNodeStatsResponse(responseBody), EventStatName.TEXT_EMBEDDING_PROCESSOR_EXECUTIONS)
68
- // );
69
- // assertEquals(
70
- // numberOfProcessor + 1,
71
- // getNestedValue(parseInfoStatsResponse(responseBody), InfoStatName.TEXT_EMBEDDING_PROCESSORS)
72
- // );
73
- // break;
74
- // case MIXED:
75
- // modelId = getModelId(getIngestionPipeline(PIPELINE_NAME), TEXT_EMBEDDING_PROCESSOR);
76
- // loadModel(modelId);
77
- // addDocument(getIndexNameForTest(), "3", TEST_FIELD, TEXT_MIXED, null, null);
78
- // addDocument(getIndexNameForTest(), "4", TEST_FIELD, TEXT_MIXED, null, null);
79
- // addDocument(getIndexNameForTest(), "5", TEST_FIELD, TEXT_MIXED, null, null);
80
- //
81
- // // Get stats
82
- // responseBody = executeNeuralStatRequest(new ArrayList<>(), new ArrayList<>());
83
- // logger.info("Mixed after insert:" + responseBody);
84
- //
85
- // assertEquals(
86
- // numberOfExecution + 3,
87
- // getNestedValue(parseAggregatedNodeStatsResponse(responseBody), EventStatName.TEXT_EMBEDDING_PROCESSOR_EXECUTIONS)
88
- // );
89
- // assertEquals(
90
- // numberOfProcessor,
91
- // getNestedValue(parseInfoStatsResponse(responseBody), InfoStatName.TEXT_EMBEDDING_PROCESSORS)
92
- // );
93
- // break;
94
- // case UPGRADED:
95
- // try {
96
- // modelId = getModelId(getIngestionPipeline(PIPELINE_NAME), TEXT_EMBEDDING_PROCESSOR);
97
- // loadModel(modelId);
98
- // addDocument(getIndexNameForTest(), "6", TEST_FIELD, TEXT_UPGRADED, null, null);
99
- // addDocument(getIndexNameForTest(), "7", TEST_FIELD, TEXT_UPGRADED, null, null);
100
- // addDocument(getIndexNameForTest(), "8", TEST_FIELD, TEXT_UPGRADED, null, null);
101
- //
102
- // // Get stats
103
- // responseBody = executeNeuralStatRequest(new ArrayList<>(), new ArrayList<>());
104
- // logger.info("Upgraded after insert:" + responseBody);
105
- //
106
- // assertEquals(
107
- // numberOfExecution + 3,
108
- // getNestedValue(parseAggregatedNodeStatsResponse(responseBody), EventStatName.TEXT_EMBEDDING_PROCESSOR_EXECUTIONS)
109
- // );
110
- // assertEquals(
111
- // numberOfProcessor,
112
- // getNestedValue(parseInfoStatsResponse(responseBody), InfoStatName.TEXT_EMBEDDING_PROCESSORS)
113
- // );
114
- // } finally {
115
- // wipeOfTestResources(getIndexNameForTest(), PIPELINE_NAME, modelId, null);
116
- // }
117
- // break;
118
- // default:
119
- // throw new IllegalStateException("Unexpected value: " + getClusterType());
120
- // }
121
- // }
23
+ // public void testStats_E2EFlow() throws Exception {
24
+ //
25
+ // waitForClusterHealthGreen(NODES_BWC_CLUSTER, 90);
26
+ // updateClusterSettings("plugins.neural_search.stats_enabled", true);
27
+ //
28
+ // // Get initial stats
29
+ // String responseBody = executeNeuralStatRequest(new ArrayList<>(), new ArrayList<>());
30
+ // logger.info("Initial:" + responseBody);
31
+ // Map<String, Object> infoStats = parseInfoStatsResponse(responseBody);
32
+ // Map<String, Object> aggregatedNodeStats = parseAggregatedNodeStatsResponse(responseBody);
33
+ //
34
+ // int numberOfExecution = (int) getNestedValue(aggregatedNodeStats, EventStatName.TEXT_EMBEDDING_PROCESSOR_EXECUTIONS);
35
+ // int numberOfProcessor = (int) getNestedValue(infoStats, InfoStatName.TEXT_EMBEDDING_PROCESSORS);
36
+ //
37
+ // switch (getClusterType()) {
38
+ // case OLD:
39
+ // modelId = uploadTextEmbeddingModel();
40
+ // loadModel(modelId);
41
+ // createPipelineProcessor(modelId, PIPELINE_NAME);
42
+ // createIndexWithConfiguration(
43
+ // getIndexNameForTest(),
44
+ // Files.readString(Path.of(classLoader.getResource("processor/IndexMappings.json").toURI())),
45
+ // PIPELINE_NAME
46
+ // );
47
+ // addDocument(getIndexNameForTest(), "0", TEST_FIELD, TEXT, null, null);
48
+ // addDocument(getIndexNameForTest(), "1", TEST_FIELD, TEXT, null, null);
49
+ // addDocument(getIndexNameForTest(), "2", TEST_FIELD, TEXT, null, null);
50
+ //
51
+ // responseBody = executeNeuralStatRequest(new ArrayList<>(), new ArrayList<>());
52
+ // logger.info("Old after insert:" + responseBody);
53
+ // assertEquals(
54
+ // numberOfExecution + 3,
55
+ // getNestedValue(parseAggregatedNodeStatsResponse(responseBody), EventStatName.TEXT_EMBEDDING_PROCESSOR_EXECUTIONS)
56
+ // );
57
+ // assertEquals(
58
+ // numberOfProcessor + 1,
59
+ // getNestedValue(parseInfoStatsResponse(responseBody), InfoStatName.TEXT_EMBEDDING_PROCESSORS)
60
+ // );
61
+ // break;
62
+ // case MIXED:
63
+ // modelId = getModelId(getIngestionPipeline(PIPELINE_NAME), TEXT_EMBEDDING_PROCESSOR);
64
+ // loadModel(modelId);
65
+ // addDocument(getIndexNameForTest(), "3", TEST_FIELD, TEXT_MIXED, null, null);
66
+ // addDocument(getIndexNameForTest(), "4", TEST_FIELD, TEXT_MIXED, null, null);
67
+ // addDocument(getIndexNameForTest(), "5", TEST_FIELD, TEXT_MIXED, null, null);
68
+ //
69
+ // // Get stats
70
+ // responseBody = executeNeuralStatRequest(new ArrayList<>(), new ArrayList<>());
71
+ // logger.info("Mixed after insert:" + responseBody);
72
+ //
73
+ // assertEquals(
74
+ // numberOfExecution + 3,
75
+ // getNestedValue(parseAggregatedNodeStatsResponse(responseBody), EventStatName.TEXT_EMBEDDING_PROCESSOR_EXECUTIONS)
76
+ // );
77
+ // assertEquals(
78
+ // numberOfProcessor,
79
+ // getNestedValue(parseInfoStatsResponse(responseBody), InfoStatName.TEXT_EMBEDDING_PROCESSORS)
80
+ // );
81
+ // break;
82
+ // case UPGRADED:
83
+ // try {
84
+ // modelId = getModelId(getIngestionPipeline(PIPELINE_NAME), TEXT_EMBEDDING_PROCESSOR);
85
+ // loadModel(modelId);
86
+ // addDocument(getIndexNameForTest(), "6", TEST_FIELD, TEXT_UPGRADED, null, null);
87
+ // addDocument(getIndexNameForTest(), "7", TEST_FIELD, TEXT_UPGRADED, null, null);
88
+ // addDocument(getIndexNameForTest(), "8", TEST_FIELD, TEXT_UPGRADED, null, null);
89
+ //
90
+ // // Get stats
91
+ // responseBody = executeNeuralStatRequest(new ArrayList<>(), new ArrayList<>());
92
+ // logger.info("Upgraded after insert:" + responseBody);
93
+ //
94
+ // assertEquals(
95
+ // numberOfExecution + 3,
96
+ // getNestedValue(parseAggregatedNodeStatsResponse(responseBody), EventStatName.TEXT_EMBEDDING_PROCESSOR_EXECUTIONS)
97
+ // );
98
+ // assertEquals(
99
+ // numberOfProcessor,
100
+ // getNestedValue(parseInfoStatsResponse(responseBody), InfoStatName.TEXT_EMBEDDING_PROCESSORS)
101
+ // );
102
+ // } finally {
103
+ // wipeOfTestResources(getIndexNameForTest(), PIPELINE_NAME, modelId, null);
104
+ // }
105
+ // break;
106
+ // default:
107
+ // throw new IllegalStateException("Unexpected value: " + getClusterType());
108
+ // }
109
+ // }
122
110
}
0 commit comments