java.lang.Object
org.elasticsearch.xpack.core.ml.job.config.Job.Builder
All Implemented Interfaces:
Writeable
Enclosing class:
Job

public static class Job.Builder extends Object implements Writeable
  • Constructor Details

  • Method Details

    • setId

      public Job.Builder setId(String id)
    • getId

      public String getId()
    • setJobVersion

      public void setJobVersion(MlConfigVersion jobVersion)
    • setGroups

      public void setGroups(List<String> groups)
    • getGroups

      public List<String> getGroups()
    • setCustomSettings

      public Job.Builder setCustomSettings(Map<String,Object> customSettings)
    • setDescription

      public Job.Builder setDescription(String description)
    • setAnalysisConfig

      public Job.Builder setAnalysisConfig(AnalysisConfig.Builder configBuilder)
    • getAnalysisConfig

      public AnalysisConfig getAnalysisConfig()
    • setAnalysisLimits

      public Job.Builder setAnalysisLimits(AnalysisLimits analysisLimits)
    • setCreateTime

      public Job.Builder setCreateTime(Date createTime)
    • setFinishedTime

      public Job.Builder setFinishedTime(Date finishedTime)
    • setDataDescription

      public Job.Builder setDataDescription(DataDescription.Builder dataDescription)
    • setModelPlotConfig

      public Job.Builder setModelPlotConfig(ModelPlotConfig modelPlotConfig)
    • setBackgroundPersistInterval

      public Job.Builder setBackgroundPersistInterval(org.elasticsearch.core.TimeValue backgroundPersistInterval)
    • setRenormalizationWindowDays

      public Job.Builder setRenormalizationWindowDays(Long renormalizationWindowDays)
    • setModelSnapshotRetentionDays

      public Job.Builder setModelSnapshotRetentionDays(Long modelSnapshotRetentionDays)
    • getModelSnapshotRetentionDays

      public Long getModelSnapshotRetentionDays()
    • setDailyModelSnapshotRetentionAfterDays

      public Job.Builder setDailyModelSnapshotRetentionAfterDays(Long dailyModelSnapshotRetentionAfterDays)
    • setResultsRetentionDays

      public Job.Builder setResultsRetentionDays(Long resultsRetentionDays)
    • setModelSnapshotId

      public Job.Builder setModelSnapshotId(String modelSnapshotId)
    • setModelSnapshotMinVersion

      public Job.Builder setModelSnapshotMinVersion(MlConfigVersion modelSnapshotMinVersion)
    • setResultsIndexName

      public Job.Builder setResultsIndexName(String resultsIndexName)
    • setDeleting

      public Job.Builder setDeleting(boolean deleting)
    • setAllowLazyOpen

      public Job.Builder setAllowLazyOpen(boolean allowLazyOpen)
    • setBlocked

      public Job.Builder setBlocked(Blocked blocked)
    • setDatafeed

      public Job.Builder setDatafeed(DatafeedConfig.Builder datafeed)
    • getDatafeedConfig

      public DatafeedConfig.Builder getDatafeedConfig()
    • setDatafeedIndicesOptionsIfRequired

      public Job.Builder setDatafeedIndicesOptionsIfRequired(IndicesOptions indicesOptions)
      This is used for parsing. If the datafeed_config exists AND its indices options are `null`, we set them to these options
      Parameters:
      indicesOptions - To set if the datafeed indices options are null
      Returns:
      The job builder.
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • validateInputFields

      public void validateInputFields()
      Call this method to validate that the job JSON provided by a user is valid. Throws an exception if there are any problems; normal return implies valid.
    • validateAnalysisLimitsAndSetDefaults

      public void validateAnalysisLimitsAndSetDefaults(@Nullable ByteSizeValue maxModelMemoryLimit)
      This is meant to be called when a new job is created. It will optionally validate the model memory limit against the max limit and it will set the current version defaults to missing values.
    • validateModelSnapshotRetentionSettingsAndSetDefaults

      public void validateModelSnapshotRetentionSettingsAndSetDefaults()
      This is meant to be called when a new job is created. It sets dailyModelSnapshotRetentionAfterDays to the default value if it is not set and the default makes sense.
    • validateModelSnapshotRetentionSettings

      public void validateModelSnapshotRetentionSettings()
      Validates that modelSnapshotRetentionDays and dailyModelSnapshotRetentionAfterDays make sense, both individually and in combination.
    • validateDetectorsAreUnique

      public void validateDetectorsAreUnique()
      Validates that the Detector configs are unique up to detectorIndex field (which is ignored).
    • build

      public Job build(Date createTime)
      Builds a job with the given createTime and the current version. This should be used when a new job is created as opposed to build().
      Parameters:
      createTime - The time this job was created
      Returns:
      The job
    • build

      public Job build()
      Builds a job. This should be used when an existing job is being built as opposed to build(Date).
      Returns:
      The job