compbio.engine.cluster.drmaa
Class AsyncJobRunner

java.lang.Object
  extended by compbio.engine.cluster.drmaa.AsyncJobRunner
All Implemented Interfaces:
AsyncExecutor

public class AsyncJobRunner
extends java.lang.Object
implements AsyncExecutor

Single cluster job runner class

Author:
pvtroshin

Constructor Summary
AsyncJobRunner()
           
 
Method Summary
 boolean cancelJob(java.lang.String jobId)
          Stop running job.
 boolean cleanup(java.lang.String jobId)
          Remove all files and a job directory for a jobid.
 JobStatus getJobStatus(java.lang.String jobId)
          This will never return clust.engine.JobStatus.CANCELLED as for sun grid engine cancelled job is the same as failed.
 ConfiguredExecutable<?> getResults(java.lang.String jobId)
          Retrieve the results of the job.
 java.lang.String getWorkDirectory(java.lang.String jobId)
           
 java.lang.String submitJob(ConfiguredExecutable<?> executable)
          Submits job for the execution Immediate execution is not guaranteed, this method puts the job in the queue.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncJobRunner

public AsyncJobRunner()
Method Detail

submitJob

public java.lang.String submitJob(ConfiguredExecutable<?> executable)
                           throws JobSubmissionException
Description copied from interface: AsyncExecutor
Submits job for the execution Immediate execution is not guaranteed, this method puts the job in the queue. All it guarantees that the job will be eventually executed. The start of execution will depend on the number of jobs in the queue.

Specified by:
submitJob in interface AsyncExecutor
Returns:
unique job identifier
Throws:
JobSubmissionException - if submission fails. This usually happens due to the problem on a server side.

cancelJob

public boolean cancelJob(java.lang.String jobId)
Description copied from interface: AsyncExecutor
Stop running job. Please not that this method does not guarantee to remove the job directory and files in it.

Specified by:
cancelJob in interface AsyncExecutor
Returns:
true if job was cancelled successfully, false otherwise

getJobStatus

public JobStatus getJobStatus(java.lang.String jobId)
This will never return clust.engine.JobStatus.CANCELLED as for sun grid engine cancelled job is the same as failed. Cancelled jobs needs to be tracked manually!

Specified by:
getJobStatus in interface AsyncExecutor
Returns:
The JobStatus object representing the status of the job
See Also:
JobStatus

cleanup

public boolean cleanup(java.lang.String jobId)
Description copied from interface: AsyncExecutor
Remove all files and a job directory for a jobid.

Specified by:
cleanup in interface AsyncExecutor
Returns:
true if job directory was successfully removed, false otherwise.

getResults

public ConfiguredExecutable<?> getResults(java.lang.String jobId)
                                   throws ResultNotAvailableException
Description copied from interface: AsyncExecutor
Retrieve the results of the job. Please not that current implementations of this method blocks if the task is running until the end of the calculation.

Specified by:
getResults in interface AsyncExecutor
Parameters:
jobId - job identifier obtained at the job submission
Returns:
ConfiguredExecutable object from which result can be obtained
Throws:
ResultNotAvailableException - if the result is not available for whatever reason. Could be due to execution failure, or due to the results being removed from the server at the time of request.

getWorkDirectory

public java.lang.String getWorkDirectory(java.lang.String jobId)
Specified by:
getWorkDirectory in interface AsyncExecutor
Parameters:
jobId - unique job identifier
Returns:
task working directory