This commit is contained in:
parent
b9da307cd1
commit
7d5f74e964
|
@ -139,6 +139,7 @@ public final class MlIndexAndAlias {
|
||||||
boolean addAlias,
|
boolean addAlias,
|
||||||
boolean isHiddenAttributeAvailable,
|
boolean isHiddenAttributeAvailable,
|
||||||
ActionListener<Boolean> listener) {
|
ActionListener<Boolean> listener) {
|
||||||
|
logger.info("About to create first concrete index [{}] with alias [{}]", index, alias);
|
||||||
CreateIndexRequestBuilder requestBuilder = client.admin()
|
CreateIndexRequestBuilder requestBuilder = client.admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate(index);
|
.prepareCreate(index);
|
||||||
|
@ -175,6 +176,7 @@ public final class MlIndexAndAlias {
|
||||||
String newIndex,
|
String newIndex,
|
||||||
boolean isHiddenAttributeAvailable,
|
boolean isHiddenAttributeAvailable,
|
||||||
ActionListener<Boolean> listener) {
|
ActionListener<Boolean> listener) {
|
||||||
|
logger.info("About to move write alias [{}] from index [{}] to index [{}]", alias, currentIndex, newIndex);
|
||||||
IndicesAliasesRequest.AliasActions addNewAliasAction = IndicesAliasesRequest.AliasActions.add().index(newIndex).alias(alias);
|
IndicesAliasesRequest.AliasActions addNewAliasAction = IndicesAliasesRequest.AliasActions.add().index(newIndex).alias(alias);
|
||||||
if (isHiddenAttributeAvailable) {
|
if (isHiddenAttributeAvailable) {
|
||||||
addNewAliasAction.isHidden(true);
|
addNewAliasAction.isHidden(true);
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.integration;
|
package org.elasticsearch.xpack.ml.integration;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||||
|
import org.elasticsearch.ElasticsearchException;
|
||||||
import org.elasticsearch.ElasticsearchStatusException;
|
import org.elasticsearch.ElasticsearchStatusException;
|
||||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||||
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
||||||
|
@ -502,7 +504,6 @@ public class ClassificationIT extends MlNativeDataFrameAnalyticsIntegTestCase {
|
||||||
assertThat(secondRunTrainingRowsIds, equalTo(firstRunTrainingRowsIds));
|
assertThat(secondRunTrainingRowsIds, equalTo(firstRunTrainingRowsIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/55221")
|
|
||||||
public void testSetUpgradeMode_ExistingTaskGetsUnassigned() throws Exception {
|
public void testSetUpgradeMode_ExistingTaskGetsUnassigned() throws Exception {
|
||||||
initialize("classification_set_upgrade_mode");
|
initialize("classification_set_upgrade_mode");
|
||||||
indexData(sourceIndex, 300, 0, KEYWORD_FIELD);
|
indexData(sourceIndex, 300, 0, KEYWORD_FIELD);
|
||||||
|
@ -520,18 +521,33 @@ public class ClassificationIT extends MlNativeDataFrameAnalyticsIntegTestCase {
|
||||||
assertThat(analyticsTaskList(), hasSize(1));
|
assertThat(analyticsTaskList(), hasSize(1));
|
||||||
assertThat(analyticsAssignedTaskList(), is(empty()));
|
assertThat(analyticsAssignedTaskList(), is(empty()));
|
||||||
|
|
||||||
GetDataFrameAnalyticsStatsAction.Response.Stats analyticsStats = getAnalyticsStats(jobId);
|
assertBusy(() -> {
|
||||||
assertThat(analyticsStats.getAssignmentExplanation(), is(equalTo(AWAITING_UPGRADE.getExplanation())));
|
try {
|
||||||
assertThat(analyticsStats.getNode(), is(nullValue()));
|
GetDataFrameAnalyticsStatsAction.Response.Stats analyticsStats = getAnalyticsStats(jobId);
|
||||||
|
assertThat(analyticsStats.getAssignmentExplanation(), is(equalTo(AWAITING_UPGRADE.getExplanation())));
|
||||||
|
assertThat(analyticsStats.getNode(), is(nullValue()));
|
||||||
|
} catch (ElasticsearchException e) {
|
||||||
|
logger.error(new ParameterizedMessage("[{}] Encountered exception while fetching analytics stats", jobId), e);
|
||||||
|
fail(e.getDetailedMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setUpgradeModeTo(false);
|
setUpgradeModeTo(false);
|
||||||
assertThat(analyticsTaskList(), hasSize(1));
|
assertThat(analyticsTaskList(), hasSize(1));
|
||||||
assertBusy(() -> assertThat(analyticsAssignedTaskList(), hasSize(1)));
|
assertBusy(() -> assertThat(analyticsAssignedTaskList(), hasSize(1)));
|
||||||
|
|
||||||
analyticsStats = getAnalyticsStats(jobId);
|
assertBusy(() -> {
|
||||||
assertThat(analyticsStats.getAssignmentExplanation(), is(not(equalTo(AWAITING_UPGRADE.getExplanation()))));
|
try {
|
||||||
|
GetDataFrameAnalyticsStatsAction.Response.Stats analyticsStats = getAnalyticsStats(jobId);
|
||||||
|
assertThat(analyticsStats.getAssignmentExplanation(), is(not(equalTo(AWAITING_UPGRADE.getExplanation()))));
|
||||||
|
} catch (ElasticsearchException e) {
|
||||||
|
logger.error(new ParameterizedMessage("[{}] Encountered exception while fetching analytics stats", jobId), e);
|
||||||
|
fail(e.getDetailedMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
waitUntilAnalyticsIsStopped(jobId);
|
waitUntilAnalyticsIsStopped(jobId);
|
||||||
|
assertProgress(jobId, 100, 100, 100, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSetUpgradeMode_NewTaskDoesNotStart() throws Exception {
|
public void testSetUpgradeMode_NewTaskDoesNotStart() throws Exception {
|
||||||
|
|
|
@ -210,11 +210,15 @@ public class TransportGetDataFrameAnalyticsStatsAction
|
||||||
|
|
||||||
executeAsyncWithOrigin(client, ML_ORIGIN, MultiSearchAction.INSTANCE, multiSearchRequest, ActionListener.wrap(
|
executeAsyncWithOrigin(client, ML_ORIGIN, MultiSearchAction.INSTANCE, multiSearchRequest, ActionListener.wrap(
|
||||||
multiSearchResponse -> {
|
multiSearchResponse -> {
|
||||||
for (MultiSearchResponse.Item itemResponse : multiSearchResponse.getResponses()) {
|
MultiSearchResponse.Item[] itemResponses = multiSearchResponse.getResponses();
|
||||||
|
for (int i = 0; i < itemResponses.length; ++i) {
|
||||||
|
MultiSearchResponse.Item itemResponse = itemResponses[i];
|
||||||
if (itemResponse.isFailure()) {
|
if (itemResponse.isFailure()) {
|
||||||
|
SearchRequest itemRequest = multiSearchRequest.requests().get(i);
|
||||||
logger.error(
|
logger.error(
|
||||||
new ParameterizedMessage(
|
new ParameterizedMessage(
|
||||||
"[{}] Item failure encountered during multi search: {}", configId, itemResponse.getFailureMessage()),
|
"[{}] Item failure encountered during multi search for request [indices={}, source={}]: {}",
|
||||||
|
configId, itemRequest.indices(), itemRequest.source(), itemResponse.getFailureMessage()),
|
||||||
itemResponse.getFailure());
|
itemResponse.getFailure());
|
||||||
listener.onFailure(ExceptionsHelper.serverError(itemResponse.getFailureMessage(), itemResponse.getFailure()));
|
listener.onFailure(ExceptionsHelper.serverError(itemResponse.getFailureMessage(), itemResponse.getFailure()));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -640,9 +640,9 @@ public class TransportStartDataFrameAnalyticsAction
|
||||||
@Override
|
@Override
|
||||||
protected void nodeOperation(AllocatedPersistentTask task, StartDataFrameAnalyticsAction.TaskParams params,
|
protected void nodeOperation(AllocatedPersistentTask task, StartDataFrameAnalyticsAction.TaskParams params,
|
||||||
PersistentTaskState state) {
|
PersistentTaskState state) {
|
||||||
logger.info("[{}] Starting data frame analytics", params.getId());
|
|
||||||
DataFrameAnalyticsTaskState analyticsTaskState = (DataFrameAnalyticsTaskState) state;
|
DataFrameAnalyticsTaskState analyticsTaskState = (DataFrameAnalyticsTaskState) state;
|
||||||
DataFrameAnalyticsState analyticsState = analyticsTaskState == null ? null : analyticsTaskState.getState();
|
DataFrameAnalyticsState analyticsState = analyticsTaskState == null ? null : analyticsTaskState.getState();
|
||||||
|
logger.info("[{}] Starting data frame analytics from state [{}]", params.getId(), analyticsState);
|
||||||
|
|
||||||
// If we are "stopping" there is nothing to do and we should stop
|
// If we are "stopping" there is nothing to do and we should stop
|
||||||
if (DataFrameAnalyticsState.STOPPING.equals(analyticsState)) {
|
if (DataFrameAnalyticsState.STOPPING.equals(analyticsState)) {
|
||||||
|
|
|
@ -11,7 +11,6 @@ import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||||
import org.apache.lucene.util.SetOnce;
|
import org.apache.lucene.util.SetOnce;
|
||||||
import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
|
import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
|
||||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||||
import org.elasticsearch.action.index.IndexRequest;
|
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
import org.elasticsearch.action.support.IndicesOptions;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
|
@ -267,10 +266,6 @@ public class AnalyticsProcessManager {
|
||||||
process.writeRecord(headerRecord);
|
process.writeRecord(headerRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void indexDataCounts(DataCounts dataCounts) {
|
|
||||||
IndexRequest indexRequest = new IndexRequest(MlStatsIndex.writeAlias());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void restoreState(DataFrameAnalyticsTask task, DataFrameAnalyticsConfig config, @Nullable BytesReference state,
|
private void restoreState(DataFrameAnalyticsTask task, DataFrameAnalyticsConfig config, @Nullable BytesReference state,
|
||||||
AnalyticsProcess<AnalyticsResult> process) {
|
AnalyticsProcess<AnalyticsResult> process) {
|
||||||
if (config.getAnalysis().persistsState() == false) {
|
if (config.getAnalysis().persistsState() == false) {
|
||||||
|
|
|
@ -105,6 +105,7 @@ public class TrainedModelStatsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop() {
|
void stop() {
|
||||||
|
logger.info("About to stop TrainedModelStatsService");
|
||||||
stopped = true;
|
stopped = true;
|
||||||
statsQueue.clear();
|
statsQueue.clear();
|
||||||
|
|
||||||
|
@ -115,6 +116,7 @@ public class TrainedModelStatsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
void start() {
|
void start() {
|
||||||
|
logger.info("About to start TrainedModelStatsService");
|
||||||
stopped = false;
|
stopped = false;
|
||||||
scheduledFuture = threadPool.scheduleWithFixedDelay(this::updateStats,
|
scheduledFuture = threadPool.scheduleWithFixedDelay(this::updateStats,
|
||||||
PERSISTENCE_INTERVAL,
|
PERSISTENCE_INTERVAL,
|
||||||
|
@ -126,11 +128,13 @@ public class TrainedModelStatsService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (verifiedStatsIndexCreated == false) {
|
if (verifiedStatsIndexCreated == false) {
|
||||||
|
logger.info("About to create the stats index as it does not exist yet");
|
||||||
try {
|
try {
|
||||||
PlainActionFuture<Boolean> listener = new PlainActionFuture<>();
|
PlainActionFuture<Boolean> listener = new PlainActionFuture<>();
|
||||||
MlStatsIndex.createStatsIndexAndAliasIfNecessary(client, clusterState, indexNameExpressionResolver, listener);
|
MlStatsIndex.createStatsIndexAndAliasIfNecessary(client, clusterState, indexNameExpressionResolver, listener);
|
||||||
listener.actionGet();
|
listener.actionGet();
|
||||||
verifiedStatsIndexCreated = true;
|
verifiedStatsIndexCreated = true;
|
||||||
|
logger.info("Created stats index");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("failure creating ml stats index for storing model stats", e);
|
logger.error("failure creating ml stats index for storing model stats", e);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue