Package net.sf.basedb.opengrid.engine
Interface ClusterEngine
- All Known Implementing Classes:
DirectEngine
,OpenGridEngine
,SlurmEngine
public interface ClusterEngine
Internal interface to be implemented once for each type
of cluster. The engine implements common functionality that
is different for each type of cluster.
- Since:
- 1.4
- Author:
- nicklas
-
Method Summary
Modifier and TypeMethodDescriptioncancelJob
(OpenGridSession session, JobIdentifier jobId) Tell the cluster that a running or waiting job should be cancelled.createJobSubmission
(OpenGridSession session, JobDefinition job, String workFolder, String tmpFolder) Create a job submission for executing a job on the cluster.getStatusIfFinished
(OpenGridSession session, JobIdentifier jobId, int timeAdjustment) Get information about a job that is expected to have finished.getStatusInQueue
(OpenGridSession session, JobIdentifier jobId, int timeAdjustment) Get information about a job that is expected to be waiting in the queue or running.getSupportedSignals
(JobStatus newStatus, Job.Status currentStatus) Get the signals that are supported for jobs with the given current and new job status.modifyJob
(OpenGridSession session, JobIdentifier jobId, Signal signal) Modify the specified job on the cluster according to the given signal.void
setDefaultConfig
(ClusterConfig config) Set default configuration parameters on the given configuration object.
-
Method Details
-
setDefaultConfig
Set default configuration parameters on the given configuration object. It is expected that theClusterConfig.getType()
is a type that is compatible with the engine implementation. -
createJobSubmission
JobSubmission createJobSubmission(OpenGridSession session, JobDefinition job, String workFolder, String tmpFolder) Create a job submission for executing a job on the cluster.- Parameters:
session
- A connected session that can be used to execute commands on the clusterjob
- Information about the jobworkFolder
- The work folder where files needed for the job are storedtmpFolder
- A temporary folder where the job is allowed to store files- Returns:
- A JobSubmission instance
-
getStatusInQueue
CmdResult<JobStatus> getStatusInQueue(OpenGridSession session, JobIdentifier jobId, int timeAdjustment) Get information about a job that is expected to be waiting in the queue or running. If this is not the case, the CmdResult should return with exit status set to 1.- Parameters:
session
- A connected session that can be used to execute commands on the clusterjobId
- Job identifiertimeAdjustment
- Adjustment in seconds that should be applied to all times returned by commands on the cluster (this will make times compatible with BASE server)- Returns:
- A CmdResult instance with JobStatus information
-
getStatusIfFinished
CmdResult<JobStatus> getStatusIfFinished(OpenGridSession session, JobIdentifier jobId, int timeAdjustment) Get information about a job that is expected to have finished.- Parameters:
session
- A connected session that can be used to execute commands on the clusterjobId
- Job identifiertimeAdjustment
- Adjustment in seconds that should be applied to all times returned by commands on the cluster (this will make times compatible with BASE server)- Returns:
- A CmdResult instance with JobStatus information
-
cancelJob
Tell the cluster that a running or waiting job should be cancelled.- Parameters:
session
- A connected session that can be used to execute commands on the clusterjobId
- Job identifier- Returns:
- The result of executing the command
-
modifyJob
Modify the specified job on the cluster according to the given signal. Returns the result of the executing command or null if no action was taken. The default implementation return null. Note that the ABORT signal is sent to thecancelJob(OpenGridSession, JobIdentifier)
method and not to this method.- Since:
- 1.15
-
getSupportedSignals
Get the signals that are supported for jobs with the given current and new job status. This method is typically only called for status: WAITING, PAUSED and EXECUTING. It is safe to return null or an empty collection if no signals are supported.- Since:
- 1.15
-