Package net.sf.basedb.opengrid
Class JobStatus
java.lang.Object
net.sf.basedb.opengrid.JobStatus
- Direct Known Subclasses:
DirectEngine.ProcessJobStatus
,OpenGridEngine.OpenGridJobStatus
,SlurmEngine.SlurmJobStatus
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 Summary
Modifier and TypeFieldDescriptionprivate long
private int
private final JobIdentifier
private String
private String
private String
private int
static final DateFormatter
Convert date string from "qacct -j <id>" into Date objects.static final DateFormatter
Convert date string from "qstat -xml" into Date objects.private long
private Job.Status
private long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the end time as a date.long
Get the time the job ended execution.int
Get the exit code from the job script.Get the identifier for the job.Get the progress message of an executing job.getName()
Get the name of the job.Get the name of the node in the cluster that the job is/was running on.int
Get the progress in percent of an executing job.Get the start time as a date.long
Get the time the job started to execute on one of the cluster nodes.Get the status of the job.Get the submission time as a date.long
Get the time the job was submitted to the cluster.boolean
isAlive()
Utility method for checking if the status of this job is "alive": eg. null, WAITING or EXECUTING(package private) void
readFromProgress
(String data) Parse the data from the 'progress' file which is fomatted as <percent-value> <message>.protected void
setEndTime
(long time) protected void
setExitCode
(int exitCode) protected void
setMessage
(String message) protected void
protected void
setNodeName
(String nodeName) protected void
setProgress
(int progress) protected void
setStartTime
(long time) protected void
setStatus
(Job.Status status) protected void
setSubmissionTime
(long time) (package private) void
setSubmitted
(long submissionTime, String name) Called after a job has been been successfully submitted to the cluster.toString()
-
Field Details
-
QSTAT_DATE
Convert date string from "qstat -xml" into Date objects. Example: 2014-03-21T08:59:09 -
QACCT_DATE
Convert date string from "qacct -j <id>" into Date objects. Example: Fri Mar 21 08:59:09 2014 -
jobId
-
name
-
status
-
submissionTime
private long submissionTime -
startTime
private long startTime -
endTime
private long endTime -
nodeName
-
progress
private int progress -
message
-
exitCode
private int exitCode
-
-
Constructor Details
-
JobStatus
-
-
Method Details
-
getJobIdentifier
Get the identifier for the job. -
getName
Get the name of the job. This is the name we gave the job while defining it. SeeJobDefinition.getName()
. -
setName
-
getStatus
Get the status of the job. May be null if not known. -
setStatus
-
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
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
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
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
Get the name of the node in the cluster that the job is/was running on. -
setNodeName
-
getProgress
public int getProgress()Get the progress in percent of an executing job. -
setProgress
protected void setProgress(int progress) -
getMessage
Get the progress message of an executing job. -
setMessage
-
setSubmitted
Called after a job has been been successfully submitted to the cluster. The job status after this call will be WAITING. -
readFromProgress
Parse the data from the 'progress' file which is fomatted as <percent-value> <message>. -
toString
-