org.globus.gram
Class GramAttributes

java.lang.Object
  extended byorg.globus.rsl.RslAttributes
      extended byorg.globus.gram.GramAttributes

public class GramAttributes
extends RslAttributes

A convienience class for operating on GRAM-specific RSL attributes. Please note the attribute values for attributes such as setStdout, setStderr, setStdin, setDirectory, setExecutable, etc. are treated as single arguments. In case the value contains a RSL variable, the variable will not be properly resolved. For example, if you set the stdout to:

 atts.setStdout("$(MY_URL)/bar");
 atts.addEnvVariable("MY_URL", "http://foo");
 
the resulting rsl will look like:
 &("stdout"="$(MY_URL)/hello")("environment"=("MY_URL" "http://foo"))
 
Since the "$(MY_URL)/hello" is in double quotes it will be treated as a single string and the variable will never be resolved. The parser will set "stdout" to "$(MY_URL)/hello" instead of "http://foo/hello".


Field Summary
static int JOBTYPE_CONDOR
           
static int JOBTYPE_MPI
           
static int JOBTYPE_MULTIPLE
           
static int JOBTYPE_SINGLE
           
 
Fields inherited from class org.globus.rsl.RslAttributes
rslTree
 
Constructor Summary
GramAttributes()
          Constructs a new, empty GramAttributes object.
GramAttributes(RslNode rslTree)
          Constructs a new GramAttributes object initialized with the specified RSL parse tree.
GramAttributes(String rsl)
          Constructs a new GramAttributes object initialized with the specified RSL string.
 
Method Summary
 void addArgument(String argument)
          Adds a single argument.
 void addEnvVariable(String varName, String value)
          Adds an environment variable.
 boolean deleteArgument(String argument)
          Removes a specific argument from the argument list.
 boolean deleteEnvVariable(String varName)
          Removes a specific environment variable from the environment list.
 List getArguments()
          Returns a list of arguments.
 String getDirectory()
          Return directory path
 Map getEnvironment()
          Returns a variable/value pair list of environment variables.
 String getExecutable()
          Return executable name
 int getJobType()
          Returns type of the job.
 int getMaxCPUTime()
          Return the maximum cpu time limit set for the job
 int getMaxMemory()
          Return the maximum memory limit set for the job
 int getMaxWallTime()
          Return the maximum wall time limit set for the job
 int getMinMemory()
          Return the minimum memory limit set for the job
 int getNumProcs()
          Return the number of processors
 String getProject()
          Return the project name charged for this job
 String getQueue()
          Return the queue name used for this job
 String getStderr()
          Return the location used to redirect stderr on the submission machine
 String getStdin()
          Return the location used to redirect stdin on the submission machine
 String getStdout()
          Return the location used to redirect stdout on the submission machine
 boolean isDryRun()
          Checks if dryryn is enabled.
 void setDirectory(String directory)
          Specify the directory path the executable will be run in
 void setDryRun(boolean enable)
          Sets the dryrun parameter.
 void setExecutable(String executable)
          Specify the name of the executable to run
 void setJobType(int jobType)
          Sets a job type.
 void setMaxCPUTime(int maxcputime)
          Specify the maximum cpu time limit for this job
 void setMaxMemory(int maxmemory)
          Specify the maximum memory limit for this job
 void setMaxWallTime(int maxwalltime)
          Specify the maximum wall time limit for this job
 void setMinMemory(int minmemory)
          Specify the minimum memory limit for this job
 void setNumProcs(int numprocs)
          Specify the nuber of processors to be used by the current executable
 void setProject(String project)
          Specify the project to be charged for this job
 void setQueue(String queue)
          Specify the queue name to be used for this job
 void setStderr(String stderr)
          Specify the location to redirect stderr on the submission machine
 void setStdin(String stdin)
          Specify the location to redirect stdin on the submission machine
 void setStdout(String stdout)
          Specify the location to redirect stdout on the submission machine
 
Methods inherited from class org.globus.rsl.RslAttributes
add, addMulti, addVariable, get, getFirstValue, getMap, getMulti, getRelation, getRslNode, getSingle, getVariables, remove, remove, removeMap, removeVariable, set, setMulti, toRSL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JOBTYPE_SINGLE

public static final int JOBTYPE_SINGLE
See Also:
Constant Field Values

JOBTYPE_MULTIPLE

public static final int JOBTYPE_MULTIPLE
See Also:
Constant Field Values

JOBTYPE_MPI

public static final int JOBTYPE_MPI
See Also:
Constant Field Values

JOBTYPE_CONDOR

public static final int JOBTYPE_CONDOR
See Also:
Constant Field Values
Constructor Detail

GramAttributes

public GramAttributes()
Constructs a new, empty GramAttributes object.


GramAttributes

public GramAttributes(String rsl)
               throws ParseException
Constructs a new GramAttributes object initialized with the specified RSL string.

Parameters:
rsl - the rsl string to initialize the class with.
Throws:
ParseException - if the rsl cannot be parsed.

GramAttributes

public GramAttributes(RslNode rslTree)
Constructs a new GramAttributes object initialized with the specified RSL parse tree.

Parameters:
rslTree - the rsl parse tree to initialize the class with.
Method Detail

setExecutable

public void setExecutable(String executable)
Specify the name of the executable to run

Parameters:
executable - the name of the executable

getExecutable

public String getExecutable()
Return executable name

Returns:
executable

setDirectory

public void setDirectory(String directory)
Specify the directory path the executable will be run in

Parameters:
directory - the directory path on the submission machine

getDirectory

public String getDirectory()
Return directory path

Returns:
directory

setStdout

public void setStdout(String stdout)
Specify the location to redirect stdout on the submission machine

Parameters:
stdout - the location to redirect stdout on the submission machine

getStdout

public String getStdout()
Return the location used to redirect stdout on the submission machine

Returns:
stdout

setStderr

public void setStderr(String stderr)
Specify the location to redirect stderr on the submission machine

Parameters:
stderr - the location to redirect stderr on the submission machine

getStderr

public String getStderr()
Return the location used to redirect stderr on the submission machine

Returns:
stderr

setStdin

public void setStdin(String stdin)
Specify the location to redirect stdin on the submission machine

Parameters:
stdin - the location to redirect stdin on the submission machine

getStdin

public String getStdin()
Return the location used to redirect stdin on the submission machine

Returns:
stdin

setDryRun

public void setDryRun(boolean enable)
Sets the dryrun parameter.

Parameters:
enable - true to enable dryrun, false otherwise.

isDryRun

public boolean isDryRun()
Checks if dryryn is enabled.

Returns:
true only if dryrun is enabled. False, otherwise.

setQueue

public void setQueue(String queue)
Specify the queue name to be used for this job

Parameters:
queue - the queue name to be used for this job

getQueue

public String getQueue()
Return the queue name used for this job

Returns:
queue

setProject

public void setProject(String project)
Specify the project to be charged for this job

Parameters:
project - the project to be charged for this job

getProject

public String getProject()
Return the project name charged for this job

Returns:
project

setJobType

public void setJobType(int jobType)
Sets a job type.

Parameters:
jobType - type of the job: One of the following: SINGLE, MULTIPLE, MPI, or CONDOR.

getJobType

public int getJobType()
Returns type of the job.

Returns:
job type. -1 if not set or job type is unknown.

setMinMemory

public void setMinMemory(int minmemory)
Specify the minimum memory limit for this job

Parameters:
minmemory - the minimum memory limit for this job

getMinMemory

public int getMinMemory()
Return the minimum memory limit set for the job

Returns:
minmemory

setNumProcs

public void setNumProcs(int numprocs)
Specify the nuber of processors to be used by the current executable

Parameters:
numprocs - the number of processors to use

getNumProcs

public int getNumProcs()
Return the number of processors

Returns:
numprocs

setMaxWallTime

public void setMaxWallTime(int maxwalltime)
Specify the maximum wall time limit for this job

Parameters:
maxwalltime - the maximum wall time limit for this job

getMaxWallTime

public int getMaxWallTime()
Return the maximum wall time limit set for the job

Returns:
maxwalltime

setMaxCPUTime

public void setMaxCPUTime(int maxcputime)
Specify the maximum cpu time limit for this job

Parameters:
maxcputime - the maximum cpu time limit for this job

getMaxCPUTime

public int getMaxCPUTime()
Return the maximum cpu time limit set for the job

Returns:
maxcputime

setMaxMemory

public void setMaxMemory(int maxmemory)
Specify the maximum memory limit for this job

Parameters:
maxmemory - the maximum memory limit for this job

getMaxMemory

public int getMaxMemory()
Return the maximum memory limit set for the job

Returns:
maxmemory

addArgument

public void addArgument(String argument)
Adds a single argument.

Parameters:
argument - an argument to add. It will be treated as a single argument.

deleteArgument

public boolean deleteArgument(String argument)
Removes a specific argument from the argument list.

Parameters:
argument - argument to remove.
Returns:
true if the argument was removed, false otherwise.

getArguments

public List getArguments()
Returns a list of arguments.

Returns:
list of arguments.

addEnvVariable

public void addEnvVariable(String varName,
                           String value)
Adds an environment variable.

Parameters:
varName - the variable name.
value - the value of the variable.

deleteEnvVariable

public boolean deleteEnvVariable(String varName)
Removes a specific environment variable from the environment list.

Parameters:
varName - name of the variable to remove.
Returns:
true if the environment variables was removed, false otherwise.

getEnvironment

public Map getEnvironment()
Returns a variable/value pair list of environment variables.

Returns:
the association list of environment variables.