Class 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".
    • Constructor Summary

      Constructors 
      Constructor Description
      GramAttributes()
      Constructs a new, empty GramAttributes object.
      GramAttributes​(java.lang.String rsl)
      Constructs a new GramAttributes object initialized with the specified RSL string.
      GramAttributes​(RslNode rslTree)
      Constructs a new GramAttributes object initialized with the specified RSL parse tree.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addArgument​(java.lang.String argument)
      Adds a single argument.
      void addEnvVariable​(java.lang.String varName, java.lang.String value)
      Adds an environment variable.
      boolean deleteArgument​(java.lang.String argument)
      Removes a specific argument from the argument list.
      boolean deleteEnvVariable​(java.lang.String varName)
      Removes a specific environment variable from the environment list.
      java.util.List getArguments()
      Returns a list of arguments.
      java.lang.String getDirectory()
      Return directory path
      java.util.Map getEnvironment()
      Returns a variable/value pair list of environment variables.
      java.lang.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
      java.lang.String getProject()
      Return the project name charged for this job
      java.lang.String getQueue()
      Return the queue name used for this job
      java.lang.String getStderr()
      Return the location used to redirect stderr on the submission machine
      java.lang.String getStdin()
      Return the location used to redirect stdin on the submission machine
      java.lang.String getStdout()
      Return the location used to redirect stdout on the submission machine
      boolean isDryRun()
      Checks if dryryn is enabled.
      void setDirectory​(java.lang.String directory)
      Specify the directory path the executable will be run in
      void setDryRun​(boolean enable)
      Sets the dryrun parameter.
      void setExecutable​(java.lang.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​(java.lang.String project)
      Specify the project to be charged for this job
      void setQueue​(java.lang.String queue)
      Specify the queue name to be used for this job
      void setStderr​(java.lang.String stderr)
      Specify the location to redirect stderr on the submission machine
      void setStdin​(java.lang.String stdin)
      Specify the location to redirect stdin on the submission machine
      void setStdout​(java.lang.String stdout)
      Specify the location to redirect stdout on the submission machine
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GramAttributes

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

        public GramAttributes​(java.lang.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​(java.lang.String executable)
        Specify the name of the executable to run
        Parameters:
        executable - the name of the executable
      • getExecutable

        public java.lang.String getExecutable()
        Return executable name
        Returns:
        executable
      • setDirectory

        public void setDirectory​(java.lang.String directory)
        Specify the directory path the executable will be run in
        Parameters:
        directory - the directory path on the submission machine
      • getDirectory

        public java.lang.String getDirectory()
        Return directory path
        Returns:
        directory
      • setStdout

        public void setStdout​(java.lang.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 java.lang.String getStdout()
        Return the location used to redirect stdout on the submission machine
        Returns:
        stdout
      • setStderr

        public void setStderr​(java.lang.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 java.lang.String getStderr()
        Return the location used to redirect stderr on the submission machine
        Returns:
        stderr
      • setStdin

        public void setStdin​(java.lang.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 java.lang.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​(java.lang.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 java.lang.String getQueue()
        Return the queue name used for this job
        Returns:
        queue
      • setProject

        public void setProject​(java.lang.String project)
        Specify the project to be charged for this job
        Parameters:
        project - the project to be charged for this job
      • getProject

        public java.lang.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​(java.lang.String argument)
        Adds a single argument.
        Parameters:
        argument - an argument to add. It will be treated as a single argument.
      • deleteArgument

        public boolean deleteArgument​(java.lang.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 java.util.List getArguments()
        Returns a list of arguments.
        Returns:
        list of arguments.
      • addEnvVariable

        public void addEnvVariable​(java.lang.String varName,
                                   java.lang.String value)
        Adds an environment variable.
        Parameters:
        varName - the variable name.
        value - the value of the variable.
      • deleteEnvVariable

        public boolean deleteEnvVariable​(java.lang.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 java.util.Map getEnvironment()
        Returns a variable/value pair list of environment variables.
        Returns:
        the association list of environment variables.