Package org.ggf.drmaa
Interface JobInfo
-
- All Known Implementing Classes:
JobInfoImpl
public interface JobInfoThis interface represents the status and usage information for a finished job. It provides access to the job's id, the job's exit status, and a table indicating the amount of resources used during the execution of the job. The resource table contents are dependent on the DRM.Example
public static void main (String[] args) { SessionFactory factory = SessionFactory.getFactory(); Session session = factory.getSession(); try { session.init (""); JobTemplate jt = session.createJobTemplate(); jt.setRemoteCommand("sleeper.sh"); jt.setArgs(Collections.singletonList("5")}; String id = session.runJob(jt); session.deleteJobTemplate(jt); JobInfo info = session.wait(id, Session.TIMEOUT_WAIT_FOREVER); // Interrogate job exit status if (info.wasAborted()) { System.out.println("Job " + info.getJobId() + " never ran"); } else if (info.hasExited()) { System.out.println("Job " + info.getJobId() + " finished regularly with exit status " + info.getExitStatus()); } else if (info.hasSignaled()) { System.out.println("Job " + info.getJobId() + " finished due to signal " + info.getTerminatingSignal()); if (info.hasCoreDump()) { System.out.println("A core dump is available."); } } else { System.out.println("Job " + info.getJobId() + " finished with unclear conditions"); } System.out.println ("\nJob Usage:"); Map rmap = info.getResourceUsage(); Iterator i = rmap.keySet().iterator(); while (i.hasNext()) { String name = (String)i.next(); String value = (String)rmap.get(name); System.out.println(" " + name + "=" + value); } session.exit(); } catch (DrmaaException e) { System.out.println ("Error: " + e.getMessage()); } }- Since:
- 0.4.2
- Version:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetExitStatus()If hasExited() returns true, this function returns the exit code that the job passed to _exit() (see exit(2)) or exit(3C)), or the value that the child process returned from its main method.java.lang.StringgetJobId()Get the id of the finished job.java.util.MapgetResourceUsage()Get the resource usage data for the finished job.java.lang.StringgetTerminatingSignal()If hasSignaled() returnstrue, this method returns a representation of the signal that caused the termination of the job.booleanhasCoreDump()If hasSignaled() returnstrue, this function returnstrueif a core image of the terminated job was created.booleanhasExited()Returnstrueif the job terminated normally.booleanhasSignaled()Returnstrueif the job terminated due to the receipt of a signal.booleanwasAborted()Returnstrueif the job ended before entering the running state.
-
-
-
Method Detail
-
getJobId
java.lang.String getJobId() throws DrmaaExceptionGet the id of the finished job.- Returns:
- the job id
- Throws:
DrmaaException- May be one of the following:- DrmCommunicationException -- the DRMAA implementation was unable to contact the DRM
- AuthorizationException -- the executing user does not have sufficient permissions to execute the desired action
- InternalException -- an error has occured in the DRMAA implementation
-
getResourceUsage
java.util.Map getResourceUsage() throws DrmaaExceptionGet the resource usage data for the finished job. If the job finished, but no resource usage data is available, this method will returnnull.- Returns:
- the resource usage data
- Throws:
DrmaaException- May be one of the following:- DrmCommunicationException -- the DRMAA implementation was unable to contact the DRM
- AuthorizationException -- the executing user does not have sufficient permissions to execute the desired action
- InternalException -- an error has occured in the DRMAA implementation
-
hasExited
boolean hasExited() throws DrmaaExceptionReturnstrueif the job terminated normally.Falsecan also indicate that although the job has terminated normally, an exit status is not available, or that it is not known whether the job terminated normally. In both cases getExitStatus() will throw an IllegalStateException.Trueindicates that more detailed diagnosis can be discovered by means of getExitStatus().- Returns:
- if the job has exited
- Throws:
DrmaaException- May be one of the following:- DrmCommunicationException -- the DRMAA implementation was unable to contact the DRM
- AuthorizationException -- the executing user does not have sufficient permissions to execute the desired action
- InternalException -- an error has occured in the DRMAA implementation
- See Also:
getExitStatus()
-
getExitStatus
int getExitStatus() throws DrmaaExceptionIf hasExited() returns true, this function returns the exit code that the job passed to _exit() (see exit(2)) or exit(3C)), or the value that the child process returned from its main method.- Returns:
- the exit code for the job
- Throws:
DrmaaException- May be one of the following:- DrmCommunicationException -- the DRMAA implementation was unable to contact the DRM
- AuthorizationException -- the executing user does not have sufficient permissions to execute the desired action
- InternalException -- an error has occured in the DRMAA implementation
- IllegalStateException -- if no exit state information is available
- See Also:
hasExited()
-
hasSignaled
boolean hasSignaled() throws DrmaaExceptionReturnstrueif the job terminated due to the receipt of a signal.Falsecan also indicate that although the job has terminated due to the receipt of a signal, the signal is not available, or that it is not known whether the job terminated due to the receipt of a signal. In both cases getTerminatingSignal() will throw an IllegalStateException.Trueindicates that the name of the terminating signal can be discovered by means of getTerminatingSignal().- Returns:
- if the job exited on a signal
- Throws:
DrmaaException- May be one of the following:- DrmCommunicationException -- the DRMAA implementation was unable to contact the DRM
- AuthorizationException -- the executing user does not have sufficient permissions to execute the desired action
- InternalException -- an error has occured in the DRMAA implementation
- See Also:
getTerminatingSignal()
-
getTerminatingSignal
java.lang.String getTerminatingSignal() throws DrmaaExceptionIf hasSignaled() returnstrue, this method returns a representation of the signal that caused the termination of the job. For signals declared by POSIX, the symbolic names are be returned (e.g., SIGABRT, SIGALRM).For signals not declared by POSIX, a DRM dependent string is returned.
- Returns:
- the name of the terminating signal
- Throws:
DrmaaException- May be one of the following:- DrmCommunicationException -- the DRMAA implementation was unable to contact the DRM
- AuthorizationException -- the executing user does not have sufficient permissions to execute the desired action
- InternalException -- an error has occured in the DRMAA implementation
- IllegalStateException -- if the job did not terminate due to the receipt of a signal
- See Also:
hasSignaled()
-
hasCoreDump
boolean hasCoreDump() throws DrmaaExceptionIf hasSignaled() returnstrue, this function returnstrueif a core image of the terminated job was created.- Returns:
- whether a core dump image was created
- Throws:
DrmaaException- May be one of the following:- DrmCommunicationException -- the DRMAA implementation was unable to contact the DRM
- AuthorizationException -- the executing user does not have sufficient permissions to execute the desired action
- InternalException -- an error has occured in the DRMAA implementation
- IllegalStateException -- if the job did not terminate due to the receipt of a signal
- See Also:
hasSignaled()
-
wasAborted
boolean wasAborted() throws DrmaaExceptionReturnstrueif the job ended before entering the running state.- Returns:
- whether the job ended before entering the running state
- Throws:
DrmaaException- May be one of the following:- DrmCommunicationException -- the DRMAA implementation was unable to contact the DRM
- AuthorizationException -- the executing user does not have sufficient permissions to execute the desired action
- InternalException -- an error has occured in the DRMAA implementation
-
-