org.ggf.drmaa
public interface JobInfo
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()); } }
Modifier and Type | Method and Description |
---|---|
int |
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.
|
java.lang.String |
getJobId()
Get the id of the finished job.
|
java.util.Map |
getResourceUsage()
Get the resource usage data for the finished job.
|
java.lang.String |
getTerminatingSignal()
If hasSignaled() returns
true , this method returns a
representation of the signal that caused the termination of the job. |
boolean |
hasCoreDump()
If hasSignaled() returns
true , this function returns
true if a core image of the terminated job was created. |
boolean |
hasExited()
Returns
true if the job terminated normally. |
boolean |
hasSignaled()
Returns
true if the job terminated due to the receipt
of a signal. |
boolean |
wasAborted()
Returns
true if the job ended before entering the running
state. |
java.lang.String getJobId() throws DrmaaException
DrmaaException
- May be one of the following:
java.util.Map getResourceUsage() throws DrmaaException
null
.DrmaaException
- May be one of the following:
boolean hasExited() throws DrmaaException
true
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().DrmaaException
- May be one of the following:
getExitStatus()
int getExitStatus() throws DrmaaException
DrmaaException
- May be one of the following:
hasExited()
boolean hasSignaled() throws DrmaaException
true
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().DrmaaException
- May be one of the following:
getTerminatingSignal()
java.lang.String getTerminatingSignal() throws DrmaaException
true
, 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.
DrmaaException
- May be one of the following:
hasSignaled()
boolean hasCoreDump() throws DrmaaException
true
, this function returns
true
if a core image of the terminated job was created.DrmaaException
- May be one of the following:
hasSignaled()
boolean wasAborted() throws DrmaaException
true
if the job ended before entering the running
state.DrmaaException
- May be one of the following:
The contents of this file are licensed under the Sun Industry Standards Source License version 1.2.
Copyright 2008, Sun Microsystems, Inc.