Class ClusterConfig


public class ClusterConfig extends AbstractLockable<ClusterConfig>
Configuration settings related to the cluster. The information becomes readonly when a OpenGridCluster instance has been created.
Since:
1.0
Author:
nicklas
  • Field Details

    • DATE_CMD

      public static final DateFormatter DATE_CMD
      Convert date string from the date command into Date objects. Example: 2014-03-21 08:59:09
    • type

      private final ClusterType type
    • jobFolder

      private String jobFolder
    • tmpFolder

      private String tmpFolder
    • tmpFolderDebug

      private String tmpFolderDebug
    • dateCommand

      private String dateCommand
    • hostInfoCommand

      private String hostInfoCommand
    • ogsInfoCommand

      private String ogsInfoCommand
    • jobAgentExternalId

      private String jobAgentExternalId
    • nodes

      private final List<NodeConfig> nodes
    • customOptions

      private final Map<String,String> customOptions
  • Constructor Details

  • Method Details

    • getType

      public ClusterType getType()
    • getJobFolder

      public String getJobFolder()
      Get the path to the primary job folder on the Open Grid cluster.
    • setJobFolder

      public void setJobFolder(String jobFolder)
      Set the path to the primary job folder on the cluster.
      Throws:
      IllegalStateException - If this instance has been locked
    • getTmpFolder

      public String getTmpFolder(boolean debug)
      Get the path to a temporary folder that a job can use for storing temporary data. Typically, the data in this folder will be deleted after the job has been completed. The help with debugging a second temporary folder can be set to a location that is not deleted afterwards. If no debug temporary folder has been specified the regular temporary folder is returned.
    • setTmpFolder

      public void setTmpFolder(String tmpFolder, boolean debug)
      Set the path to the temporary job folder on the cluster. It is possible to set one regular temporary folder and one debug temporary folder.
      Throws:
      IllegalStateException - If this instance has been locked
    • getDateCommand

      public String getDateCommand()
      Get the command to execute for getting the current date and time from the cluster. The default command is: date +'%Y-%m-%d %T'
    • setDateCommand

      public void setDateCommand(String dateCommand)
      Set the command that should be executed to get the current date and time from the cluster. It should return the date in format YYYY-MM-DD HH:MM:SS
      Throws:
      IllegalStateException - If this instance has been locked
    • getHostInfoCommand

      public String getHostInfoCommand()
      Get the command to execute for getting some information about the hardware and operating system of the host. The default command is: uname -srmo
    • setHostInfoCommand

      public void setHostInfoCommand(String hostInfoCommand)
      Set the command that should be executed to get some information about the hardware and operating system of the host.
      Throws:
      IllegalStateException - If this instance has been locked
    • getOpenGridInfoCommand

      public String getOpenGridInfoCommand()
      Get the command to execute for getting some information about the cluster manager software version. The default command is: qstat -help | head -n1 (OpenGrid) or: sinfo -V (Slurm)
    • setOpenGridInfoCommand

      public void setOpenGridInfoCommand(String ogsInfoCommand)
      Set the command that should be executed to get some information about the cluster manager software version.
      Throws:
      IllegalStateException - If this instance has been locked
    • getJobAgentExternalId

      public String getJobAgentExternalId()
      Get the External ID of the job agent this cluster should be linked to. If null, this cluster is not linked with any job agent and may be used by all.
    • setJobAgentExternalId

      public void setJobAgentExternalId(String jobAgentExternalId)
      Set the External ID of the job agent this cluster should be linked to. Job agents are used as placeholders for setting up access control to Open Grid clusters.
      Throws:
      IllegalStateException - If this instance has been locked
    • addNode

      public void addNode(NodeConfig node)
      Add the name of a node in the cluster. The node list of nodes may be used for special actions.
    • getNodes

      public List<NodeConfig> getNodes()
      Get all configured nodes.
    • setCustomOption

      public void setCustomOption(String key, String value)
      Set a custom option for the cluster.
      Since:
      1.7
    • getCustomOption

      public String getCustomOption(String key)
      Get a custom option for the cluster.
      Since:
      1.7
    • getCustomOptions

      public Map<String,String> getCustomOptions()
      Get all custom option for the cluster. The returned map is locked for modifications.
      Since:
      1.7
    • checkValid

      protected void checkValid(boolean forLock)
      Job folder and date command are required.
      Overrides:
      checkValid in class AbstractLockable<ClusterConfig>
      Parameters:
      forLock - If TRUE, the instance will be locked after validation
    • asJSONObject

      public org.json.simple.JSONObject asJSONObject(JSONOptions options)
      Get the configuration information as a JSON object. The following information is returned by default: - type - jobAgent.externalId * - jobFolder - tmpFolder - tmpFolderDebug - dateCommand - hostInfoCommand - ogsInfoCommand If the JSONOption.NODE_INFO is enabled: - nodes: array with node names If the JSONOption.CUSTOM_OPTIONS is enabled: - options: object with all custom options (*) The 'jobAgent' is a sub-object that is only included if the job agent external id has been set. If JSONOption.JOBAGENT_INFO is enabled additional information is loaded from the database: - jobAgent.id - jobAgent.name - jobAgent.isShared - jobAgent.exception (only if there is some problem loading the information)