Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ggf.drmaa
Class JobInfo

    java.lang.Object
      org.ggf.drmaa.JobInfo

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  JobInfoImpl

public abstract class JobInfo
extends java.lang.Object
implements java.io.Serializable

The class represents the status and usage information for a finished job. It contains 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 (null);
          JobTemplate jt = session.createJobTemplate ();
          jt.setRemoteCommand ("sleeper.sh");
          jt.setArgs (new String[] {"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
Author:
  dan.templeton@sun.com
See Also:
  Serialized Form

Field Summary
`protected java.lang.String` | `jobId` the id of the job this class describes
`protected java.util.Map` | `resourceUsage` a Map of resource usage data
`protected int` | `status` the exit status code for the job

Constructor Summary
`protected` | `JobInfo(java.lang.String jobId, int status, java.util.Map resourceUsage)` Creates a new instance of JobInfo

Method Summary
`abstract 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 main.
`java.lang.String` | `getJobId()` Get the job id.
`java.util.Map` | `getResourceUsage()` Get the resource usage data.
`abstract java.lang.String` | `getTerminatingSignal()` If hasSignaled() returns `true`, this returns a representation of the signal that caused the termination of the job.
`abstract boolean` | `hasCoreDump()` If hasSignaled() returns `true`, this function returns `true` if a core image of the terminated job was created.
`abstract boolean` | `hasExited()` Returns `true` if the job terminated normally.
`abstract boolean` | `hasSignaled()` Returns `true` if the job terminated due to the receipt of a signal.
`abstract boolean` | `wasAborted()` Returns `true` if the job ended before entering the running state.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### jobId

    protected java.lang.String jobId

  the id of the job this class describes

### status

    protected int status

  the exit status code for the job

### resourceUsage

    protected java.util.Map resourceUsage

  a Map of resource usage data

Constructor Detail

### JobInfo

    protected JobInfo(java.lang.String jobId,
                      int status,
                      java.util.Map resourceUsage)

  Creates a new instance of JobInfo

Parameters:
  `jobId` - the id of the job
  `status` - the status code of the job
  `resourceUsage` - the resource usage data for the job. No copy will be made. Because no copy is made, `null` should not be pass in, as this will cause getResourceUsage() to throw a NullPointer.

Method Detail

### getJobId

    public java.lang.String getJobId()

  Get the job id.

  Returns:
    the job id

### getResourceUsage

    public java.util.Map getResourceUsage()

  Get the resource usage data.

  Returns:
    the resource usage data

### hasExited

    public abstract boolean hasExited()

  Returns `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() doesn't provide exit status information. `True` indicates more detailed diagnosis can be provided by means of getExitStatus().

  Returns:
    if the job has exited

### getExitStatus

    public abstract 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 main.

  Returns:
    the exit code for the job

### hasSignaled

    public abstract boolean hasSignaled()

  Returns `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() does not provide signal information.

  Returns:
    if the job exited on a signal

### getTerminatingSignal

    public abstract java.lang.String getTerminatingSignal()

  If hasSignaled() returns `true`, this 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

### hasCoreDump

    public abstract boolean hasCoreDump()

  If hasSignaled() returns `true`, this function returns `true` if a core image of the terminated job was created.

  Returns:
    whether a core dump image was created

### wasAborted

    public abstract boolean wasAborted()

  Returns `true` if the job ended before entering the running state.

  Returns:
    whether the job ended before entering the running state

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD