Class JobStatus

java.lang.Object
net.sf.basedb.opengrid.JobStatus
Direct Known Subclasses:
DirectEngine.ProcessJobStatus, OpenGridEngine.OpenGridJobStatus, SlurmEngine.SlurmJobStatus

public class JobStatus
extends Object
Class for keeping track of the status of jobs submitted to an Open Grid cluster. Note that not all information may be available at all times. For example, once the job has started to execute the submission time may no longer be available. The information in this class should be considered read-only. Write access can be provided by subclassing and using the protected setter methods.
Since:
1.0
Author:
nicklas
  • Field Details

    • QSTAT_DATE

      public static final DateFormatter QSTAT_DATE
      Convert date string from "qstat -xml" into Date objects. Example: 2014-03-21T08:59:09
    • QACCT_DATE

      public static final DateFormatter QACCT_DATE
      Convert date string from "qacct -j <id>" into Date objects. Example: Fri Mar 21 08:59:09 2014
    • jobId

      private final JobIdentifier jobId
    • name

      private String name
    • status

      private Job.Status status
    • submissionTime

      private long submissionTime
    • startTime

      private long startTime
    • endTime

      private long endTime
    • nodeName

      private String nodeName
    • progress

      private int progress
    • message

      private String message
    • exitCode

      private int exitCode
  • Constructor Details

  • Method Details

    • getJobIdentifier

      public JobIdentifier getJobIdentifier()
      Get the identifier for the job.
    • getName

      public String getName()
      Get the name of the job. This is the name we gave the job while defining it. See JobDefinition.getName().
    • setName

      protected void setName​(String name)
    • getStatus

      public Job.Status getStatus()
      Get the status of the job. May be null if not known.
    • setStatus

      protected void setStatus​(Job.Status status)
    • isAlive

      public boolean isAlive()
      Utility method for checking if the status of this job is "alive": eg. null, WAITING or EXECUTING
    • getSubmissionTime

      public long getSubmissionTime()
      Get the time the job was submitted to the cluster. Should always be known if the job is WAITING but may be unknown otherwise (=0).
    • getSubmissionDate

      public Date getSubmissionDate()
      Get the submission time as a date. Returns null if not known.
    • setSubmissionTime

      protected void setSubmissionTime​(long time)
    • getStartTime

      public long getStartTime()
      Get the time the job started to execute on one of the cluster nodes. Should always be known if the job is EXECUTING but may be unknown otherwise (=0)
    • getStartDate

      public Date getStartDate()
      Get the start time as a date. Returns null if not known.
    • setStartTime

      protected void setStartTime​(long time)
    • getEndTime

      public long getEndTime()
      Get the time the job ended execution. Should always be known if the status is DONE, but may be unknown otherwise (if an error occurs before execution, the status can be ERROR without any end time).
    • getEndDate

      public Date getEndDate()
      Get the end time as a date. Returns null if not known.
    • setEndTime

      protected void setEndTime​(long time)
    • getExitCode

      public int getExitCode()
      Get the exit code from the job script. Typically, 0 if successful, !=0 if some kind of problem.
    • setExitCode

      protected void setExitCode​(int exitCode)
    • getNodeName

      public String getNodeName()
      Get the name of the node in the cluster that the job is/was running on.
    • setNodeName

      protected void setNodeName​(String nodeName)
    • getProgress

      public int getProgress()
      Get the progress in percent of an executing job.
    • setProgress

      protected void setProgress​(int progress)
    • getMessage

      public String getMessage()
      Get the progress message of an executing job.
    • setMessage

      protected void setMessage​(String message)
    • setSubmitted

      void setSubmitted​(long submissionTime, String name)
      Called after a job has been been successfully submitted to the cluster. The job status after this call will be WAITING.
    • readFromProgress

      void readFromProgress​(String data)
      Parse the data from the 'progress' file which is fomatted as <percent-value> <message>.
    • toString

      public String toString()
      Overrides:
      toString in class Object