Class JobDefinition

java.lang.Object
net.sf.basedb.opengrid.JobDefinition

public class JobDefinition extends Object
Define a job that should be submitted to the cluster. The definition consists of four parts: The command/bash script that should be executed Options for the job (eg. parameters to the 'qsub'/'sbatch' command) Files that must be transmitted to the cluster before the job can be executed A BASE job item that acts as a proxy for the job. This is optional but without it the job will not be managed by this extension.
Since:
1.0
Author:
nicklas
  • Field Details

  • Constructor Details

    • JobDefinition

      public JobDefinition(String namePrefix, JobConfig config)
      Create a new job definition that is not connected to a BASE job item. The given prefix is combined with a random UUID to create a unique name for the job.
      Parameters:
      namePrefix - A prefix for the job name. Checked with OpenGrid.checkValidFilename(String)
    • JobDefinition

      public JobDefinition(String namePrefix, JobConfig config, Job baseJob)
      Create a new job definition that is connected to a BASE job. The given prefix is combined with a random UUID to create a unique name for the job.
      Parameters:
      namePrefix - A prefix for the job name. Checked with OpenGrid.checkValidFilename(String)
      config - Configuration settings for the job, or null to use JobConfig.DEFAULT
      baseJob - Optional BASE Job item that is a representation of the job on the cluster
    • JobDefinition

      public JobDefinition(String namePrefix, JobConfig config, BatchConfig batchConfig, Job baseJob)
      Create a job definition with a batch configuration that overrides the default job configuration.
      Parameters:
      batchConfig - A batch configuration, if null the JobConfig.getBatchConfig() is used
      Since:
      1.5
  • Method Details

    • getName

      public String getName()
      Get the name of this job definition.
    • getConfig

      public JobConfig getConfig()
      Get the configuration settings for this job.
    • getBatchConfig

      public BatchConfig getBatchConfig()
      Get the batch configuration settings.
      Since:
      1.5
    • getBaseJob

      public Job getBaseJob()
      Get the BASE job that this job definition is connected with.
      Returns:
      A BASE Job item or null if not connected to a a job
    • setCmd

      public void setCmd(String cmd)
      Set the command/bash script to execute as part of this job.
    • getCmd

      public String getCmd()
    • setDebug

      public void setDebug(boolean debug)
      Set the debug flag. This affectes which temporary working folder to use and if it should automatically be deleted after a job has been completed or not.
      See Also:
    • getDebug

      public boolean getDebug()
    • addFile

      public void addFile(UploadSource file)
      See Also:
    • addFile

      public void addFile(UploadSource file, FilePermission permission)
      Register a file that should be uploaded to the cluster as part of this job. The file will be stored in the working directory of the job under the name UploadSource.getName(). The actual upload of the file is done as part of registering the job with an Open Grid cluster. See OpenGridSession.qsub(DbControl, List).
      Parameters:
      file - The file to upload
      permission - The permission to give to the file (FilePermission.USER_RW is used as default)
    • getFiles

      Get all files that should be uploaded to the cluster as part of this job.
    • asJobScript

      @Deprecated public String asJobScript(String workFolder, String tmpFolder)
      Generate a script for this job that fits what 'qsub' expects.