This method will wait for a job with
jobId to finish execution or fail. If the special string,
JOB_IDS_SESSION_ANY
, is provided as the
jobId, this routine will wait for any job from the session. This routine is modeled on the wait3 POSIX routine.
The timeout value is used to specify the desired behavior when a result is not immediately available. The value, TIMEOUT_WAIT_FOREVER, may be specified to wait indefinitely for a result. The value, TIMEOUT_NO_WAIT, may be specified to return immediately if no result is available. Alternatively, a number of seconds may be specified to indicate how long to wait for a result to become available.
If the call exits before timeout, either the job has been waited on successfully or there was an interrupt. If the invocation exits on timeout, an ExitTimeoutException is thrown. The caller should check system time before and after this call in order to be sure how much time has passed.
The routine reaps job data records on a successful call, so any subsequent calls to wait(), synchronize(), control(), or getJobProgramStatus() will fail, throwing an InvalidJobException, meaning that the job's data record has been already reaped. This exception is the same as if the job were unknown. (The only case where wait() can be successfully called on a single job more than once is when the previous call to wait() timed out before the job finished.)
When successful, the resource usage information for the job is provided as a Map of usage parameter names and their values in the JobInfo object. The values contain the amount of resources consumed by the job and are implementation defined. If no resource usage information is available for the finished job, the resourceUsage property of the returned JobInfo instance will be null
.
In the 0.5 version of this method, a NoResourceUsageException would be thrown if the target job finished with no resource usage information. In the current implementation, no exception is thrown in that case. Instead, the JobInfo.getResourceUsage() method will return null.
@param jobId the id of the job for which to wait
@param timeout the maximum number of seconds to wait
@return the resource usage and status information
@throws DrmaaException May be one of the following:
- ExitTimeoutException -- the operation timed out before completing
- InvalidJobException -- the job identifier does not refer to an active job
- NoActiveSessionException -- the session has not yet been initialized or has already been exited
- DrmCommunicationException -- the DRMAA implementation was unable to contact the DRM
- AuthorizationException -- the executing user does not have sufficient permissions to execute the desired action
- IllegalArgumentException -- an argument is invalid
- InternalException -- an error has occured in the DRMAA implementation
@see JobInfo