[ML][Data Frame] prevent task from attempting to run when failed (#44239) (#44292)

This commit is contained in:
Benjamin Trent 2019-07-12 15:24:49 -05:00 committed by GitHub
parent 79c62fd724
commit 51ff6b420a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,7 @@ import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformCheck
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformConfig; import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformConfig;
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformState; import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformState;
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformStateAndStats; import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformStateAndStats;
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformTaskState;
import org.elasticsearch.xpack.core.indexing.IndexerState; import org.elasticsearch.xpack.core.indexing.IndexerState;
import org.elasticsearch.xpack.core.scheduler.SchedulerEngine; import org.elasticsearch.xpack.core.scheduler.SchedulerEngine;
import org.elasticsearch.xpack.dataframe.DataFrame; import org.elasticsearch.xpack.dataframe.DataFrame;
@ -112,6 +113,13 @@ public class DataFrameTransformPersistentTasksExecutor extends PersistentTasksEx
final DataFrameTransformTask buildTask = (DataFrameTransformTask) task; final DataFrameTransformTask buildTask = (DataFrameTransformTask) task;
final DataFrameTransformState transformPTaskState = (DataFrameTransformState) state; final DataFrameTransformState transformPTaskState = (DataFrameTransformState) state;
// If the transform is failed then the Persistent Task Service will
// try to restart it on a node restart. Exiting here leaves the
// transform in the failed state and it must be force closed.
if (transformPTaskState != null && transformPTaskState.getTaskState() == DataFrameTransformTaskState.FAILED) {
return;
}
final DataFrameTransformTask.ClientDataFrameIndexerBuilder indexerBuilder = final DataFrameTransformTask.ClientDataFrameIndexerBuilder indexerBuilder =
new DataFrameTransformTask.ClientDataFrameIndexerBuilder(transformId) new DataFrameTransformTask.ClientDataFrameIndexerBuilder(transformId)
.setAuditor(auditor) .setAuditor(auditor)