Remove timeout setting from Job (elastic/elasticsearch#866)

This setting was related to auto-close, and Jobs no longer auto-close.

Closes elastic/elasticsearch#832

Original commit: elastic/x-pack-elasticsearch@fef81f9c3b
This commit is contained in:
David Roberts 2017-02-06 09:39:55 +00:00 committed by GitHub
parent 5a1cd69a6a
commit 50c4090541
3 changed files with 4 additions and 37 deletions

View File

@ -59,7 +59,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
public static final ParseField BACKGROUND_PERSIST_INTERVAL = new ParseField("background_persist_interval"); public static final ParseField BACKGROUND_PERSIST_INTERVAL = new ParseField("background_persist_interval");
public static final ParseField MODEL_SNAPSHOT_RETENTION_DAYS = new ParseField("model_snapshot_retention_days"); public static final ParseField MODEL_SNAPSHOT_RETENTION_DAYS = new ParseField("model_snapshot_retention_days");
public static final ParseField RESULTS_RETENTION_DAYS = new ParseField("results_retention_days"); public static final ParseField RESULTS_RETENTION_DAYS = new ParseField("results_retention_days");
public static final ParseField TIMEOUT = new ParseField("timeout");
public static final ParseField MODEL_SNAPSHOT_ID = new ParseField("model_snapshot_id"); public static final ParseField MODEL_SNAPSHOT_ID = new ParseField("model_snapshot_id");
public static final ParseField INDEX_NAME = new ParseField("index_name"); public static final ParseField INDEX_NAME = new ParseField("index_name");
@ -107,7 +106,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
PARSER.declareObject(Builder::setDataDescription, DataDescription.PARSER, DATA_DESCRIPTION); PARSER.declareObject(Builder::setDataDescription, DataDescription.PARSER, DATA_DESCRIPTION);
PARSER.declareObject(Builder::setModelDebugConfig, ModelDebugConfig.PARSER, MODEL_DEBUG_CONFIG); PARSER.declareObject(Builder::setModelDebugConfig, ModelDebugConfig.PARSER, MODEL_DEBUG_CONFIG);
PARSER.declareField(Builder::setIgnoreDowntime, (p, c) -> IgnoreDowntime.fromString(p.text()), IGNORE_DOWNTIME, ValueType.STRING); PARSER.declareField(Builder::setIgnoreDowntime, (p, c) -> IgnoreDowntime.fromString(p.text()), IGNORE_DOWNTIME, ValueType.STRING);
PARSER.declareLong(Builder::setTimeout, TIMEOUT);
PARSER.declareLong(Builder::setRenormalizationWindowDays, RENORMALIZATION_WINDOW_DAYS); PARSER.declareLong(Builder::setRenormalizationWindowDays, RENORMALIZATION_WINDOW_DAYS);
PARSER.declareLong(Builder::setBackgroundPersistInterval, BACKGROUND_PERSIST_INTERVAL); PARSER.declareLong(Builder::setBackgroundPersistInterval, BACKGROUND_PERSIST_INTERVAL);
PARSER.declareLong(Builder::setResultsRetentionDays, RESULTS_RETENTION_DAYS); PARSER.declareLong(Builder::setResultsRetentionDays, RESULTS_RETENTION_DAYS);
@ -123,7 +121,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
private final Date createTime; private final Date createTime;
private final Date finishedTime; private final Date finishedTime;
private final Date lastDataTime; private final Date lastDataTime;
private final long timeout;
private final AnalysisConfig analysisConfig; private final AnalysisConfig analysisConfig;
private final AnalysisLimits analysisLimits; private final AnalysisLimits analysisLimits;
private final DataDescription dataDescription; private final DataDescription dataDescription;
@ -137,7 +134,7 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
private final String modelSnapshotId; private final String modelSnapshotId;
private final String indexName; private final String indexName;
public Job(String jobId, String description, Date createTime, Date finishedTime, Date lastDataTime, long timeout, public Job(String jobId, String description, Date createTime, Date finishedTime, Date lastDataTime,
AnalysisConfig analysisConfig, AnalysisLimits analysisLimits, DataDescription dataDescription, AnalysisConfig analysisConfig, AnalysisLimits analysisLimits, DataDescription dataDescription,
ModelDebugConfig modelDebugConfig, IgnoreDowntime ignoreDowntime, ModelDebugConfig modelDebugConfig, IgnoreDowntime ignoreDowntime,
Long renormalizationWindowDays, Long backgroundPersistInterval, Long modelSnapshotRetentionDays, Long resultsRetentionDays, Long renormalizationWindowDays, Long backgroundPersistInterval, Long modelSnapshotRetentionDays, Long resultsRetentionDays,
@ -147,7 +144,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
throw new IllegalArgumentException(Messages.getMessage(Messages.JOB_CONFIG_MISSING_ANALYSISCONFIG)); throw new IllegalArgumentException(Messages.getMessage(Messages.JOB_CONFIG_MISSING_ANALYSISCONFIG));
} }
checkValueNotLessThan(0, "timeout", timeout);
checkValueNotLessThan(0, "renormalizationWindowDays", renormalizationWindowDays); checkValueNotLessThan(0, "renormalizationWindowDays", renormalizationWindowDays);
checkValueNotLessThan(MIN_BACKGROUND_PERSIST_INTERVAL, "backgroundPersistInterval", backgroundPersistInterval); checkValueNotLessThan(MIN_BACKGROUND_PERSIST_INTERVAL, "backgroundPersistInterval", backgroundPersistInterval);
checkValueNotLessThan(0, "modelSnapshotRetentionDays", modelSnapshotRetentionDays); checkValueNotLessThan(0, "modelSnapshotRetentionDays", modelSnapshotRetentionDays);
@ -171,7 +167,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
this.createTime = createTime; this.createTime = createTime;
this.finishedTime = finishedTime; this.finishedTime = finishedTime;
this.lastDataTime = lastDataTime; this.lastDataTime = lastDataTime;
this.timeout = timeout;
this.analysisConfig = analysisConfig; this.analysisConfig = analysisConfig;
this.analysisLimits = analysisLimits; this.analysisLimits = analysisLimits;
this.dataDescription = dataDescription; this.dataDescription = dataDescription;
@ -192,7 +187,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
createTime = new Date(in.readVLong()); createTime = new Date(in.readVLong());
finishedTime = in.readBoolean() ? new Date(in.readVLong()) : null; finishedTime = in.readBoolean() ? new Date(in.readVLong()) : null;
lastDataTime = in.readBoolean() ? new Date(in.readVLong()) : null; lastDataTime = in.readBoolean() ? new Date(in.readVLong()) : null;
timeout = in.readVLong();
analysisConfig = new AnalysisConfig(in); analysisConfig = new AnalysisConfig(in);
analysisLimits = in.readOptionalWriteable(AnalysisLimits::new); analysisLimits = in.readOptionalWriteable(AnalysisLimits::new);
dataDescription = in.readOptionalWriteable(DataDescription::new); dataDescription = in.readOptionalWriteable(DataDescription::new);
@ -273,16 +267,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
return lastDataTime; return lastDataTime;
} }
/**
* The job timeout setting in seconds. Jobs are retired if they do not
* receive data for this period of time. The default is 600 seconds
*
* @return The timeout period in seconds
*/
public long getTimeout() {
return timeout;
}
/** /**
* The analysis configuration object * The analysis configuration object
* *
@ -399,7 +383,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
} else { } else {
out.writeBoolean(false); out.writeBoolean(false);
} }
out.writeVLong(timeout);
analysisConfig.writeTo(out); analysisConfig.writeTo(out);
out.writeOptionalWriteable(analysisLimits); out.writeOptionalWriteable(analysisLimits);
out.writeOptionalWriteable(dataDescription); out.writeOptionalWriteable(dataDescription);
@ -434,7 +417,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
if (lastDataTime != null) { if (lastDataTime != null) {
builder.field(LAST_DATA_TIME.getPreferredName(), lastDataTime.getTime()); builder.field(LAST_DATA_TIME.getPreferredName(), lastDataTime.getTime());
} }
builder.field(TIMEOUT.getPreferredName(), timeout);
builder.field(ANALYSIS_CONFIG.getPreferredName(), analysisConfig, params); builder.field(ANALYSIS_CONFIG.getPreferredName(), analysisConfig, params);
if (analysisLimits != null) { if (analysisLimits != null) {
builder.field(ANALYSIS_LIMITS.getPreferredName(), analysisLimits, params); builder.field(ANALYSIS_LIMITS.getPreferredName(), analysisLimits, params);
@ -485,7 +467,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
&& Objects.equals(this.createTime, that.createTime) && Objects.equals(this.createTime, that.createTime)
&& Objects.equals(this.finishedTime, that.finishedTime) && Objects.equals(this.finishedTime, that.finishedTime)
&& Objects.equals(this.lastDataTime, that.lastDataTime) && Objects.equals(this.lastDataTime, that.lastDataTime)
&& (this.timeout == that.timeout)
&& Objects.equals(this.analysisConfig, that.analysisConfig) && Objects.equals(this.analysisConfig, that.analysisConfig)
&& Objects.equals(this.analysisLimits, that.analysisLimits) && Objects.equals(this.dataDescription, that.dataDescription) && Objects.equals(this.analysisLimits, that.analysisLimits) && Objects.equals(this.dataDescription, that.dataDescription)
&& Objects.equals(this.modelDebugConfig, that.modelDebugConfig) && Objects.equals(this.modelDebugConfig, that.modelDebugConfig)
@ -501,7 +482,7 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(jobId, description, createTime, finishedTime, lastDataTime, timeout, analysisConfig, return Objects.hash(jobId, description, createTime, finishedTime, lastDataTime, analysisConfig,
analysisLimits, dataDescription, modelDebugConfig, renormalizationWindowDays, analysisLimits, dataDescription, modelDebugConfig, renormalizationWindowDays,
backgroundPersistInterval, modelSnapshotRetentionDays, resultsRetentionDays, ignoreDowntime, customSettings, backgroundPersistInterval, modelSnapshotRetentionDays, resultsRetentionDays, ignoreDowntime, customSettings,
modelSnapshotId, indexName); modelSnapshotId, indexName);
@ -521,8 +502,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
public static class Builder { public static class Builder {
public static final long DEFAULT_TIMEOUT = 600;
private String id; private String id;
private String description; private String description;
@ -532,7 +511,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
private Date createTime; private Date createTime;
private Date finishedTime; private Date finishedTime;
private Date lastDataTime; private Date lastDataTime;
private Long timeout = DEFAULT_TIMEOUT;
private ModelDebugConfig modelDebugConfig; private ModelDebugConfig modelDebugConfig;
private Long renormalizationWindowDays; private Long renormalizationWindowDays;
private Long backgroundPersistInterval; private Long backgroundPersistInterval;
@ -558,7 +536,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
this.createTime = job.getCreateTime(); this.createTime = job.getCreateTime();
this.finishedTime = job.getFinishedTime(); this.finishedTime = job.getFinishedTime();
this.lastDataTime = job.getLastDataTime(); this.lastDataTime = job.getLastDataTime();
this.timeout = job.getTimeout();
this.modelDebugConfig = job.getModelDebugConfig(); this.modelDebugConfig = job.getModelDebugConfig();
this.renormalizationWindowDays = job.getRenormalizationWindowDays(); this.renormalizationWindowDays = job.getRenormalizationWindowDays();
this.backgroundPersistInterval = job.getBackgroundPersistInterval(); this.backgroundPersistInterval = job.getBackgroundPersistInterval();
@ -601,10 +578,6 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
this.analysisLimits = analysisLimits; this.analysisLimits = analysisLimits;
} }
public void setTimeout(Long timeout) {
this.timeout = timeout;
}
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
@ -685,7 +658,7 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
} }
return new Job( return new Job(
id, description, createTime, finishedTime, lastDataTime, timeout, analysisConfig, analysisLimits, id, description, createTime, finishedTime, lastDataTime, analysisConfig, analysisLimits,
dataDescription, modelDebugConfig, ignoreDowntime, renormalizationWindowDays, dataDescription, modelDebugConfig, ignoreDowntime, renormalizationWindowDays,
backgroundPersistInterval, modelSnapshotRetentionDays, resultsRetentionDays, customSettings, modelSnapshotId, backgroundPersistInterval, modelSnapshotRetentionDays, resultsRetentionDays, customSettings, modelSnapshotId,
indexName indexName

View File

@ -52,7 +52,7 @@ public class GetJobsActionResponseTests extends AbstractStreamableTestCase<GetJo
String modelSnapshotId = randomBoolean() ? randomAsciiOfLength(10) : null; String modelSnapshotId = randomBoolean() ? randomAsciiOfLength(10) : null;
String indexName = randomBoolean() ? "index" + j : null; String indexName = randomBoolean() ? "index" + j : null;
Job job = new Job(jobId, description, createTime, finishedTime, lastDataTime, Job job = new Job(jobId, description, createTime, finishedTime, lastDataTime,
timeout, analysisConfig, analysisLimits, dataDescription, analysisConfig, analysisLimits, dataDescription,
modelDebugConfig, ignoreDowntime, normalizationWindowDays, backgroundPersistInterval, modelDebugConfig, ignoreDowntime, normalizationWindowDays, backgroundPersistInterval,
modelSnapshotRetentionDays, resultsRetentionDays, customConfig, modelSnapshotId, indexName); modelSnapshotRetentionDays, resultsRetentionDays, customConfig, modelSnapshotId, indexName);

View File

@ -42,7 +42,6 @@ public class JobTests extends AbstractSerializingTestCase<Job> {
assertEquals("foo", job.getId()); assertEquals("foo", job.getId());
assertNotNull(job.getCreateTime()); assertNotNull(job.getCreateTime());
assertEquals(600L, job.getTimeout());
assertNotNull(job.getAnalysisConfig()); assertNotNull(job.getAnalysisConfig());
assertNull(job.getAnalysisLimits()); assertNull(job.getAnalysisLimits());
assertNull(job.getCustomSettings()); assertNull(job.getCustomSettings());
@ -289,9 +288,7 @@ public class JobTests extends AbstractSerializingTestCase<Job> {
expectThrows(IllegalArgumentException.class, builder::build); expectThrows(IllegalArgumentException.class, builder::build);
dc = new DataDescription.Builder(); dc = new DataDescription.Builder();
builder.setDataDescription(dc); builder.setDataDescription(dc);
builder.setTimeout(-1L);
expectThrows(IllegalArgumentException.class, builder::build); expectThrows(IllegalArgumentException.class, builder::build);
builder.setTimeout(300L);
builder.build(); builder.build();
} }
@ -386,9 +383,6 @@ public class JobTests extends AbstractSerializingTestCase<Job> {
if (randomBoolean()) { if (randomBoolean()) {
builder.setLastDataTime(new Date(randomNonNegativeLong())); builder.setLastDataTime(new Date(randomNonNegativeLong()));
} }
if (randomBoolean()) {
builder.setTimeout(randomNonNegativeLong());
}
AnalysisConfig.Builder analysisConfig = createAnalysisConfig(); AnalysisConfig.Builder analysisConfig = createAnalysisConfig();
analysisConfig.setBucketSpan(100L); analysisConfig.setBucketSpan(100L);
builder.setAnalysisConfig(analysisConfig); builder.setAnalysisConfig(analysisConfig);