Package net.sf.basedb.opengrid
Class JobDefinition
java.lang.Object
net.sf.basedb.opengrid.JobDefinition
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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Class for storing a file and a permission as one entity. -
Field Summary
Modifier and TypeFieldDescriptionprivate final Job
private final BatchConfig
private String
private final JobConfig
private static final AtomicInteger
private boolean
private static final DateFormatter
private final List<JobDefinition.UploadSourceWithPermission>
private final String
-
Constructor Summary
ConstructorDescriptionJobDefinition
(String namePrefix, JobConfig config) Create a new job definition that is not connected to a BASE job item.JobDefinition
(String namePrefix, JobConfig config, Job baseJob) Create a new job definition that is connected to a BASE job.JobDefinition
(String namePrefix, JobConfig config, BatchConfig batchConfig, Job baseJob) Create a job definition with a batch configuration that overrides the default job configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFile
(UploadSource file) void
addFile
(UploadSource file, FilePermission permission) Register a file that should be uploaded to the cluster as part of this job.asJobScript
(String workFolder, String tmpFolder) Deprecated.Get the BASE job that this job definition is connected with.Get the batch configuration settings.getCmd()
Get the configuration settings for this job.boolean
getDebug()
getFiles()
Get all files that should be uploaded to the cluster as part of this job.getName()
Get the name of this job definition.void
Set the command/bash script to execute as part of this job.void
setDebug
(boolean debug) Set the debug flag.
-
Field Details
-
DF
-
COUNTER
-
name
-
config
-
batchConfig
-
baseJob
-
cmd
-
debug
private boolean debug -
filesToUpload
-
-
Constructor Details
-
JobDefinition
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 withOpenGrid.checkValidFilename(String)
-
JobDefinition
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 withOpenGrid.checkValidFilename(String)
config
- Configuration settings for the job, or null to useJobConfig.DEFAULT
baseJob
- Optional BASEJob
item that is a representation of the job on the cluster
-
JobDefinition
Create a job definition with a batch configuration that overrides the default job configuration.- Parameters:
batchConfig
- A batch configuration, if null theJobConfig.getBatchConfig()
is used- Since:
- 1.5
-
-
Method Details
-
getName
Get the name of this job definition. -
getConfig
Get the configuration settings for this job. -
getBatchConfig
Get the batch configuration settings.- Since:
- 1.5
-
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
Set the command/bash script to execute as part of this job. -
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
- See Also:
-
addFile
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 nameUploadSource.getName()
. The actual upload of the file is done as part of registering the job with an Open Grid cluster. SeeOpenGridSession.qsub(DbControl, List)
.- Parameters:
file
- The file to uploadpermission
- 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.In 1.4, useOpenGridEngine.createQsubScript(JobDefinition, String, String)
insteadGenerate a script for this job that fits what 'qsub' expects.
-
OpenGridEngine.createQsubScript(JobDefinition, String, String)
instead