|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ggf.drmaa.JobTemplate
com.sun.grid.drmaa.JobTemplateImpl
This class represents a remote job and its attributes. It is used to set up the environment for a job to be submitted.
DRMAA job template attributes can be set from six different sources. In order of precedence, from lowest to highest, there are: options set by DRMAA automatically by default, options set in the sge_request file, options set in the script file, options set by the jobCategory property, options set by the nativeSpecification property, and options set through other DRMAA attributes.
By default DRMAA sets four options for all jobs. They are "-w e", "-p 0", "-b yes", and "-shell no". This means that by default, unschedulable jobs cannot be submitted, all jobs will have priority 0, all jobs will be treated as binary, i.e. no scripts args will be parsed, and all jobs will be executed without a wrapper shell.
The sge_request file, found in the $SGE_ROOT/$SGE_CELL/common directory, may contain options to be applied to all jobs. See the sge_request(5) man page for more information.If the sge_request file contains "-b no" or if the nativeSpecification attribute is set and contains "-b no", the script file will be parsed for in-line arguments. Otherwise, no scripts args will be interpreted. See the qsub(1) man page for more information.
If the jobCategory attribute is set, and the category it points to exists in one of the qtask files, the options associated with that category will be applied to the job template. See the qtask(5) man page and the jobCategory attribute accessors below for more information.
If the nativeSpecification attribute is set, all options contained therein will be applied to the job template. See the nativeSpecification accessors below for more information.
Other DRMAA attributes will override any previous settings. For example, if the sge_request file contains "-j y", but the joinFiles attribute is set to false, the ultimate result is that the input and output files will remain separate.
The following DRMAA attributes correspond to the following qsub options:
DRMAA Attribute | qsub Option |
---|---|
remoteCommand | script file |
args | script file arguments |
jobSubmissionState = HOLD | -h |
jobEnvironment | -v |
workingDirectory | NONE |
jobCategory | NONE |
nativeSpecification | NONE |
emailAddresses | -M |
blockEmail = true | -m n |
startTime | -a |
jobName | -N |
inputPath | -i |
outputPath | -o |
errorPath | -e |
joinFiles | -j |
transferFiles | NONE |
The following attributes are unsupported by Grid Engine:
Using the accessors for any of these attributes will result in an UnsupportedAttributeException being thrown.
JobTemplate
,
Session
,
SessionImpl
Field Summary |
Fields inherited from class org.ggf.drmaa.JobTemplate |
args, blockEmail, category, email, env, errorPath, HOME_DIRECTORY, inputPath, join, name, outputPath, PARAMETRIC_INDEX, remoteCommand, spec, startTime, state, wd |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Tests whether this JobTemplateImpl represents the same job template as the given object. |
java.lang.String[] |
getArgs()
Get The parameters passed as arguments to the job. |
java.util.List |
getAttributeNames()
Returns the list of supported properties names. |
boolean |
getBlockEmail()
Get whether to block sending e-mail by default, regardless of the DRMS settings. |
java.lang.String[] |
getEmailAddresses()
Get the list of email addresses used to report the job completion and status. |
java.lang.String |
getErrorPath()
Gets how to direct the job's standard error. |
java.lang.String |
getInputPath()
Get the job's standard input path. |
java.lang.String |
getJobCategory()
Get the opaque string specifying how to resolve site-specific resources and/or policies. |
java.util.Properties |
getJobEnvironment()
Get the environment values that define the remote environment. |
java.lang.String |
getJobName()
Get the name of the job. |
int |
getJobSubmissionState()
Get the job state at submission. |
boolean |
getJoinFiles()
Gets whether the error stream should be intermixed with the output stream. |
java.lang.String |
getNativeSpecification()
Get the opaque string that is passed by the end user to DRMAA to specify site-specific resources and/or policies. |
java.lang.String |
getOutputPath()
Gets how to direct the job's standard output. |
java.lang.String |
getRemoteCommand()
Get the command to execute as the job. |
PartialTimestamp |
getStartTime()
Get the earliest time when the job may be eligible to be run. |
FileTransferMode |
getTransferFiles()
Gets how to transfer files between hosts. |
java.lang.String |
getWorkingDirectory()
Get the directory name where the job will be executed. |
int |
hashCode()
Returns a hash code based on the id used to associate this JobTemplateImpl with its native peer. |
void |
setArgs(java.lang.String[] args)
Set the parameters passed as arguments to the job. |
void |
setBlockEmail(boolean blockEmail)
Specifies whether e-mail sending shall blocked or not. |
void |
setEmailAddresses(java.lang.String[] email)
Set the list of email addresses used to report the job completion and status. |
void |
setErrorPath(java.lang.String errorPath)
Sets how to direct the job's standard error. |
void |
setInputPath(java.lang.String inputPath)
Set the job's standard input path. |
void |
setJobCategory(java.lang.String category)
Specifies the DRMAA job category. |
void |
setJobEnvironment(java.util.Properties env)
Set the environment values that define the remote environment. |
void |
setJobName(java.lang.String name)
Set the name of the job. |
void |
setJobSubmissionState(int state)
Specifies the job state at submission. |
void |
setJoinFiles(boolean join)
Sets whether the error stream should be intermixed with the output stream. |
void |
setNativeSpecification(java.lang.String spec)
Specifies native qsub options which will be interpreted as part of the DRMAA job template. |
void |
setOutputPath(java.lang.String outputPath)
Sets how to direct the job's standard output. |
void |
setRemoteCommand(java.lang.String remoteCommand)
Specifies the remote command to execute. |
void |
setStartTime(PartialTimestamp startTime)
Set the earliest time when the job may be eligible to be run. |
void |
setTransferFiles(FileTransferMode mode)
Sets how to transfer files between hosts. |
void |
setWorkingDirectory(java.lang.String wd)
Specifies the directory name where the job will be executed. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
public void setRemoteCommand(java.lang.String remoteCommand) throws DrmaaException
Specifies the remote command to execute. The remoteCommand must be the path of an executable that is available at the job's execution host. If the path is relative, it is assumed to be relative to the working directory set through the workingDirectory attibute. If workingDirectory is not set, the path is assumed to be relative to the user's home directory.
The file pointed to by remoteCommand may either be an executable binary
or an executable script. If a script, the script must include the path to
the shell in a #! line at the beginning of the script. By default, the
remote command will be executed directly, as by exec. (See the exec(2) man
page.) To have the remote command executed in a shell, such as to
preserve environment settings, use the nativeSpecification attribute to
include the "-shell yes" option. Jobs which are executed by a
wrapper shell fail differently from jobs which are executed directly. A
job executed by a wrapper shell which contains a user error, such as an
invalid path to the executable, will execute successfully and exit with a
return code of 1. A job executed directly which contains such an error
will enter the FAILED
state upon execution.
No binary file management is done.
setRemoteCommand
in class JobTemplate
remoteCommand
- The command to execute as the job
DrmaaException
- Maybe be one of the following:
public java.lang.String getRemoteCommand()
getRemoteCommand
in class JobTemplate
public void setArgs(java.lang.String[] args) throws DrmaaException
setArgs
in class JobTemplate
args
- The parameters passed as arguments to the job
DrmaaException
- Maybe be one of the following:
public java.lang.String[] getArgs()
getArgs
in class JobTemplate
public void setJobSubmissionState(int state) throws DrmaaException
Specifies the job state at submission. The possible values are HOLD
and
ACTIVE
:
ACTIVE
means the job is runnable.
HOLD
means the job is submitted in user hold state (either
Session.USER_ON_HOLD
or Session.USER_SYSTEM_ON_HOLD
). This is
equivalent to the qsub submit option `-h'.
setJobSubmissionState
in class JobTemplate
state
- The job state at submission
DrmaaException
- Maybe be one of the following:
public int getJobSubmissionState()
Get the job state at submission. The states are HOLD
and ACTIVE
:
ACTIVE
means the job is runnable.
HOLD
means the job is submitted in user hold state.
getJobSubmissionState
in class JobTemplate
public void setJobEnvironment(java.util.Properties env) throws DrmaaException
setJobEnvironment
in class JobTemplate
env
- The environment values that define the remote environment
DrmaaException
- Maybe be one of the following:
public java.util.Properties getJobEnvironment()
getJobEnvironment
in class JobTemplate
public void setWorkingDirectory(java.lang.String wd) throws DrmaaException
Specifies the directory name where the job will be executed. The working directory is evaluated relative to the execution host.
A HOME_DIRECTORY
placeholder at the beginning denotes that
the remaining portion of the directory name is resolved relative to the
job submiter's home directory on the execution host.
The PARAMETRIC_INDEX
placeholder can be used at any
position within the directory name of parametric jobs and will be replaced
by the underlying DRM system with the parametric jobs' indices.
The directory name must be specified in a syntax that is common at the
host where the job will be executed. If no placeholder is used, an
absolute directory specification is recommended. If set to a relative path
and no placeholder is used, a path relative to the user's home directory
is assumed. If not set, the working directory will default to the user's
home directory. If the directory does not exist when the job is run, the
job enters the state FAILED
.
setWorkingDirectory
in class JobTemplate
wd
- The directory where the job is executed
DrmaaException
- Maybe be one of the following:
public java.lang.String getWorkingDirectory()
Get the directory name where the job will be executed. The working directory is evaluated relative to the execution host.
A HOME_DIRECTORY
placeholder at the beginning denotes that
the remaining portion of the directory name is resolved relative to the
job submiter's home directory on the execution host.
The PARAMETRIC_INDEX
placeholder can be used at any
position within the directory name of parametric jobs and will be replaced
by the underlying DRM system with the parametric jobs' index.
The directory name must be specified in a syntax that is common at the host where the job will be executed. If set to a relative path and no placeholder is used, a path relative to the user's home directory is assumed.
getWorkingDirectory
in class JobTemplate
public void setJobCategory(java.lang.String category) throws DrmaaException
Specifies the DRMAA job category. The category string is used by the underlying DRM as reference into the qtask file. Certain qsub options used in the referenced qtask file line are applied to the job template before submission to allow site-specific resolving of resources and/or policies. The cluster qtask file, the local qtask file, and the user qtask file are searched. See the qtask(5) man page. Job settings resulting from job template category are overridden by settings resulting from the job template nativeSpecification attribute as well as by explict DRMAA job template settings.
The options -help, -t, -verify, and -w w|v are ignored. The -cwd option is ignored unless the $SGE_DRMAA_ALLOW_CWD environment variable is set.
setJobCategory
in class JobTemplate
category
- An opaque string specifying how to resolve site-specific
resources and/or policies.
DrmaaException
- Maybe be one of the following:
public java.lang.String getJobCategory()
getJobCategory
in class JobTemplate
public void setNativeSpecification(java.lang.String spec) throws DrmaaException
setNativeSpecification
in class JobTemplate
spec
- An opaque string that is passed by the end user to DRMAA to
specify site-specific resources and/or policies
DrmaaException
- Maybe be one of the following:
public java.lang.String getNativeSpecification()
getNativeSpecification
in class JobTemplate
public void setEmailAddresses(java.lang.String[] email) throws DrmaaException
email
- The list of email addresses used to report the job completion
and status.
DrmaaException
- Maybe be one of the following:
public java.lang.String[] getEmailAddresses()
public void setBlockEmail(boolean blockEmail) throws DrmaaException
setBlockEmail
in class JobTemplate
blockEmail
- Whether to block sending e-mail by default
DrmaaException
- Maybe be one of the following:
public boolean getBlockEmail()
getBlockEmail
in class JobTemplate
public void setStartTime(PartialTimestamp startTime) throws DrmaaException
setStartTime
in class JobTemplate
startTime
- The earliest time when the job may be eligible to be run
DrmaaException
- Maybe be one of the following:
public PartialTimestamp getStartTime()
getStartTime
in class JobTemplate
public void setJobName(java.lang.String name) throws DrmaaException
setJobName
in class JobTemplate
name
- The name of the job
DrmaaException
- Maybe be one of the following:
public java.lang.String getJobName()
getJobName
in class JobTemplate
public void setInputPath(java.lang.String inputPath) throws DrmaaException
true
, the input file will be fetched by the underlying DRM
system from the specified host or from the submit host if no hostname
is specified.false
, the input file is always expected at the
host where the job is executed irrespectively of any hostname
specified.PARAMETRIC_INDEX
placeholder can be used at any position
within the file path of parametric job templates and will be replaced
by the underlying DRM system with the parametric job's index.HOME_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the job
submiter's home directory on the host where the file is located.WORKING_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the
job's working directory on the host where the file is located.FAILED
.
setInputPath
in class JobTemplate
inputPath
- The job's standard input path
DrmaaException
- Maybe be one of the following:
public java.lang.String getInputPath()
true
, the input file will be fetched by the underlying DRM
system from the specified host or from the submit host if no hostname
is specified.false
, the input file is always expected at the
host where the job is executed irrespectively of any hostname
specified.PARAMETRIC_INDEX
placeholder can be used at any position
within the file path of parametric job templates and will be replaced
by the underlying DRM system with the parametric job's index.HOME_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the job
submiter's home directory on the host where the file is located.WORKING_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the
job's working directory on the host where the file is located.
getInputPath
in class JobTemplate
public void setOutputPath(java.lang.String outputPath) throws DrmaaException
true
, the output file will be fetched by the underlying
DRM system from the specified host or from the submit host if no hostname
is specified.PARAMETRIC_INDEX
placeholder can be used at any position
within the file path of parametric job templates and will be replaced
by the underlying DRM system with the parametric job's index.HOME_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the job
submiter's home directory on the host where the file is located.WORKING_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the
job's working directory on the host where the file is located.FAILED
.
setOutputPath
in class JobTemplate
outputPath
- How to direct the job's standard output
DrmaaException
- Maybe be one of the following:
public java.lang.String getOutputPath()
false
, the output file is always expected at
the host where the job is executed irrespectively of any hostname
specified.PARAMETRIC_INDEX
placeholder can be used at any position
within the file path of parametric job templates and will be replaced
by the underlying DRM system with the parametric job's index.HOME_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the job
submiter's home directory on the host where the file is located.WORKING_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the
job's working directory on the host where the file is located.
getOutputPath
in class JobTemplate
public void setErrorPath(java.lang.String errorPath) throws DrmaaException
true
, the error file will be fetched by the underlying
DRM system from the specified host or from the submit host if no hostname
is specified.PARAMETRIC_INDEX
placeholder can be used at any position
within the file path of parametric job templates and will be replaced
by the underlying DRM system with the parametric job's index.HOME_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the job
submiter's home directory on the host where the file is located.WORKING_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the
job's working directory on the host where the file is located.FAILED
.
setErrorPath
in class JobTemplate
errorPath
- How to direct the job's standard error
DrmaaException
- Maybe be one of the following:
public java.lang.String getErrorPath()
false
, the error file is always kept at the host where
the job is executed irrespectively of a possibly hostname specified.PARAMETRIC_INDEX
placeholder can be used at any position
within the file path of parametric job templates and will be replaced
by the underlying DRM system with the parametric job's index.HOME_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the job
submiter's home directory on the host where the file is located.WORKING_DIRECTORY
placeholder at the beginning of the file path
denotes that the remaining portion of the file path is relative to the
job's working directory on the host where the file is located.
getErrorPath
in class JobTemplate
public void setJoinFiles(boolean join) throws DrmaaException
setJoinFiles
in class JobTemplate
join
- Whether the error stream should be intermixed with the output
stream
DrmaaException
- Maybe be one of the following:
public boolean getJoinFiles()
getJoinFiles
in class JobTemplate
public void setTransferFiles(FileTransferMode mode) throws DrmaaException
Sets how to transfer files between hosts.
If the FileTransferMode object's errorStream property is set to
true
, the errorPath attribute is taken to specify the
location to which error files should be transfered after the job
finishes.
If the FileTransferMode object's inputStream property is set to
true
, the inputPath attribute is taken to specify the
location from which input files should be transfered before the job
starts.
If the FileTransferMode object's outputStream property is set to
true
, the outputPath attribute is taken to specify the
location to which output files should be transfered after the job
finishes.
See setInputPath(), setOutputPath() and setErrorPath() for information about how to specify the standard input file, standard output file and standard error file.
The file transfer mechanism itself must be configured by the administrator. (see the sge_conf(5) man page.) When it is configured, the administrator has to enable transferFiles by settings the execd param, delegated_file_staging, to true. If it is not configured, transferFiles is not enabled and accessing this property will result in an UnsupportedAttributeException being thrown.
setTransferFiles
in class JobTemplate
mode
- How to transfer files between hosts.
DrmaaException
- Maybe be one of the following:
public FileTransferMode getTransferFiles()
Gets how to transfer files between hosts.
If the FileTransferMode object's errorStream property is set to
true
, the errorPath attribute is taken to specify the
location to which error files should be transfered after the job
finishes.
If the FileTransferMode object's inputStream property is set to
true
, the inputPath attribute is taken to specify the
location from which input files should be transfered before the job
starts.
If the FileTransferMode object's outputStream property is set to
true
, the outputPath attribute is taken to specify the
location to which output files should be transfered after the job
finishes.
getTransferFiles
in class JobTemplate
public java.util.List getAttributeNames()
Returns the list of supported properties names. With the execd param, delegated_file_staging set to false, this list includes only the list of DRMAA required properties. With delegated_file_staging set to true, the list also includes the transferFiles property.
getAttributeNames
in class JobTemplate
public boolean equals(java.lang.Object obj)
obj
- the object against which to compare
public int hashCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |