Package net.sf.basedb.opengrid.config
Class ClusterConfig
java.lang.Object
net.sf.basedb.opengrid.config.AbstractLockable<ClusterConfig>
net.sf.basedb.opengrid.config.ClusterConfig
Configuration settings related to the cluster.
The information becomes readonly when a
OpenGridCluster
instance has been created.- Since:
- 1.0
- Author:
- nicklas
-
Field Summary
Modifier and TypeFieldDescriptionstatic final DateFormatter
Convert date string from the date command into Date objects.private String
private String
private String
private String
private final List<NodeConfig>
private String
private String
private String
private final ClusterType
-
Constructor Summary
ConstructorDescriptionDeprecated.ClusterConfig
(ClusterType type) Create new cluster configuration for the given cluster type. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNode
(NodeConfig node) Add the name of a node in the cluster.org.json.simple.JSONObject
asJSONObject
(JSONOptions options) Get the configuration information as a JSON object.protected void
checkValid
(boolean forLock) Job folder and date command are required.getCustomOption
(String key) Get a custom option for the cluster.Get all custom option for the cluster.Get the command to execute for getting the current date and time from the cluster.Get the command to execute for getting some information about the hardware and operating system of the host.Get the External ID of the job agent this cluster should be linked to.Get the path to the primary job folder on the Open Grid cluster.getNodes()
Get all configured nodes.Get the command to execute for getting some information about the cluster manager software version.getTmpFolder
(boolean debug) Get the path to a temporary folder that a job can use for storing temporary data.getType()
void
setCustomOption
(String key, String value) Set a custom option for the cluster.void
setDateCommand
(String dateCommand) Set the command that should be executed to get the current date and time from the cluster.void
setHostInfoCommand
(String hostInfoCommand) Set the command that should be executed to get some information about the hardware and operating system of the host.void
setJobAgentExternalId
(String jobAgentExternalId) Set the External ID of the job agent this cluster should be linked to.void
setJobFolder
(String jobFolder) Set the path to the primary job folder on the cluster.void
setOpenGridInfoCommand
(String ogsInfoCommand) Set the command that should be executed to get some information about the cluster manager software version.void
setTmpFolder
(String tmpFolder, boolean debug) Set the path to the temporary job folder on the cluster.Methods inherited from class net.sf.basedb.opengrid.config.AbstractLockable
checkLocked, isLocked, isValid, lock
-
Field Details
-
DATE_CMD
Convert date string from the date command into Date objects. Example: 2014-03-21 08:59:09 -
type
-
jobFolder
-
tmpFolder
-
tmpFolderDebug
-
dateCommand
-
hostInfoCommand
-
ogsInfoCommand
-
jobAgentExternalId
-
nodes
-
customOptions
-
-
Constructor Details
-
ClusterConfig
Deprecated.In 1.4, useClusterConfig(net.sf.basedb.opengrid.config.ClusterType)
insteadCreate a new Open Grid cluster configuration. -
ClusterConfig
Create new cluster configuration for the given cluster type. The configuration is initialized withClusterEngine.setDefaultConfig(ClusterConfig)
- Parameters:
type
-
-
-
Method Details
-
getType
-
getJobFolder
Get the path to the primary job folder on the Open Grid cluster. -
setJobFolder
Set the path to the primary job folder on the cluster.- Throws:
IllegalStateException
- If this instance has been locked
-
getTmpFolder
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
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
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
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
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
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
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
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
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
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
Add the name of a node in the cluster. The node list of nodes may be used for special actions. -
getNodes
Get all configured nodes. -
setCustomOption
Set a custom option for the cluster.- Since:
- 1.7
-
getCustomOption
Get a custom option for the cluster.- Since:
- 1.7
-
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 classAbstractLockable<ClusterConfig>
- Parameters:
forLock
- If TRUE, the instance will be locked after validation
-
asJSONObject
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 theJSONOption.NODE_INFO
is enabled: - nodes: array with node names If theJSONOption.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. IfJSONOption.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)
-
ClusterConfig(net.sf.basedb.opengrid.config.ClusterType)
instead