@@ -63,6 +63,8 @@ public class Job implements ToXContentObject {
6363 public static final ParseField RENORMALIZATION_WINDOW_DAYS = new ParseField ("renormalization_window_days" );
6464 public static final ParseField BACKGROUND_PERSIST_INTERVAL = new ParseField ("background_persist_interval" );
6565 public static final ParseField MODEL_SNAPSHOT_RETENTION_DAYS = new ParseField ("model_snapshot_retention_days" );
66+ public static final ParseField DAILY_MODEL_SNAPSHOT_RETENTION_AFTER_DAYS =
67+ new ParseField ("daily_model_snapshot_retention_after_days" );
6668 public static final ParseField RESULTS_RETENTION_DAYS = new ParseField ("results_retention_days" );
6769 public static final ParseField MODEL_SNAPSHOT_ID = new ParseField ("model_snapshot_id" );
6870 public static final ParseField RESULTS_INDEX_NAME = new ParseField ("results_index_name" );
@@ -93,6 +95,7 @@ public class Job implements ToXContentObject {
9395 TimeValue .parseTimeValue (val , BACKGROUND_PERSIST_INTERVAL .getPreferredName ())), BACKGROUND_PERSIST_INTERVAL );
9496 PARSER .declareLong (Builder ::setResultsRetentionDays , RESULTS_RETENTION_DAYS );
9597 PARSER .declareLong (Builder ::setModelSnapshotRetentionDays , MODEL_SNAPSHOT_RETENTION_DAYS );
98+ PARSER .declareLong (Builder ::setDailyModelSnapshotRetentionAfterDays , DAILY_MODEL_SNAPSHOT_RETENTION_AFTER_DAYS );
9699 PARSER .declareField (Builder ::setCustomSettings , (p , c ) -> p .mapOrdered (), CUSTOM_SETTINGS , ValueType .OBJECT );
97100 PARSER .declareStringOrNull (Builder ::setModelSnapshotId , MODEL_SNAPSHOT_ID );
98101 PARSER .declareString (Builder ::setResultsIndexName , RESULTS_INDEX_NAME );
@@ -114,6 +117,7 @@ public class Job implements ToXContentObject {
114117 private final Long renormalizationWindowDays ;
115118 private final TimeValue backgroundPersistInterval ;
116119 private final Long modelSnapshotRetentionDays ;
120+ private final Long dailyModelSnapshotRetentionAfterDays ;
117121 private final Long resultsRetentionDays ;
118122 private final Map <String , Object > customSettings ;
119123 private final String modelSnapshotId ;
@@ -125,8 +129,9 @@ private Job(String jobId, String jobType, List<String> groups, String descriptio
125129 Date createTime , Date finishedTime ,
126130 AnalysisConfig analysisConfig , AnalysisLimits analysisLimits , DataDescription dataDescription ,
127131 ModelPlotConfig modelPlotConfig , Long renormalizationWindowDays , TimeValue backgroundPersistInterval ,
128- Long modelSnapshotRetentionDays , Long resultsRetentionDays , Map <String , Object > customSettings ,
129- String modelSnapshotId , String resultsIndexName , Boolean deleting , Boolean allowLazyOpen ) {
132+ Long modelSnapshotRetentionDays , Long dailyModelSnapshotRetentionAfterDays , Long resultsRetentionDays ,
133+ Map <String , Object > customSettings , String modelSnapshotId , String resultsIndexName , Boolean deleting ,
134+ Boolean allowLazyOpen ) {
130135
131136 this .jobId = jobId ;
132137 this .jobType = jobType ;
@@ -141,6 +146,7 @@ private Job(String jobId, String jobType, List<String> groups, String descriptio
141146 this .renormalizationWindowDays = renormalizationWindowDays ;
142147 this .backgroundPersistInterval = backgroundPersistInterval ;
143148 this .modelSnapshotRetentionDays = modelSnapshotRetentionDays ;
149+ this .dailyModelSnapshotRetentionAfterDays = dailyModelSnapshotRetentionAfterDays ;
144150 this .resultsRetentionDays = resultsRetentionDays ;
145151 this .customSettings = customSettings == null ? null : Collections .unmodifiableMap (customSettings );
146152 this .modelSnapshotId = modelSnapshotId ;
@@ -259,6 +265,10 @@ public Long getModelSnapshotRetentionDays() {
259265 return modelSnapshotRetentionDays ;
260266 }
261267
268+ public Long getDailyModelSnapshotRetentionAfterDays () {
269+ return dailyModelSnapshotRetentionAfterDays ;
270+ }
271+
262272 public Long getResultsRetentionDays () {
263273 return resultsRetentionDays ;
264274 }
@@ -319,6 +329,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
319329 if (modelSnapshotRetentionDays != null ) {
320330 builder .field (MODEL_SNAPSHOT_RETENTION_DAYS .getPreferredName (), modelSnapshotRetentionDays );
321331 }
332+ if (dailyModelSnapshotRetentionAfterDays != null ) {
333+ builder .field (DAILY_MODEL_SNAPSHOT_RETENTION_AFTER_DAYS .getPreferredName (), dailyModelSnapshotRetentionAfterDays );
334+ }
322335 if (resultsRetentionDays != null ) {
323336 builder .field (RESULTS_RETENTION_DAYS .getPreferredName (), resultsRetentionDays );
324337 }
@@ -365,6 +378,7 @@ public boolean equals(Object other) {
365378 && Objects .equals (this .renormalizationWindowDays , that .renormalizationWindowDays )
366379 && Objects .equals (this .backgroundPersistInterval , that .backgroundPersistInterval )
367380 && Objects .equals (this .modelSnapshotRetentionDays , that .modelSnapshotRetentionDays )
381+ && Objects .equals (this .dailyModelSnapshotRetentionAfterDays , that .dailyModelSnapshotRetentionAfterDays )
368382 && Objects .equals (this .resultsRetentionDays , that .resultsRetentionDays )
369383 && Objects .equals (this .customSettings , that .customSettings )
370384 && Objects .equals (this .modelSnapshotId , that .modelSnapshotId )
@@ -377,8 +391,8 @@ public boolean equals(Object other) {
377391 public int hashCode () {
378392 return Objects .hash (jobId , jobType , groups , description , createTime , finishedTime ,
379393 analysisConfig , analysisLimits , dataDescription , modelPlotConfig , renormalizationWindowDays ,
380- backgroundPersistInterval , modelSnapshotRetentionDays , resultsRetentionDays , customSettings ,
381- modelSnapshotId , resultsIndexName , deleting , allowLazyOpen );
394+ backgroundPersistInterval , modelSnapshotRetentionDays , dailyModelSnapshotRetentionAfterDays , resultsRetentionDays ,
395+ customSettings , modelSnapshotId , resultsIndexName , deleting , allowLazyOpen );
382396 }
383397
384398 @ Override
@@ -405,6 +419,7 @@ public static class Builder {
405419 private Long renormalizationWindowDays ;
406420 private TimeValue backgroundPersistInterval ;
407421 private Long modelSnapshotRetentionDays ;
422+ private Long dailyModelSnapshotRetentionAfterDays ;
408423 private Long resultsRetentionDays ;
409424 private Map <String , Object > customSettings ;
410425 private String modelSnapshotId ;
@@ -433,6 +448,7 @@ public Builder(Job job) {
433448 this .renormalizationWindowDays = job .getRenormalizationWindowDays ();
434449 this .backgroundPersistInterval = job .getBackgroundPersistInterval ();
435450 this .modelSnapshotRetentionDays = job .getModelSnapshotRetentionDays ();
451+ this .dailyModelSnapshotRetentionAfterDays = job .getDailyModelSnapshotRetentionAfterDays ();
436452 this .resultsRetentionDays = job .getResultsRetentionDays ();
437453 this .customSettings = job .getCustomSettings () == null ? null : new LinkedHashMap <>(job .getCustomSettings ());
438454 this .modelSnapshotId = job .getModelSnapshotId ();
@@ -515,6 +531,11 @@ public Builder setModelSnapshotRetentionDays(Long modelSnapshotRetentionDays) {
515531 return this ;
516532 }
517533
534+ public Builder setDailyModelSnapshotRetentionAfterDays (Long dailyModelSnapshotRetentionAfterDays ) {
535+ this .dailyModelSnapshotRetentionAfterDays = dailyModelSnapshotRetentionAfterDays ;
536+ return this ;
537+ }
538+
518539 public Builder setResultsRetentionDays (Long resultsRetentionDays ) {
519540 this .resultsRetentionDays = resultsRetentionDays ;
520541 return this ;
@@ -551,8 +572,8 @@ public Job build() {
551572 return new Job (
552573 id , jobType , groups , description , createTime , finishedTime ,
553574 analysisConfig , analysisLimits , dataDescription , modelPlotConfig , renormalizationWindowDays ,
554- backgroundPersistInterval , modelSnapshotRetentionDays , resultsRetentionDays , customSettings ,
555- modelSnapshotId , resultsIndexName , deleting , allowLazyOpen );
575+ backgroundPersistInterval , modelSnapshotRetentionDays , dailyModelSnapshotRetentionAfterDays , resultsRetentionDays ,
576+ customSettings , modelSnapshotId , resultsIndexName , deleting , allowLazyOpen );
556577 }
557578 }
558579}
0 commit comments