forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Prepare to hold additinal stats in DF Analytics task (elastic#52134
) Refactors `DataFrameAnalyticsTask` to hold a `StatsHolder` object. That just has a `ProgressTracker` for now but this is paving the way to add additional stats like memory usage, analysis stats, etc.
- Loading branch information
1 parent
2d6e59c
commit 72b84ad
Showing
8 changed files
with
85 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...k/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/dataframe/stats/ProgressTracker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.ml.dataframe.stats; | ||
|
||
import org.elasticsearch.xpack.core.ml.utils.PhaseProgress; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
public class ProgressTracker { | ||
|
||
public static final String REINDEXING = "reindexing"; | ||
public static final String LOADING_DATA = "loading_data"; | ||
public static final String ANALYZING = "analyzing"; | ||
public static final String WRITING_RESULTS = "writing_results"; | ||
|
||
public final AtomicInteger reindexingPercent = new AtomicInteger(0); | ||
public final AtomicInteger loadingDataPercent = new AtomicInteger(0); | ||
public final AtomicInteger analyzingPercent = new AtomicInteger(0); | ||
public final AtomicInteger writingResultsPercent = new AtomicInteger(0); | ||
|
||
public List<PhaseProgress> report() { | ||
return Arrays.asList( | ||
new PhaseProgress(REINDEXING, reindexingPercent.get()), | ||
new PhaseProgress(LOADING_DATA, loadingDataPercent.get()), | ||
new PhaseProgress(ANALYZING, analyzingPercent.get()), | ||
new PhaseProgress(WRITING_RESULTS, writingResultsPercent.get()) | ||
); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/dataframe/stats/StatsHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.ml.dataframe.stats; | ||
|
||
/** | ||
* Holds data frame analytics stats in memory so that they may be retrieved | ||
* from the get stats api for started jobs efficiently. | ||
*/ | ||
public class StatsHolder { | ||
|
||
private final ProgressTracker progressTracker = new ProgressTracker(); | ||
|
||
public ProgressTracker getProgressTracker() { | ||
return progressTracker; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters