Class JobDescription

  • Direct Known Subclasses:
    JavaJobDescription

    public class JobDescription
    extends java.lang.Object
    JobDescription contains a description of a job that can be submitted to a Scheduler.
    Since:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_START_TIME
      The default start time
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addArgument​(java.lang.String argument)
      Add a command line argument for the executable.
      void addEnvironment​(java.lang.String key, java.lang.String value)
      Add a variable to the environment of the executable.
      void addSchedulerArgument​(java.lang.String argument)
      Add a scheduler specific argument.
      boolean equals​(java.lang.Object obj)  
      java.util.List<java.lang.String> getArguments()
      Get the command line arguments of the executable.
      int getCoresPerTask()
      Get the number of cores needed for each task.
      java.util.Map<java.lang.String,​java.lang.String> getEnvironment()
      Get the environment of the executable.
      java.lang.String getExecutable()
      Get the path to the executable.
      int getMaxMemory()
      Get the amount of memory needed for process (in MBytes).
      int getMaxRuntime()
      Get the maximum job duration time in minutes.
      java.lang.String getName()
      Get the job name.
      java.lang.String getQueueName()
      Get the queue name;
      java.util.List<java.lang.String> getSchedulerArguments()
      Get the scheduler specific arguments.
      java.lang.String getStartTime()
      Get the start time of the job.
      java.lang.String getStderr()
      Gets the path to the file to which the executable must redirect stderr.
      java.lang.String getStdin()
      Gets the path to the file from which the executable must redirect stdin.
      java.lang.String getStdout()
      Gets the path to the file to which the executable must redirect stdout.
      int getTasks()
      Get the number of tasks in this job.
      int getTasksPerNode()
      Get the number of tasks per node.
      int getTempSpace()
      Get the amount of temp space needed for process (in MBytes).
      java.lang.String getWorkingDirectory()
      Gets the path of the working directory for the executable.
      int hashCode()  
      boolean isStartPerJob()
      Will the executable be started per job? true by default.
      boolean isStartPerTask()
      Will the executable be started per task? false by default.
      void setArguments​(java.lang.String... arguments)
      Sets the command line arguments of the executable.
      void setCoresPerTask​(int coresPerTask)
      Set the number of cores needed for each task.
      void setEnvironment​(java.util.Map<java.lang.String,​java.lang.String> environment)
      Sets the environment of the executable.
      void setExecutable​(java.lang.String executable)
      Sets the path to the executable.
      void setMaxMemory​(int maxMemoryInMB)
      Set the amount of memory needed for process (in MBytes).
      void setMaxRuntime​(int minutes)
      Set the maximum job duration in minutes.
      void setName​(java.lang.String name)
      Set the name of the job.
      void setQueueName​(java.lang.String queueName)
      Set the queue name;
      void setSchedulerArguments​(java.lang.String... arguments)
      Sets the scheduler specific arguments for this job.
      void setStartPerJob()
      Set if the executable must be started for once per job instead of for each task.
      void setStartPerTask()
      Set if the executable must be started for each task instead of once per job.
      void setStartTime​(java.lang.String startTime)
      Set the start time of the job.
      void setStderr​(java.lang.String stderr)
      Sets the path to the file to which the executable must redirect stderr.
      void setStdin​(java.lang.String stdin)
      Sets the path to the file from which the executable must redirect stdin.
      void setStdout​(java.lang.String stdout)
      Sets the path to the file to which the executable must redirect stdout.
      void setTasks​(int tasks)
      Set the number of tasks in this job.
      void setTasksPerNode​(int tasksPerNode)
      Set the number of tasks allowed per node.
      void setTempSpace​(int tempSpaceInMB)
      Set the amount of memory needed for process (in MBytes).
      void setWorkingDirectory​(java.lang.String workingDirectory)
      Sets the path of the working directory for the executable.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DEFAULT_START_TIME

        public static final java.lang.String DEFAULT_START_TIME
        The default start time
        See Also:
        Constant Field Values
    • Constructor Detail

      • JobDescription

        public JobDescription()
        Create a JobDescription.
      • JobDescription

        public JobDescription​(JobDescription original)
        Create a JobDescription by copying an existing one.
        Parameters:
        original - JobDescription to copy
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the job name.
        Returns:
        the job name.
      • setName

        public void setName​(java.lang.String name)
        Set the name of the job.
        Parameters:
        name - the name of the job;
      • getTasks

        public int getTasks()
        Get the number of tasks in this job.
        Returns:
        the number of tasks.
      • setTasks

        public void setTasks​(int tasks)
        Set the number of tasks in this job.
        Parameters:
        tasks - the number of tasks;
      • getCoresPerTask

        public int getCoresPerTask()
        Get the number of cores needed for each task.
        Returns:
        the number of cores needed for each task.
      • setCoresPerTask

        public void setCoresPerTask​(int coresPerTask)
        Set the number of cores needed for each task.
        Parameters:
        coresPerTask - the number of cores needed for each task.
      • getTasksPerNode

        public int getTasksPerNode()
        Get the number of tasks per node.
        Returns:
        the number of tasks per node.
      • setTasksPerNode

        public void setTasksPerNode​(int tasksPerNode)
        Set the number of tasks allowed per node.
        Parameters:
        tasksPerNode - the number of tasks allowed per node.
      • getMaxMemory

        public int getMaxMemory()
        Get the amount of memory needed for process (in MBytes).
        Returns:
        the amount of memory needed.
      • setMaxMemory

        public void setMaxMemory​(int maxMemoryInMB)
        Set the amount of memory needed for process (in MBytes).
        Parameters:
        maxMemoryInMB - the amount of memory needed per node/process.
      • getTempSpace

        public int getTempSpace()
        Get the amount of temp space needed for process (in MBytes).
        Returns:
        the amount of temp space needed.
      • setTempSpace

        public void setTempSpace​(int tempSpaceInMB)
        Set the amount of memory needed for process (in MBytes).
        Parameters:
        tempSpaceInMB - the amount of temp space needed per node/process.
      • isStartPerTask

        public boolean isStartPerTask()
        Will the executable be started per task? false by default.
        Returns:
        if the executable is started per task.
      • isStartPerJob

        public boolean isStartPerJob()
        Will the executable be started per job? true by default.
        Returns:
        if the executable is started per job.
      • setStartPerTask

        public void setStartPerTask()
        Set if the executable must be started for each task instead of once per job.
      • setStartPerJob

        public void setStartPerJob()
        Set if the executable must be started for once per job instead of for each task.
      • getQueueName

        public java.lang.String getQueueName()
        Get the queue name;
        Returns:
        the queue name;
      • setQueueName

        public void setQueueName​(java.lang.String queueName)
        Set the queue name;
        Parameters:
        queueName - the queue name;
      • getMaxRuntime

        public int getMaxRuntime()
        Get the maximum job duration time in minutes.
        Returns:
        the maximum job duration.
      • setMaxRuntime

        public void setMaxRuntime​(int minutes)
        Set the maximum job duration in minutes.
        Parameters:
        minutes - the maximum job duration in minutes.
      • getStartTime

        public java.lang.String getStartTime()
        Get the start time of the job.
        Returns:
        the start time of the job.
      • setStartTime

        public void setStartTime​(java.lang.String startTime)
        Set the start time of the job. Currently supported values are "now", or an explicit time and optional date in the format "HH:mm[ dd.MM[.YYYY]]"
        Parameters:
        startTime - the start time of the job.
      • getExecutable

        public java.lang.String getExecutable()
        Get the path to the executable.
        Returns:
        the path to the executable.
      • setExecutable

        public void setExecutable​(java.lang.String executable)
        Sets the path to the executable.
        Parameters:
        executable - the path to the executable.
      • getArguments

        public java.util.List<java.lang.String> getArguments()
        Get the command line arguments of the executable.
        Returns:
        Returns the arguments of the executable.
      • setArguments

        public void setArguments​(java.lang.String... arguments)
        Sets the command line arguments of the executable.
        Parameters:
        arguments - the command line arguments of the executable.
      • addArgument

        public void addArgument​(java.lang.String argument)
        Add a command line argument for the executable. The argument may not be null or empty.
        Parameters:
        argument - the command line argument to add.
      • getSchedulerArguments

        public java.util.List<java.lang.String> getSchedulerArguments()
        Get the scheduler specific arguments.
        Returns:
        Returns the scheduler specific arguments.
      • setSchedulerArguments

        public void setSchedulerArguments​(java.lang.String... arguments)
        Sets the scheduler specific arguments for this job. Some jobs require extra arguments to be provided to the scheduler, for example to select a certain type of node. These arguments tend to be very scheduler and location specific and are therefore hard to generalize. This method provides a simple mechanism to add such arguments to a JobDescription. These arguments are typically copied into the scheduler specific section of a generated submit script.
        Parameters:
        arguments - the scheduler specific arguments.
      • addSchedulerArgument

        public void addSchedulerArgument​(java.lang.String argument)
        Add a scheduler specific argument. The argument may not be null or empty.
        Parameters:
        argument - the scheduler specific argument.
      • getEnvironment

        public java.util.Map<java.lang.String,​java.lang.String> getEnvironment()
        Get the environment of the executable. The environment of the executable consists of a Map of environment variables with their values (for example: "JAVA_HOME", "/path/to/java").
        Returns:
        the environment of the executable.
      • setEnvironment

        public void setEnvironment​(java.util.Map<java.lang.String,​java.lang.String> environment)
        Sets the environment of the executable. The environment of the executable consists of a Map of environment variables with their values (for example: "JAVA_HOME", "/path/to/java").
        Parameters:
        environment - environment of the executable.
      • addEnvironment

        public void addEnvironment​(java.lang.String key,
                                   java.lang.String value)
        Add a variable to the environment of the executable. The environment of the executable consists of a Map of environment variables with their values (for example: "JAVA_HOME", "/path/to/java"). The key of an environment variable may not be null or empty.
        Parameters:
        key - the unique key under which to store the value.
        value - the value to store the value.
      • setStdin

        public void setStdin​(java.lang.String stdin)
        Sets the path to the file from which the executable must redirect stdin.
        Parameters:
        stdin - the path.
      • setStdout

        public void setStdout​(java.lang.String stdout)
        Sets the path to the file to which the executable must redirect stdout.
        Parameters:
        stdout - the path.
      • setStderr

        public void setStderr​(java.lang.String stderr)
        Sets the path to the file to which the executable must redirect stderr.
        Parameters:
        stderr - the path.
      • setWorkingDirectory

        public void setWorkingDirectory​(java.lang.String workingDirectory)
        Sets the path of the working directory for the executable.
        Parameters:
        workingDirectory - path of the working directory.
      • getStdin

        public java.lang.String getStdin()
        Gets the path to the file from which the executable must redirect stdin.
        Returns:
        the path.
      • getStdout

        public java.lang.String getStdout()
        Gets the path to the file to which the executable must redirect stdout.
        Returns:
        the path.
      • getStderr

        public java.lang.String getStderr()
        Gets the path to the file to which the executable must redirect stderr.
        Returns:
        the path.
      • getWorkingDirectory

        public java.lang.String getWorkingDirectory()
        Gets the path of the working directory for the executable.
        Returns:
        workingDirectory path of the working directory.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object