Package net.sf.basedb.opengrid
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 Summary
Fields Modifier and Type Field Description private long
endTime
private int
exitCode
private JobIdentifier
jobId
private String
message
private String
name
private String
nodeName
private int
progress
static DateFormatter
QACCT_DATE
Convert date string from "qacct -j <id>" into Date objects.static DateFormatter
QSTAT_DATE
Convert date string from "qstat -xml" into Date objects.private long
startTime
private Job.Status
status
private long
submissionTime
-
Constructor Summary
Constructors Modifier Constructor Description protected
JobStatus(JobIdentifier jobId)
-
Method Summary
Modifier and Type Method Description Date
getEndDate()
Get the end time as a date.long
getEndTime()
Get the time the job ended execution.int
getExitCode()
Get the exit code from the job script.JobIdentifier
getJobIdentifier()
Get the identifier for the job.String
getMessage()
Get the progress message of an executing job.String
getName()
Get the name of the job.String
getNodeName()
Get the name of the node in the cluster that the job is/was running on.int
getProgress()
Get the progress in percent of an executing job.Date
getStartDate()
Get the start time as a date.long
getStartTime()
Get the time the job started to execute on one of the cluster nodes.Job.Status
getStatus()
Get the status of the job.Date
getSubmissionDate()
Get the submission time as a date.long
getSubmissionTime()
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
setName(String name)
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.String
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
-