An instance of this class represents all the parameters specified in the Cluster section of mascot.dat
.
More...
#include <ms_clusterparams.hpp>
Public Types | |
enum | { NUM_PROCESSORS_AUTO_DETECT = -1 } |
Value used to indicate that the number of processors in the first SubClusterSet should be automatically determined at runtime. More... | |
Public Member Functions | |
ms_clusterparams () | |
Default constructor. | |
ms_clusterparams (const ms_clusterparams &src) | |
Copying constructor. | |
~ms_clusterparams () | |
Destructor. | |
void | appendProperty (const char *name, const char *value, const char *delimiter, const bool bFirstPlace=false) |
Adds a new property with the given parameters. | |
void | appendSubCluster (const int id, const int maxCPUs) |
Add a new SubClusterSet entry. | |
void | appendText (const char *line, const bool bFirstPlace=false) |
Adds a new non-parsed property. | |
void | clearSubClusters () |
Erases information about all sub clusters. | |
void | copyFrom (const ms_clusterparams *right) |
Can be used to create a copy of another object. | |
void | copyFrom (const ms_customproperty *src) |
Copies all properties and comments from another instance. | |
void | defaultValues () |
Initialises the instance with default values. | |
void | delNonEmpty () |
Deletes all non-comment properties. | |
void | delProp (const char *name) |
Deletes all properties with the specified name. | |
void | delPropByNumber (const int index) |
Deletes a single property with the specified number only. | |
void | delPropStart (const char *nameBeginning) |
Deletes all properties whose names start with the given string. | |
int | findProperty (const char *name, const int startFrom=0) const |
Searches the list for a property with the given name. | |
int | findPropertyBeginning (const char *nameBeginning, const int startFrom=0) const |
Searches the list for a property with the partially matching name. | |
int | getCheckNodesAliveFreq () const |
Returns the value of CheckNodesAliveFreq. | |
std::string | getDefaultDelimiter () const |
Return current default delimiter string used for parsing/storing properties. | |
std::string | getDefaultNodeHomeDir () const |
Returns the value of DefaultNodeHomeDir. | |
std::string | getDefaultNodeHomeDirFromMaster () const |
Returns the value of DefaultNodeHomeDirFromMaster. | |
OPERATING_SYS | getDefaultNodeOS () const |
Returns value of DefaultNodeOS as one of the enumeration members. | |
int | getDefaultPort () const |
Returns the value of DefaultPort. | |
std::string | getDelimiterByNumber (const int index) const |
Returns a specific delimiter used for the property. | |
std::string | getIPCLogfile () const |
Returns the value of IPCLogfile. | |
int | getIPCLogging () const |
Returns value of IPCLogging. | |
int | getIPCTimeout () const |
Returns the value of IPCTimeout. | |
std::string | getMascotNodeRebootScript () const |
Returns the value of MascotNodeRebootScript. | |
std::string | getMascotNodeScript () const |
Returns the value of MascotNodeScript. | |
const ms_computeraddress * | getMasterComputer () const |
Returns an instance of ms_computeraddress created for MasterComputerName. | |
std::string | getNodeSequenceDatabaseDir () const |
Returns the value of NodeSequenceDatabaseDir. | |
int | getNumberOfProperties () const |
Returns a total number of property/comment entries. | |
int | getNumberOfSubClusters () const |
Returns the number of SubClusterSet parameter entries, which is a total number of sub-clusters. | |
std::string | getPreceedingComments () const |
Returns any comments preceeding the section. | |
std::string | getPropertyName (const int index) const |
Returns a property name for a given index. | |
std::string | getPropValStringByName (const char *name) const |
Retrieves property value by name. | |
std::string | getPropValStringByNumber (const int index) const |
Retrieves property raw text values by number. | |
int | getSecsToWaitForNodeAtStartup () const |
Returns the value of SecsToWaitForNodeAtStartup. | |
int | getSubClusterID (const int index) const |
Returns sub-cluster ID by its index. | |
int | getSubClusterMaxCPU (const int index) const |
Returns the Y part of SubClusterSet. | |
bool | isEnabled () const |
Returns TRUE if Enabled parameter is set to 1 and FALSE otherwise. | |
bool | isSectionAvailable () const |
Check whether the section has been actually read from the file. | |
ms_clusterparams & | operator= (const ms_clusterparams &right) |
Assignment operator for C++ client applications. | |
void | setCheckNodesAliveFreq (const int value) |
Change CheckNodesAliveFreq. | |
void | setDefaultDelimiter (const char *delim) |
Allows to set a specific delimiter string to be used when no property-specific delimiter is supplied. | |
void | setDefaultNodeHomeDir (const char *str) |
Change DefaultNodeHomeDir. | |
void | setDefaultNodeHomeDirFromMaster (const char *str) |
Change DefaultNodeHomeDirFromMaster. | |
void | setDefaultNodeOS (const OPERATING_SYS value) |
Change DefaultNodeOS. | |
void | setDefaultPort (const int value) |
Change DefaultPort. | |
void | setEnabled (const bool flag) |
Change Enabled. | |
void | setIPCLogfile (const char *str) |
Change IPCLogfile. | |
void | setIPCLogging (const int value) |
Change IPCLogging. | |
void | setIPCTimeout (const int value) |
Change IPCTimeout. | |
void | setMascotNodeRebootScript (const char *str) |
Change MascotNodeRebootScript. | |
void | setMascotNodeScript (const char *str) |
Change MascotNodeScript. | |
void | setMasterComputer (const ms_computeraddress *value) |
Change MasterComputerName. | |
void | setNodeSequenceDatabaseDir (const char *str) |
Change NodeSequenceDatabaseDir. | |
void | setPreceedingComments (const std::string &comments) |
Sets any comments preceeding the section. | |
void | setPropertyName (const int index, const char *name) |
Changes name of the property with the given index. | |
void | setPropValBoolByName (const char *name, const bool value, const bool bFirstPlace=false) |
Changes a boolean value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValCharByName (const char *name, const char value, const bool bFirstPlace=false) |
Changes a single character value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValFloatByName (const char *name, const double value, const bool bFirstPlace=false) |
Changes an floating point value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValInt64ByName (const char *name, const INT64 value, const bool bFirstPlace=false) |
Changes a long 64-bit integer value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValIntByName (const char *name, const int value, const bool bFirstPlace=false) |
Changes an integer value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValStringByName (const char *name, const char *value, const bool bFirstPlace=false) |
Changes a string value of the first entry with the given name or creates a new property if it is not found. | |
void | setPropValStringByNumber (const int index, const char *value) |
Changes an string value of an existing property with the given index. | |
void | setSecsToWaitForNodeAtStartup (const int value) |
Change SecsToWaitForNodeAtStartup. | |
void | setSectionAvailable (const bool value) |
Change availability of the section, i.e. if it should be saved in a file. | |
bool | uncommentProp (const int index, const char *delimeter=0) |
Uncomments a line in the configuration file. | |
An instance of this class represents all the parameters specified in the Cluster section of mascot.dat
.
An instance of this class is created and polulated in ms_datfile. It can also be created separately and initialized with default values. One can create an instance of the class or copy from another instance in order to pass it then as an parameters-containing object. For detailed information on any of the options please consult Mascot manual.
Also get yourselves acquainted with the base class ms_customproperty. It facilitates the following tasks:
More functionality is described in the documentation for ms_customproperty.
anonymous enum |
Value used to indicate that the number of processors in the first SubClusterSet should be automatically determined at runtime.
The value assigned will be identical to the number of 'processors' licensed.
(Defined as an enum rather than static const int to support VC6)
Enumerator | |
---|---|
NUM_PROCESSORS_AUTO_DETECT | Value used to indicate that the number of processors in the first SubClusterSet should be automatically determined at runtime. |
|
inherited |
Adds a new property with the given parameters.
name | a property name to use. |
value | a property value to use. |
delimiter | a specific delimiter or an empty string for a default one to be used. |
bFirstPlace | forces a new property to be put on top of the list. |
void appendSubCluster | ( | const int | id, |
const int | maxCPUs | ||
) |
Add a new SubClusterSet entry.
See getNumberOfSubClusters() for more information.
id | unique ID identifying a sub-cluster (from 0 to 49) to set number of CPUs for. |
maxCPUs | maximum number of CPUs for the specified sub-cluster (from 0 to 1024*64). |
|
inherited |
Adds a new non-parsed property.
All property elements will be retrieved from the first parameter. Before calling this method, a specific default delimiter can be set using setDefaultDelimiter().
l | raw text representation of the property to be parsed. |
bFirstPlace | forces a new property to be put on top of the list. |
void clearSubClusters | ( | ) |
Erases information about all sub clusters.
One entry (0,0) for "this subcluster" stays in the list forever.
|
inherited |
Deletes all properties with the specified name.
str | Property name to find a match and then delete. |
|
inherited |
Deletes all properties whose names start with the given string.
str | Beginning a first part of the property name to delete. |
|
inherited |
Searches the list for a property with the given name.
If no property found with the given name -1 will be returned. There may be several property entries in the list with the same name.
name | a property name to be found. |
startFrom | a minimal property index to start search from. |
|
inherited |
Searches the list for a property with the partially matching name.
If no property found with the given name part -1 will be returned. There may be several property entries in the list whose names start with the given string.
nameBeginning | first part of a property name to be found. |
startFrom | a minimal property index to start search from. |
int getCheckNodesAliveFreq | ( | ) | const |
Returns the value of CheckNodesAliveFreq.
The CheckNodesAliveFreq parameter specifies the interval in seconds between 'health checks' on the nodes. Default value is 30 sec.
|
inherited |
Return current default delimiter string used for parsing/storing properties.
std::string getDefaultNodeHomeDir | ( | ) | const |
Returns the value of DefaultNodeHomeDir.
If no specific home directory is specified for a particular node in nodelist.txt
, then the value of the DefaultNodeHomeDir parameter is used. To override this setting for a particular node, enter the directory on the node line in nodelist.txt
.
Default is the /MascotNode
folder.
std::string getDefaultNodeHomeDirFromMaster | ( | ) | const |
Returns the value of DefaultNodeHomeDirFromMaster.
This is the directory on the node as seen from the master. For a Windows cluster, this must be present and specified as a UNC name. For a Unix cluster, this parameter must be commented out.
Default is
\\<host_name>\c$\mascotnode
OPERATING_SYS getDefaultNodeOS | ( | ) | const |
Returns value of DefaultNodeOS as one of the enumeration members.
If no OS is defined for a particular node, then this parameter value is assumed as the OS. See OPERATING_SYS for a list of possible values.
Default is _OS_WINDOWS_NT (2).
int getDefaultPort | ( | ) | const |
Returns the value of DefaultPort.
If no port number is specified for a node in nodelist.txt
, then this port number will be used.
Default is 5001.
|
inherited |
Returns a specific delimiter used for the property.
index | Index for which to get a delimiter |
std::string getIPCLogfile | ( | ) | const |
Returns the value of IPCLogfile.
The IPCLogfile parameter specifies a relative path to the inter-process communication log file.
Default is ../logs/IPC.log
.
int getIPCLogging | ( | ) | const |
Returns value of IPCLogging.
IPCLogging specifies logging level for inter-process communications. It has the followings possible values:
Default is 0.
int getIPCTimeout | ( | ) | const |
Returns the value of IPCTimeout.
The IPCTimeout parameter is the timeout in seconds for inter-process communication.
Default is 10 seconds.
std::string getMascotNodeRebootScript | ( | ) | const |
Returns the value of MascotNodeRebootScript.
MascotNodeRebootScript is the name of an optional script to re-boot a cluster node. If this parameter is defined, then there will be a link at the bottom of each Mascot Cluster Node status page. When this link is clicked, ms-monitor
will run the defined script on the master. The host name of the specified node will be passed to the script as a parameter.
By default this is empty.
std::string getMascotNodeScript | ( | ) | const |
Returns the value of MascotNodeScript.
The MascotNodeScript parameter specifies a script name which is run for each node with different parameters described in Mascot manual.
By default this is empty.
const ms_computeraddress * getMasterComputer | ( | ) | const |
Returns an instance of ms_computeraddress created for MasterComputerName.
The MasterComputerName parameter contains a host name for the master computer and, optionally, the IP address separated by a comma. See ms_computeraddress for information about its parameters and default values.
std::string getNodeSequenceDatabaseDir | ( | ) | const |
Returns the value of NodeSequenceDatabaseDir.
Specify the sequence database directory to be used by to all cluster nodes. This can be a relative path to the node bin directory or an absolute path. Default is the ../sequence
sub folder.
|
inherited |
Returns a total number of property/comment entries.
int getNumberOfSubClusters | ( | ) | const |
Returns the number of SubClusterSet parameter entries, which is a total number of sub-clusters.
Large clusters can be divided into sub-clusters. There might be several SubClusterSet parameter entries on separate lines in the configuration file. Each parameter line has the following format:
SubClusterSet X Y
X
is a unique integer value (0-based) used to identify the sub-cluster (from 0 to 49 inclusively).
Y
is the maximum number of processors in the sub-cluster.
A single cluster must have a single entry with X
set to 0. If no such entries are present in the file, one subcluster is assumed - default entry (0,0). Therefore, default value returned by this function is 1.
Use getSubClusterID() and getSubClusterMaxCPU() to retrieve the entries.
|
inherited |
Returns any comments preceeding the section.
Sections in the mascot.dat file may have comments preceeding them. In most cases, these comments need to stay 'attached' to the section.
Multiple line comments are supported by having a single string with newline characters
|
inherited |
Returns a property name for a given index.
index | property number from 0 to (getNumberOfProperties()-1). |
|
inherited |
Retrieves property value by name.
Don't use this method for comments as they all have empty name. Also note that there might be several entries corresponding to the same name . – only the first value will be returned. If in doubt use findProperty() and getPropValStringByNumber() instead.
name | Name for which to get a property value |
|
inherited |
Retrieves property raw text values by number.
index | Index for which to get a property value |
int getSecsToWaitForNodeAtStartup | ( | ) | const |
Returns the value of SecsToWaitForNodeAtStartup.
The SecsToWaitForNodeAtStartup parameter specifies a timeout. At startup, if a node is not available within this time, the system will continue to startup without that node. If the value is set to 0, then the system will wait indefinitely.
This timeout is also used if a node fails while the system is running. The system will wait for this number of seconds before re-initialising ms-monitor.exe
. This means that a short-lived interruption in network communication doesn't create a major service interruption.
Default is 60 sec.
int getSubClusterID | ( | const int | index | ) | const |
Returns sub-cluster ID by its index.
index | a number between 0 and (getNumberOfSubClusters()-1). |
int getSubClusterMaxCPU | ( | const int | index | ) | const |
Returns the Y
part of SubClusterSet.
See getNumberOfSubClusters() for more detailed explanations.
index | a number in the list (from 0 to (getNumberOfSubClusters()-1)). |
bool isSectionAvailable | ( | ) | const |
Check whether the section has been actually read from the file.
By default the Options
section is unavailable until it has been set to a different state.
void setCheckNodesAliveFreq | ( | const int | value | ) |
Change CheckNodesAliveFreq.
See getCheckNodesAliveFreq() for more information.
value | Frequency to check if nodes are alive |
|
inherited |
Allows to set a specific delimiter string to be used when no property-specific delimiter is supplied.
delim | String to set the default delimiter |
void setDefaultNodeHomeDir | ( | const char * | str | ) |
Change DefaultNodeHomeDir.
See getDefaultNodeHomeDir() for more information.
str | default node home directory |
void setDefaultNodeHomeDirFromMaster | ( | const char * | str | ) |
Change DefaultNodeHomeDirFromMaster.
See getDefaultNodeHomeDirFromMaster() for more information.
str | default mode home directory from master |
void setDefaultNodeOS | ( | const OPERATING_SYS | value | ) |
void setDefaultPort | ( | const int | value | ) |
void setEnabled | ( | const bool | flag | ) |
void setIPCLogfile | ( | const char * | str | ) |
void setIPCLogging | ( | const int | value | ) |
void setIPCTimeout | ( | const int | value | ) |
void setMascotNodeRebootScript | ( | const char * | str | ) |
Change MascotNodeRebootScript.
See getMascotNodeRebootScript() for more information.
str | mascot mode reboot script |
void setMascotNodeScript | ( | const char * | str | ) |
Change MascotNodeScript.
See getMascotNodeScript() for more information.
str | Mascot node script |
void setMasterComputer | ( | const ms_computeraddress * | value | ) |
Change MasterComputerName.
See getMasterComputer() for more information.
value | Pointer to a valid ms_computeraddress object |
void setNodeSequenceDatabaseDir | ( | const char * | str | ) |
Change NodeSequenceDatabaseDir.
See getNodeSequenceDatabaseDir() for more information.
str | node sequence database directory |
|
inherited |
Sets any comments preceeding the section.
Sections in the mascot.dat file may have comments preceeding them. In most cases, these comments need to stay 'attached' to the section.
Multiple line comments are supported by having a single string with newline characters
comments | any comments preceeding the section |
|
inherited |
Changes name of the property with the given index.
index | property number from 0 to (getNumberOfProperties()-1). |
name | new name to be given to the property. |
|
inherited |
Changes a boolean value of the first entry with the given name or creates a new property if it is not found.
A new value will be converted into 1 (for TRUE) or 0 (for FALSE) character.
name | a name of the property to find or add. |
value | a new boolean value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes a single character value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new single character value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes an floating point value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new floating point value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes a long 64-bit integer value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new long 64-bit integer value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes an integer value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new integer value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes a string value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new string value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes an string value of an existing property with the given index.
index | an index of an existing property. |
str | String value for the property. |
void setSecsToWaitForNodeAtStartup | ( | const int | value | ) |
Change SecsToWaitForNodeAtStartup.
See getSecsToWaitForNodeAtStartup() for more information.
value | seconds to wait for node at startup |
void setSectionAvailable | ( | const bool | value | ) |
Change availability of the section, i.e. if it should be saved in a file.
Value of 1 is to enable cluster mode, whereas 0 is to enable single server mode.
Default is 0.
value | Boolean whether the section is available |
|
inherited |
Uncomments a line in the configuration file.
Removes a # and any white space. Finds the delimeter and extracts the property name and value.
index | must be a value between 0 and getNumberOfProperties(). |
delimeter | will often be a space. If not supplied, the default delimeter will be used. |