org.ggf.drmaa
public interface JobTemplate
There is a 1:n relationship between JobTemplate instances and jobs. A single JobTemplate instance can be used to submit any number of jobs. Once a job has been submitted, e.g. via Session.runJob(), the JobTemplate instance no longer has any affect on that job. Changes made to the JobTemplate instance will have no affect on already running jobs. Deleting the JobTemplate instance (via Session.deleteJobTemplate()) also has no effect on running jobs.
Once a JobTemplate instance has been created (via Session.createJobTemplate()), it is the responsibility of the developer to delete it when no longer needed (via Session.deleteJobTemplate ()). Failure to do so may result in a memory leak.
Example:
public static void main(String[] args) { SessionFactory factory = SessionFactory.getFactory(); Session session = factory.getSession(); try { session.init(""); JobTemplate jt = session.createJobTemplate(); jt.setRemoteCommand("sleeper.sh"); jt.setWorkingDirectory(":" + HOME_DIRECTORY + "/jobs"); jt.setArgs(Collections.singletonList("5")); String id = session.runJob(jt); session.deleteJobTemplate(jt); session.exit(); } catch (DrmaaException e) { System.out.println("Error: " + e.getMessage ()); } }
Session
Modifier and Type | Field and Description |
---|---|
static int |
ACTIVE_STATE
Means the job has been queued and is eligible
to run.
|
static int |
HOLD_STATE
Means the job has been queued but it is not
eligible to run.
|
static java.lang.String |
HOME_DIRECTORY
Placeholder which represents the home directory in the workingDirectory,
inputPath, outputPath, and errorPath properties
|
static java.lang.String |
PARAMETRIC_INDEX
Placeholder which represents the job id for a job in a parametric job set
in the inputPath, outputPath, and errorPath properties
|
static java.lang.String |
WORKING_DIRECTORY
Placeholder which represents the working directory in the
workingDirectory, inputPath, outputPath, and errorPath properties
|
Modifier and Type | Method and Description |
---|---|
java.util.List |
getArgs()
Get the arguments to the job.
|
java.util.Set |
getAttributeNames()
Returns the list of supported property names.
|
boolean |
getBlockEmail()
Get whether to block sending e-mail by default, regardless of the DRMS
settings.
|
PartialTimestamp |
getDeadlineTime()
Sets a deadline after which the DRMS will terminate the job.
|
java.util.Set |
getEmail()
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.
|
long |
getHardRunDurationLimit()
Gets how long the job may be in a running state before its limit has been
exceeded.
|
long |
getHardWallclockTimeLimit()
Gets the duration of the job's wall clock time limit.
|
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.Map |
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 string to execute as the job.
|
long |
getSoftRunDurationLimit()
Gets an estimate as to how long the job will need to remain in a running
state to complete.
|
long |
getSoftWallclockTimeLimit()
Gets an estimate as to how much wall clock time job will need to
complete.
|
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 where the job is executed.
|
void |
setArgs(java.util.List args)
Sets the arguments to the job.
|
void |
setBlockEmail(boolean blockEmail)
Set whether to block sending e-mail by default, regardless of the DRMS
settings.
|
void |
setDeadlineTime(PartialTimestamp deadline)
Sets a deadline after which the DRMS will terminate the job.
|
void |
setEmail(java.util.Set 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 |
setHardRunDurationLimit(long hardRunLimit)
Sets how long the job may be in a running state before its limit has been
exceeded, and therefore is terminated by the DRMS.
|
void |
setHardWallclockTimeLimit(long hardWallclockLimit)
Sets when the job's wall clock time limit has
been exceeded.
|
void |
setInputPath(java.lang.String inputPath)
Set the job's standard input path.
|
void |
setJobCategory(java.lang.String category)
Set an opaque string specifying how to resolve site-specific resources
and/or policies.
|
void |
setJobEnvironment(java.util.Map 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)
Set 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)
Set an opaque string that is passed by the end user to DRMAA to specify
site-specific resources and/or policies.
|
void |
setOutputPath(java.lang.String outputPath)
Sets how to direct the job's standard output.
|
void |
setRemoteCommand(java.lang.String remoteCommand)
Set the command string to execute as the job.
|
void |
setSoftRunDurationLimit(long softRunLimit)
Sets an estimate as to how long the job will need to remain in a running
state to complete.
|
void |
setSoftWallclockTimeLimit(long softWallclockLimit)
Sets an estimate as to how much wall clock time job will need to
complete.
|
void |
setStartTime(PartialTimestamp startTime)
Set the earliest time when the job may be eligible to be run.
|
void |
setTransferFiles(FileTransferMode mode)
Specifies, which of the standard I/O files (stdin, stdout and stderr) are
to be transferred to/from the execution host.
|
void |
setWorkingDirectory(java.lang.String wd)
Set the directory where the job is executed.
|
static final int HOLD_STATE
static final int ACTIVE_STATE
static final java.lang.String HOME_DIRECTORY
static final java.lang.String WORKING_DIRECTORY
static final java.lang.String PARAMETRIC_INDEX
void setRemoteCommand(java.lang.String remoteCommand) throws DrmaaException
remoteCommand
- the command to execute as the jobDrmaaException
- May be one of the following:
java.lang.String getRemoteCommand() throws DrmaaException
DrmaaException
- May be one of the following:
setRemoteCommand(String)
void setArgs(java.util.List args) throws DrmaaException
args
- the parameters passed as arguments to the jobDrmaaException
- May be one of the following:
java.util.List getArgs() throws DrmaaException
DrmaaException
- May be one of the following:
setArgs(List)
void setJobSubmissionState(int state) throws DrmaaException
A job submitted in the HOLD_STATE state can be made eligible to run through the Session.control() method using the Session.RELEASE constant.
state
- the job state at submissionDrmaaException
- May be one of the following:
int getJobSubmissionState() throws DrmaaException
DrmaaException
- May be one of the following:
setJobSubmissionState(int)
void setJobEnvironment(java.util.Map env) throws DrmaaException
env
- the environment values that define the remote environmentDrmaaException
- May be one of the following:
java.util.Map getJobEnvironment() throws DrmaaException
DrmaaException
- May be one of the following:
setJobEnvironment(Map)
void setWorkingDirectory(java.lang.String wd) throws DrmaaException
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 a parametric job and will be replaced
by the underlying DRM system with the parametric job's index.
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 expected.
If the directory does not exist when the job is run, the job enters the state Session.FAILED.
wd
- the directory where the job is executedDrmaaException
- May be one of the following:
java.lang.String getWorkingDirectory() throws DrmaaException
DrmaaException
- May be one of the following:
setWorkingDirectory(String)
void setJobCategory(java.lang.String category) throws DrmaaException
category
- an opaque string specifying how to resolve site-specific
resources and/or policies.DrmaaException
- May be one of the following:
java.lang.String getJobCategory() throws DrmaaException
DrmaaException
- May be one of the following:
setJobCategory(String)
void setNativeSpecification(java.lang.String spec) throws DrmaaException
spec
- an opaque string that is passed by the end user to DRMAA to
specify site-specific resources and/or policiesDrmaaException
- May be one of the following:
java.lang.String getNativeSpecification() throws DrmaaException
DrmaaException
- May be one of the following:
setNativeSpecification(String)
void setEmail(java.util.Set email) throws DrmaaException
email
- the list of email addresses used to report the job
completion and status.DrmaaException
- May be one of the following:
java.util.Set getEmail() throws DrmaaException
DrmaaException
- May be one of the following:
setEmail(Set)
void setBlockEmail(boolean blockEmail) throws DrmaaException
blockEmail
- whether to block sending e-mail by defaultDrmaaException
- May be one of the following:
boolean getBlockEmail() throws DrmaaException
DrmaaException
- May be one of the following:
setBlockEmail(boolean)
void setStartTime(PartialTimestamp startTime) throws DrmaaException
startTime
- the earliest time when the job may be eligible to be runDrmaaException
- May be one of the following:
PartialTimestamp getStartTime() throws DrmaaException
DrmaaException
- May be one of the following:
setStartTime(PartialTimestamp)
void setJobName(java.lang.String name) throws DrmaaException
name
- the name of the jobDrmaaException
- May be one of the following:
java.lang.String getJobName() throws DrmaaException
DrmaaException
- May be one of the following:
setJobName(String)
void setInputPath(java.lang.String inputPath) throws DrmaaException
If set, specifies the network path of the job's input stream in the form of [hostname]:file_path
When the transferFiles property is supported and has it's inputStream property set, 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.
When the transferFiles property is not supported or does not have its inputStream property set, the input file is always expected to be at the host where the job is executed irrespective of a whether a hostname is specified in the path.
The 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.
A 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.
A 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.
The file path must be specified in a syntax that is common at the host where the file is located.
When the job is run, if this property is set, and the file can't be read, the job will enter the state Session.FAILED.
inputPath
- the job's standard input pathDrmaaException
- May be one of the following:
java.lang.String getInputPath() throws DrmaaException
DrmaaException
- May be one of the following:
setInputPath(String)
void setOutputPath(java.lang.String outputPath) throws DrmaaException
When the transferFiles property is supported and has its outputStream property set, the output file will be transferred by the underlying DRM system to the specified host or to the submit host if no hostname is specified.
When the transferFiles property is not supported or does not have it's outputStream property set, the output file is always kept at the host where the job is executed irrespective of a whether a hostname is specified in the path.
The 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.
A 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.
A 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.
The file path must be specified in a syntax that is common at the host where the file is located.
When the job is run, if this property is set, and the file can't be written before execution the job will enter the state Session.FAILED.
outputPath
- how to direct the job's standard outputDrmaaException
- May be one of the following:
java.lang.String getOutputPath() throws DrmaaException
DrmaaException
- May be one of the following:
setOutputPath(String)
void setErrorPath(java.lang.String errorPath) throws DrmaaException
When the transferFiles property is supported and has its errorStream property set, the error file will be transferred by the underlying DRM system to the specified host or to the submit host if no hostname is specified.
When the transferFiles property is not supported or does not have it's errorStream property set, the error file is always kept at the host where the job is executed irrespective of a whether a hostname is specified in the path.
The 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.
A 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.
A 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.
The file path must be specified in a syntax that is common at the host where the file is located.
When the job is run, if this property is set, and the file can't be written before execution the job will enter the state Session.FAILED.
errorPath
- how to direct the job's standard errorDrmaaException
- May be one of the following:
java.lang.String getErrorPath() throws DrmaaException
DrmaaException
- May be one of the following:
setErrorPath(String)
void setJoinFiles(boolean join) throws DrmaaException
false
.
If true
is specified the underlying DRM system will ignore
the value of the errorPath property and intermix the standard error
stream with the standard output stream as specified by the outputPath
property.
join
- whether the error stream should be intermixed with the output
streamDrmaaException
- May be one of the following:
boolean getJoinFiles() throws DrmaaException
DrmaaException
- May be one of the following:
setJoinFiles(boolean)
void setTransferFiles(FileTransferMode mode) throws DrmaaException
If the FileTransferMode instance's errorStream property is set to
true
, the errorPath property is taken to specify the
location to which error files should be transfered after the job
finishes.
If the FileTransferMode instance's inputStream property is set to
true
, the inputPath property is taken to specify the
location from which input files should be transfered before the job
starts.
If the FileTransferMode instance's outputStream property is set to
true
, the outputPath property is taken to specify the
location to which output files should be transfered after the job
finishes.
mode
- how to transfer files between hosts.DrmaaException
- May be one of the following:
setInputPath(String)
,
setOutputPath(String)
,
setErrorPath(String)
FileTransferMode getTransferFiles() throws DrmaaException
DrmaaException
- May be one of the following:
setTransferFiles(FileTransferMode)
void setDeadlineTime(PartialTimestamp deadline) throws DrmaaException
deadline
- the deadline after which the DRMS will terminate the jobDrmaaException
- May be one of the following:
PartialTimestamp getDeadlineTime() throws DrmaaException
DrmaaException
- May be one of the following:
setDeadlineTime(PartialTimestamp)
void setHardWallclockTimeLimit(long hardWallclockLimit) throws DrmaaException
hardWallclockLimit
- when the job's wall clock time limit has been
exceeded. Specified in secondsDrmaaException
- May be one of the following:
long getHardWallclockTimeLimit() throws DrmaaException
DrmaaException
- May be one of the following:
setHardWallclockTimeLimit(long)
void setSoftWallclockTimeLimit(long softWallclockLimit) throws DrmaaException
This attribute is intended to assist the scheduler. If the time specified in insufficient, the drmaa-implementation may impose a scheduling penalty.
softWallclockLimit
- an estimate as to how much wall clock time job
will need to complete. Specified in secondsDrmaaException
- May be one of the following:
long getSoftWallclockTimeLimit() throws DrmaaException
DrmaaException
- May be one of the following:
setSoftWallclockTimeLimit(long)
void setHardRunDurationLimit(long hardRunLimit) throws DrmaaException
hardRunLimit
- how long the job may be in a running state before its
limit has been exceeded. Specified in secondsDrmaaException
- May be one of the following:
long getHardRunDurationLimit() throws DrmaaException
DrmaaException
- May be one of the following:
setHardRunDurationLimit(long)
void setSoftRunDurationLimit(long softRunLimit) throws DrmaaException
softRunLimit
- an estimate as to how long the job will need to
remain in a running state to complete. Specified in secondsDrmaaException
- May be one of the following:
long getSoftRunDurationLimit() throws DrmaaException
DrmaaException
- May be one of the following:
setSoftRunDurationLimit(long)
java.util.Set getAttributeNames() throws DrmaaException
DrmaaException
- May be one of the following:
The contents of this file are licensed under the Sun Industry Standards Source License version 1.2.
Copyright 2008, Sun Microsystems, Inc.