mstrio > server > cluster¶
- class mstrio.server.cluster.Cluster(connection)¶
Bases:
object
Manage, list nodes (servers) on a cluster.
Manage Services on nodes. Manage node settings. Load and Unload projects. A “service” is a product developed by Strategy One or a third-party product distributed by Strategy One i.e. “Strategy One Intelligence Server” or “Apache ZooKeeper”.
- Parameters:
connection (Connection) –
- add_node(node, add_to_cluster_startup=False)¶
Add server (node) to the cluster.
- Parameters:
node (str | Node) – name or object of node to be added
add_to_cluster_startup (bool) – if True, the node will be added to the cluster startup membership configuration
- Return type:
None
- check_dependency(service)¶
Check all dependencies for the given service.
- Raises:
ValueError – If incorrect service name is provided.
- Parameters:
service (str) –
- Return type:
list[str]
- list_cluster_startup_membership()¶
Get a list of I-Server hostnames which are part of cluster startup membership configuration.
- Return type:
list[str]
- list_node_settings(node)¶
List server (nodes) settings.
- Parameters:
node (str | Node) – name or object of node which settings will be listed
- Returns:
dictionary with the settings of node returned from I-Server.
- Return type:
dict
- list_nodes(project=None, project_name=None, node=None, to_dictionary=False)¶
Return a list of nodes and their properties within the cluster.
- Parameters:
project (str, Project, optional) – Project ID or object
project_name (str, optional) – Project name
node (str, optional) – Node name or object
to_dictionary (bool, optional) – If True returns dict, by default (False) returns Node objects
- Returns:
A list of dictionaries representing nodes or a list of Node Objects.
- Return type:
list[Node | dict]
- list_projects(to_dictionary=False, limit=None, **filters)¶
Return list of project objects or if to_dictionary=True project dicts. Optionally filter the Projects by specifying the filters keyword arguments.
- Parameters:
to_dictionary (bool) – If True returns list of project dicts
limit (int | None) – limit the number of elements returned. If None, all objects are returned.
**filters – Available filter parameters: [‘name’, ‘id’, ‘description’, ‘date_created’, ‘date_modified’, ‘owner’]
- Return type:
list[’Project’]
- list_services(group_by=GroupBy.NODES)¶
List services in the cluster grouped by nodes or services.
When group_by is set to nodes then in the list for each node there is given a list of services which are available within. When group_by is set to services then in the list for each service there is given a list of nodes on which current service is available.
- Parameters:
group_by (GroupBy | str) – determine by what the list will be grouped. Either nodes or services.
- Returns:
list of nodes with services in case of group_by set to nodes or list of services with nodes in case of group_by set to services.
- Raises:
ValueError if group_by is neither equal to nodes nor services. –
- Return type:
list
- load_project(project, on_nodes=None)¶
Request to load the project onto the chosen cluster nodes. If nodes are not specified, the project will be loaded on all nodes.
- Parameters:
project (str | Project) – name or object of project which will be loaded
on_nodes (str | list[str] | None) – name of node or nodes, if not passed, project will be loaded on all of the nodes
- Return type:
None
- nodes_topology(styled=False)¶
Return cluster node topology as Pandas DataFrame or Styler object.
- DataFrame columns:
- displayName -> it shows the name with which service is displayed
in Workstation
id -> name of the service within nodes
- for each node in the cluster there is given a column which name is
name of a node and its content is information with the status of the given service in this node. Available values of status are: ‘Running’ (green color), ‘Stopped’ (red color), ‘Not Available’ (service unavailable on the node)
- Returns:
Pandas DataFrame or Styler object if styled is True.
- Parameters:
styled (bool) –
- Return type:
pd.DataFrame | Styler
- remove_node(node, remove_from_cluster_startup=False)¶
Remove server (node) from the cluster.
- Parameters:
node (str | Node) – name or object of node to be removed
remove_from_cluster_startup (bool) – if True, the node will be removed from the cluster startup membership configuration
- Return type:
None
- reset_node_settings(node)¶
Remove I-Server configuration settings for given node within a cluster. Default values will be applied after execution of this method.
- Parameters:
node (str | Node) – name of the node for which default settings will be applied.
- Return type:
None
- services_topology(styled=False)¶
Return cluster service topology as Pandas DataFrame or Styler object.
- DataFrame columns:
service -> name of the service
- node -> name on which service appears (each service can appear in
more than one service and then name of the service is provided only once for the group of nodes in which it appears)
- status -> status which a given service has on a given node.
Available values of statuses are: ‘Running’ (green color), ‘Stopped’ (red color), ‘Not Available (service unavailable on the node)
- Returns:
Pandas DataFrame or Styler object if styled is True.
- Parameters:
styled (bool) –
- Return type:
pd.DataFrame | Styler
- set_primary_node(node)¶
Set default/primary server (node) for the cluster.
- Parameters:
node (str | Node) – name or object of the node which will be set as default for this cluster
- Return type:
None
- start(service, nodes, login=None, passwd=None)¶
Start up a service on selected nodes.
- Parameters:
service (str) – name of the service which will be started
nodes (list[str]) – list of names of nodes on which service will be started
login (str | None) – login for SSH operation. If not provided, the user will be prompted.
passwd (str | None) – password for SSH operation. If not provided, the user will be prompted.
- Raises:
ValueError – If incorrect node/service name is provided
- stop(service, nodes, login=None, passwd=None, force=False)¶
Stop a service on selected nodes. Provided service and node names are checked for correctness.
- Parameters:
service (str) – name of the service which will be started
nodes (list[str]) – list of names of nodes on which service will be started
login (str | None) – login for SSH operation. If not provided, the user will be prompted.
passwd (str | None) – password for SSH operation. If not provided, the user will be prompted.
force (bool) – if True, no additional prompt will be shown before
- Raises:
ValueError – If incorrect node/service name is provided
- unload_project(project, on_nodes=None)¶
Request to unload the project from the chosen cluster nodes. If nodes are not specified, the project will be unloaded on all nodes. The unload action cannot be performed until all jobs and connections for project are completed. Once these processes have finished, pending project will be automatically unloaded.
- Parameters:
project (str | Project) – name or object of project which will be unloaded
on_nodes (str | list[str] | None) – name of node or nodes, if not passed, project will be unloaded on all of the nodes
- Return type:
None
- update_cluster_startup_membership(nodes)¶
Update cluster startup membership configuration.
- Parameters:
nodes (list[str | None]) – list of node names which will be set as cluster startup membership.
- Return type:
None
- update_node_settings(node, load_balance_factor, initial_pool_size, max_pool_size)¶
Update I-Server configuration settings for a given server node within a cluster.
- Parameters:
node (str | Node) – Name or object of the node to update.
load_balance_factor (int) – This setting becomes relevant in an environment that has a Strategy One Intelligence Server cluster. By default, the load balance factor is 1. The value can be increased on more powerful servers in a cluster to provide an appropriate balance. A larger load balance factor means the current server consumes a greater load in the server cluster in which it resides.
initial_pool_size (int) – Initial number of connections available.
max_pool_size (int) – Maximum number of connections available.
- Return type:
None
- enum mstrio.server.cluster.GroupBy(value)¶
Bases:
str
,AutoName
- Member Type:
str
Valid values are as follows:
- NODES = GroupBy.NODES¶
- SERVICES = GroupBy.SERVICES¶
The
Enum
and its members also have the following methods:- capitalize()¶
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
- casefold()¶
Return a version of the string suitable for caseless comparisons.
- center(width, fillchar=' ', /)¶
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
- count()¶
Return the number of non-overlapping occurrences of substring sub in string S[start:end].
Optional arguments start and end are interpreted as in slice notation.
- encode(encoding='utf-8', errors='strict')¶
Encode the string using the codec registered for encoding.
- encoding
The encoding in which to encode the string.
- errors
The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
- endswith()¶
Return True if the string ends with the specified suffix, False otherwise.
- suffix
A string or a tuple of strings to try.
- start
Optional start position. Default: start of the string.
- end
Optional stop position. Default: end of the string.
- expandtabs(tabsize=8)¶
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
- find()¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
- format(*args, **kwargs)¶
Return a formatted version of the string, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).
- format_map(mapping, /)¶
Return a formatted version of the string, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).
- index()¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Raises ValueError when the substring is not found.
- isalnum()¶
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
- isalpha()¶
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
- isascii()¶
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
- isdecimal()¶
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
- isdigit()¶
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
- isidentifier()¶
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.
- islower()¶
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
- isnumeric()¶
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at least one character in the string.
- isprintable()¶
Return True if all characters in the string are printable, False otherwise.
A character is printable if repr() may use it in its output.
- isspace()¶
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
- istitle()¶
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
- isupper()¶
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
- join(iterable, /)¶
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
- ljust(width, fillchar=' ', /)¶
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
- lower()¶
Return a copy of the string converted to lowercase.
- lstrip(chars=None, /)¶
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
- static maketrans()¶
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
- partition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
- removeprefix(prefix, /)¶
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
- removesuffix(suffix, /)¶
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
- replace(old, new, /, count=-1)¶
Return a copy with all occurrences of substring old replaced by new.
- count
Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are replaced.
- rfind()¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
- rindex()¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Raises ValueError when the substring is not found.
- rjust(width, fillchar=' ', /)¶
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
- rpartition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
- rsplit(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
- rstrip(chars=None, /)¶
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- split(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the front of the string and works to the end.
Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
- splitlines(keepends=False)¶
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and true.
- startswith()¶
Return True if the string starts with the specified prefix, False otherwise.
- prefix
A string or a tuple of strings to try.
- start
Optional start position. Default: start of the string.
- end
Optional stop position. Default: end of the string.
- strip(chars=None, /)¶
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- swapcase()¶
Convert uppercase characters to lowercase and lowercase characters to uppercase.
- title()¶
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining cased characters have lower case.
- translate(table, /)¶
Replace each character in the string using the given translation table.
- table
Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
- upper()¶
Return a copy of the string converted to uppercase.
- zfill(width, /)¶
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
- enum mstrio.server.cluster.ServiceAction(value)¶
Bases:
str
,AutoUpperName
- Member Type:
str
Valid values are as follows:
- START = <ServiceAction.START: 'START'>¶
- STOP = <ServiceAction.STOP: 'STOP'>¶
The
Enum
and its members also have the following methods:- capitalize()¶
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
- casefold()¶
Return a version of the string suitable for caseless comparisons.
- center(width, fillchar=' ', /)¶
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
- count()¶
Return the number of non-overlapping occurrences of substring sub in string S[start:end].
Optional arguments start and end are interpreted as in slice notation.
- encode(encoding='utf-8', errors='strict')¶
Encode the string using the codec registered for encoding.
- encoding
The encoding in which to encode the string.
- errors
The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
- endswith()¶
Return True if the string ends with the specified suffix, False otherwise.
- suffix
A string or a tuple of strings to try.
- start
Optional start position. Default: start of the string.
- end
Optional stop position. Default: end of the string.
- expandtabs(tabsize=8)¶
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
- find()¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
- format(*args, **kwargs)¶
Return a formatted version of the string, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).
- format_map(mapping, /)¶
Return a formatted version of the string, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).
- index()¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Raises ValueError when the substring is not found.
- isalnum()¶
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
- isalpha()¶
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
- isascii()¶
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
- isdecimal()¶
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
- isdigit()¶
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
- isidentifier()¶
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.
- islower()¶
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
- isnumeric()¶
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at least one character in the string.
- isprintable()¶
Return True if all characters in the string are printable, False otherwise.
A character is printable if repr() may use it in its output.
- isspace()¶
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
- istitle()¶
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
- isupper()¶
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
- join(iterable, /)¶
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
- ljust(width, fillchar=' ', /)¶
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
- lower()¶
Return a copy of the string converted to lowercase.
- lstrip(chars=None, /)¶
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
- static maketrans()¶
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
- partition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
- removeprefix(prefix, /)¶
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
- removesuffix(suffix, /)¶
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
- replace(old, new, /, count=-1)¶
Return a copy with all occurrences of substring old replaced by new.
- count
Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are replaced.
- rfind()¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
- rindex()¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
Optional arguments start and end are interpreted as in slice notation. Raises ValueError when the substring is not found.
- rjust(width, fillchar=' ', /)¶
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
- rpartition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
- rsplit(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
- rstrip(chars=None, /)¶
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- split(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the front of the string and works to the end.
Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
- splitlines(keepends=False)¶
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and true.
- startswith()¶
Return True if the string starts with the specified prefix, False otherwise.
- prefix
A string or a tuple of strings to try.
- start
Optional start position. Default: start of the string.
- end
Optional stop position. Default: end of the string.
- strip(chars=None, /)¶
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- swapcase()¶
Convert uppercase characters to lowercase and lowercase characters to uppercase.
- title()¶
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining cased characters have lower case.
- translate(table, /)¶
Replace each character in the string using the given translation table.
- table
Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
- upper()¶
Return a copy of the string converted to uppercase.
- zfill(width, /)¶
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.