Use snapshot's latest result time rather than snapshot's creation time when creating an annotation (#56093) (#56103)
This commit is contained in:
parent
e197b6c45b
commit
44f5a8ccd3
|
@ -89,6 +89,10 @@ public class ModelSnapshot implements ToXContentObject, Writeable {
|
|||
*/
|
||||
private final Version minVersion;
|
||||
|
||||
/**
|
||||
* This is model snapshot's creation wall clock time.
|
||||
* Use {@code latestResultTimeStamp} if you need model time instead.
|
||||
*/
|
||||
private final Date timestamp;
|
||||
private final String description;
|
||||
private final String snapshotId;
|
||||
|
|
|
@ -332,8 +332,8 @@ public class AutodetectResultProcessor {
|
|||
Messages.getMessage(Messages.JOB_AUDIT_SNAPSHOT_STORED, modelSnapshot.getSnapshotId()),
|
||||
currentTime,
|
||||
XPackUser.NAME,
|
||||
modelSnapshot.getTimestamp(),
|
||||
modelSnapshot.getTimestamp(),
|
||||
modelSnapshot.getLatestResultTimeStamp(),
|
||||
modelSnapshot.getLatestResultTimeStamp(),
|
||||
jobId,
|
||||
currentTime,
|
||||
XPackUser.NAME,
|
||||
|
|
|
@ -482,7 +482,8 @@ public class AutodetectResultProcessorIT extends MlSingleNodeTestCase {
|
|||
private static ModelSnapshot createModelSnapshot() {
|
||||
return new ModelSnapshot.Builder(JOB_ID)
|
||||
.setSnapshotId(randomAlphaOfLength(12))
|
||||
.setTimestamp(Date.from(Instant.ofEpochMilli(1000000000)))
|
||||
.setLatestResultTimeStamp(Date.from(Instant.ofEpochMilli(1000_000_000)))
|
||||
.setTimestamp(Date.from(Instant.ofEpochMilli(2000_000_000)))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -365,7 +365,8 @@ public class AutodetectResultProcessorTests extends ESTestCase {
|
|||
AutodetectResult result = mock(AutodetectResult.class);
|
||||
ModelSnapshot modelSnapshot = new ModelSnapshot.Builder(JOB_ID)
|
||||
.setSnapshotId("a_snapshot_id")
|
||||
.setTimestamp(Date.from(Instant.ofEpochMilli(1000000000)))
|
||||
.setLatestResultTimeStamp(Date.from(Instant.ofEpochMilli(1000_000_000)))
|
||||
.setTimestamp(Date.from(Instant.ofEpochMilli(2000_000_000)))
|
||||
.setMinVersion(Version.CURRENT)
|
||||
.build();
|
||||
when(result.getModelSnapshot()).thenReturn(modelSnapshot);
|
||||
|
@ -389,8 +390,8 @@ public class AutodetectResultProcessorTests extends ESTestCase {
|
|||
"Job model snapshot with id [a_snapshot_id] stored",
|
||||
Date.from(CURRENT_TIME),
|
||||
XPackUser.NAME,
|
||||
modelSnapshot.getTimestamp(),
|
||||
modelSnapshot.getTimestamp(),
|
||||
Date.from(Instant.ofEpochMilli(1000_000_000)),
|
||||
Date.from(Instant.ofEpochMilli(1000_000_000)),
|
||||
JOB_ID,
|
||||
Date.from(CURRENT_TIME),
|
||||
XPackUser.NAME,
|
||||
|
|
Loading…
Reference in New Issue