java.lang.Object
org.elasticsearch.xpack.core.ml.job.config.JobTaskState
All Implemented Interfaces:
NamedWriteable, Writeable, PersistentTaskState, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject, MlTaskState

public class JobTaskState extends Object implements PersistentTaskState, MlTaskState
  • Field Details

  • Constructor Details

  • Method Details

    • fromXContent

      public static JobTaskState fromXContent(org.elasticsearch.xcontent.XContentParser parser)
    • getState

      public JobState getState()
    • getAllocationId

      public long getAllocationId()
    • getReason

      @Nullable public String getReason()
    • getLastStateChangeTime

      @Nullable public Instant getLastStateChangeTime()
      Description copied from interface: MlTaskState
      The time of the last state change.
      Specified by:
      getLastStateChangeTime in interface MlTaskState
    • isFailed

      public boolean isFailed()
      Specified by:
      isFailed in interface MlTaskState
      Returns:
      Is the task in the failed state?
    • isStatusStale

      public boolean isStatusStale(PersistentTasksCustomMetadata.PersistentTask<?> task)
      The job state stores the allocation ID at the time it was last set. This method compares the allocation ID in the state with the allocation ID in the task. If the two are different then the task has been relocated to a different node after the last time the state was set. This in turn means that the state is not necessarily correct. For example, a job that has a state of OPENED but is stale must be considered to be OPENING, because it won't yet have a corresponding autodetect process.
      Parameters:
      task - The job task to check.
      Returns:
      Has the task been relocated to another node and not had its status set since then?
    • getWriteableName

      public String getWriteableName()
      Specified by:
      getWriteableName in interface NamedWriteable
    • writeTo

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

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object