Class DirectEngine

java.lang.Object
net.sf.basedb.opengrid.engine.DirectEngine
All Implemented Interfaces:
ClusterEngine

public class DirectEngine extends Object implements ClusterEngine
Engine implementation for servers without a job manager. Jobs are stared immediately when submitted. Intended to be used for development and testing only.
Since:
1.5
Author:
nicklas
  • Field Details

  • Constructor Details

    • DirectEngine

      public DirectEngine()
  • Method Details

    • setDefaultConfig

      public void setDefaultConfig(ClusterConfig config)
      Description copied from interface: ClusterEngine
      Set default configuration parameters on the given configuration object. It is expected that the ClusterConfig.getType() is a type that is compatible with the engine implementation.
      Specified by:
      setDefaultConfig in interface ClusterEngine
    • createJobSubmission

      public JobSubmission createJobSubmission(OpenGridSession session, JobDefinition job, String workFolder, String tmpFolder)
      Description copied from interface: ClusterEngine
      Create a job submission for executing a job on the cluster.
      Specified by:
      createJobSubmission in interface ClusterEngine
      Parameters:
      session - A connected session that can be used to execute commands on the cluster
      job - Information about the job
      workFolder - The work folder where files needed for the job are stored
      tmpFolder - A temporary folder where the job is allowed to store files
      Returns:
      A JobSubmission instance
    • getStatusInQueue

      public CmdResult<JobStatus> getStatusInQueue(OpenGridSession session, JobIdentifier jobId, int timeAdjustment)
      Description copied from interface: ClusterEngine
      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.
      Specified by:
      getStatusInQueue in interface ClusterEngine
      Parameters:
      session - A connected session that can be used to execute commands on the cluster
      jobId - Job identifier
      timeAdjustment - 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

      public CmdResult<JobStatus> getStatusIfFinished(OpenGridSession session, JobIdentifier jobId, int timeAdjustment)
      Description copied from interface: ClusterEngine
      Get information about a job that is expected to have finished.
      Specified by:
      getStatusIfFinished in interface ClusterEngine
      Parameters:
      session - A connected session that can be used to execute commands on the cluster
      jobId - Job identifier
      timeAdjustment - 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

      public CmdResult<String> cancelJob(OpenGridSession session, JobIdentifier jobId)
      Description copied from interface: ClusterEngine
      Tell the cluster that a running or waiting job should be cancelled.
      Specified by:
      cancelJob in interface ClusterEngine
      Parameters:
      session - A connected session that can be used to execute commands on the cluster
      jobId - Job identifier
      Returns:
      The result of executing the command
    • createOptionsFile

      private UploadSource createOptionsFile(OpenGridSession session, JobDefinition job, String workFolder, String tmpFolder)
    • getScript

      private UploadSource getScript(String name)
    • getJobStatusPath

      private static String getJobStatusPath(OpenGridSession session, String jobId)
      Get the path to where the status information for a job is saved.
    • createJobScript

      public String createJobScript(JobDefinition job, String workFolder, String tmpFolder)
      Generates a script that executes the job script.