Package org.ggf.drmaa
Interface JobInfo
- All Known Implementing Classes:
JobInfoImpl
public interface JobInfo
This 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
Modifier and TypeMethodDescriptionint
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.getJobId()
Get the id of the finished job.Get the resource usage data for the finished job.If hasSignaled() returnstrue
, this method returns a representation of the signal that caused the termination of the job.boolean
If hasSignaled() returnstrue
, this function returnstrue
if a core image of the terminated job was created.boolean
Returnstrue
if the job terminated normally.boolean
Returnstrue
if the job terminated due to the receipt of a signal.boolean
Returnstrue
if the job ended before entering the running state.
-
Method Details
-
getJobId
Get 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
Get 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
Returnstrue
if the job terminated normally.False
can 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.True
indicates 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
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.- 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:
-
hasSignaled
Returnstrue
if the job terminated due to the receipt of a signal.False
can 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.True
indicates 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
If 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:
-
hasCoreDump
If hasSignaled() returnstrue
, this function returnstrue
if 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:
-
wasAborted
Returnstrue
if 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
-