| 1 |
Configuration |
| 2 |
============= |
| 3 |
|
| 4 |
.. highlight:: ini |
| 5 |
|
| 6 |
clush |
| 7 |
----- |
| 8 |
|
| 9 |
.. _clush-config: |
| 10 |
|
| 11 |
clush.conf |
| 12 |
^^^^^^^^^^ |
| 13 |
|
| 14 |
The *clush.conf* files are parsed with Python's `ConfigParser`_ |
| 15 |
|
| 16 |
Locations |
| 17 |
""""""""" |
| 18 |
|
| 19 |
The following configuration file defines system-wide default values for |
| 20 |
several ``clush`` tool parameters:: |
| 21 |
|
| 22 |
/etc/clustershell/clush.conf |
| 23 |
|
| 24 |
``clush`` settings might then be overridden (globally, or per user) if one of |
| 25 |
the following files is found, in priority order:: |
| 26 |
|
| 27 |
$XDG_CONFIG_HOME/clustershell/clush.conf |
| 28 |
$HOME/.config/clustershell/clush.conf (only if $XDG_CONFIG_HOME is not defined) |
| 29 |
{sys.prefix}/etc/clustershell/clush.conf |
| 30 |
$HOME/.local/etc/clustershell/clush.conf |
| 31 |
$HOME/.clush.conf (deprecated, for 1.6 compatibility only) |
| 32 |
|
| 33 |
.. note:: The path using `sys.prefix`_ was added in version 1.9.1 and is |
| 34 |
useful for Python virtual environments. |
| 35 |
|
| 36 |
In addition, if the environment variable ``$CLUSTERSHELL_CFGDIR`` is defined and |
| 37 |
valid, it will be used instead. In that case, the following configuration file |
| 38 |
will be tried first for ``clush``:: |
| 39 |
|
| 40 |
$CLUSTERSHELL_CFGDIR/clush.conf |
| 41 |
|
| 42 |
Settings |
| 43 |
"""""""" |
| 44 |
|
| 45 |
Settings that apply to all ``clush`` :ref:`run modes <clushmode-config>` are |
| 46 |
contained within the ``[Main]`` section. |
| 47 |
|
| 48 |
The following table describes available ``clush`` config file settings. |
| 49 |
|
| 50 |
+-----------------+----------------------------------------------------+ |
| 51 |
| Key | Value | |
| 52 |
+=================+====================================================+ |
| 53 |
| fanout | Size of the sliding window of connectors (e.g. max | |
| 54 |
| | number of *ssh(1)* allowed to run at the same | |
| 55 |
| | time). | |
| 56 |
+-----------------+----------------------------------------------------+ |
| 57 |
| confdir | Optional list of directory paths where ``clush`` | |
| 58 |
| | should look for **.conf** files which define | |
| 59 |
| | :ref:`run modes <clushmode-config>` that can then | |
| 60 |
| | be activated with `--mode`. All other ``clush`` | |
| 61 |
| | config file settings defined in this table might | |
| 62 |
| | be overridden in a run mode. Each mode section | |
| 63 |
| | should have a name prefixed by "mode:" to clearly | |
| 64 |
| | identify a section defining a mode. Duplicate | |
| 65 |
| | modes are not allowed in those files. | |
| 66 |
| | Configuration files that are not readable by the | |
| 67 |
| | current user are ignored. The variable ``$CFGDIR`` | |
| 68 |
| | is replaced by the path of the highest priority | |
| 69 |
| | configuration directory found (where *clush.conf* | |
| 70 |
| | resides). The default *confdir* value enables both | |
| 71 |
| | system-wide and any installed user configuration | |
| 72 |
| | (thanks to ``$CFGDIR``). Duplicate directory paths | |
| 73 |
| | are ignored. | |
| 74 |
+-----------------+----------------------------------------------------+ |
| 75 |
| connect_timeout | Timeout in seconds to allow a connection to | |
| 76 |
| | establish. This parameter is passed to *ssh(1)*. | |
| 77 |
| | If set to 0, no timeout occurs. | |
| 78 |
+-----------------+----------------------------------------------------+ |
| 79 |
| command_prefix | Command prefix. Generally used for specific | |
| 80 |
| | :ref:`run modes <clush-modes>`, for example to | |
| 81 |
| | implement *sudo(8)* support. | |
| 82 |
+-----------------+----------------------------------------------------+ |
| 83 |
| command_timeout | Timeout in seconds to allow a command to complete | |
| 84 |
| | since the connection has been established. This | |
| 85 |
| | parameter is passed to *ssh(1)*. In addition, the | |
| 86 |
| | ClusterShell library ensures that any commands | |
| 87 |
| | complete in less than (connect_timeout \+ | |
| 88 |
| | command_timeout). If set to 0, no timeout occurs. | |
| 89 |
+-----------------+----------------------------------------------------+ |
| 90 |
| color | Whether to use ANSI colors to surround node | |
| 91 |
| | or nodeset prefix/header with escape sequences to | |
| 92 |
| | display them in color on the terminal. Valid | |
| 93 |
| | arguments are *never*, *always* or *auto* (which | |
| 94 |
| | uses color if standard output/error refer to a | |
| 95 |
| | terminal). | |
| 96 |
| | Colors are set to ``[34m`` (blue foreground text) | |
| 97 |
| | for stdout and ``[31m`` (red foreground text) for | |
| 98 |
| | stderr, and cannot be modified. | |
| 99 |
+-----------------+----------------------------------------------------+ |
| 100 |
| fd_max | Maximum number of open file descriptors | |
| 101 |
| | permitted per ``clush`` process (soft resource | |
| 102 |
| | limit for open files). This limit can never exceed | |
| 103 |
| | the system (hard) limit. The *fd_max* (soft) and | |
| 104 |
| | system (hard) limits should be high enough to | |
| 105 |
| | run ``clush``, although their values depend on | |
| 106 |
| | your fanout value. | |
| 107 |
+-----------------+----------------------------------------------------+ |
| 108 |
| history_size | Set the maximum number of history entries saved in | |
| 109 |
| | the GNU readline history list. Negative values | |
| 110 |
| | imply unlimited history file size. | |
| 111 |
+-----------------+----------------------------------------------------+ |
| 112 |
| node_count | Should ``clush`` display additional (node count) | |
| 113 |
| | information in buffer header? (yes/no) | |
| 114 |
+-----------------+----------------------------------------------------+ |
| 115 |
| maxrc | Should ``clush`` return the largest of command | |
| 116 |
| | return codes? (yes/no) | |
| 117 |
| | If set to no (the default), ``clush`` exit status | |
| 118 |
| | gives no information about command return codes, | |
| 119 |
| | but rather reports on ``clush`` execution itself | |
| 120 |
| | (zero indicating a successful run). | |
| 121 |
+-----------------+----------------------------------------------------+ |
| 122 |
| password_prompt | Enable password prompt and password forwarding to | |
| 123 |
| | stdin? (yes/no) | |
| 124 |
| | Generally used for specific | |
| 125 |
| | :ref:`run modes <clush-modes>`, for example to | |
| 126 |
| | implement interactive *sudo(8)* support. | |
| 127 |
+-----------------+----------------------------------------------------+ |
| 128 |
| verbosity | Set the verbosity level: 0 (quiet), 1 (default), | |
| 129 |
| | 2 (verbose) or more (debug). | |
| 130 |
+-----------------+----------------------------------------------------+ |
| 131 |
| ssh_user | Set the *ssh(1)* user to use for remote connection | |
| 132 |
| | (default is to not specify). | |
| 133 |
+-----------------+----------------------------------------------------+ |
| 134 |
| ssh_path | Set the *ssh(1)* binary path to use for remote | |
| 135 |
| | connection (default is *ssh*). | |
| 136 |
+-----------------+----------------------------------------------------+ |
| 137 |
| ssh_options | Set additional (raw) options to pass to the | |
| 138 |
| | underlying *ssh(1)* command. | |
| 139 |
+-----------------+----------------------------------------------------+ |
| 140 |
| scp_path | Set the *scp(1)* binary path to use for remote | |
| 141 |
| | copy (default is *scp*). | |
| 142 |
+-----------------+----------------------------------------------------+ |
| 143 |
| scp_options | Set additional options to pass to the underlying | |
| 144 |
| | *scp(1)* command. If not specified, *ssh_options* | |
| 145 |
| | are used instead. | |
| 146 |
+-----------------+----------------------------------------------------+ |
| 147 |
| rsh_path | Set the *rsh(1)* binary path to use for remote | |
| 148 |
| | connection (default is *rsh*). You could easily | |
| 149 |
| | use *mrsh* or *krsh* by simply changing this | |
| 150 |
| | value. | |
| 151 |
+-----------------+----------------------------------------------------+ |
| 152 |
| rcp_path | Same as *rsh_path* but for rcp command (default is | |
| 153 |
| | *rcp*). | |
| 154 |
+-----------------+----------------------------------------------------+ |
| 155 |
| rsh_options | Set additional options to pass to the underlying | |
| 156 |
| | rsh/rcp command. | |
| 157 |
+-----------------+----------------------------------------------------+ |
| 158 |
|
| 159 |
.. _clushmode-config: |
| 160 |
|
| 161 |
Run modes |
| 162 |
^^^^^^^^^ |
| 163 |
|
| 164 |
Since version 1.9, ``clush`` has support for run modes, which are special |
| 165 |
:ref:`clush-config` settings with a given name. Two run modes are provided in |
| 166 |
example configuration files that can be copied and modified. They implement |
| 167 |
password-based authentication with *sshpass(1)* and support of interactive |
| 168 |
*sudo(8)* with password. |
| 169 |
|
| 170 |
To use a run mode with ``clush --mode``, install a configuration file in one |
| 171 |
of :ref:`clush-config`'s ``confdir`` (usually ``clush.conf.d``). Only |
| 172 |
configuration files ending in **.conf** are scanned. If the user running |
| 173 |
``clush`` doesn't have read access to a configuration file, it is ignored. |
| 174 |
When ``--mode`` is specified, you can display all available run modes for |
| 175 |
the current user by enabling debug mode (``-d``). |
| 176 |
|
| 177 |
Example of a run mode configuration file (e.g. |
| 178 |
``/etc/clustershell/clush.conf.d/sudo.conf``) to add support for interactive |
| 179 |
sudo:: |
| 180 |
|
| 181 |
[mode:sudo] |
| 182 |
password_prompt: yes |
| 183 |
command_prefix: /usr/bin/sudo -S -p "''" |
| 184 |
|
| 185 |
System administrators or users can easily create additional run modes by |
| 186 |
adding configuration files to :ref:`clush-config`'s ``confdir``. |
| 187 |
|
| 188 |
More details about using run modes can be found :ref:`here <clush-modes>`. |
| 189 |
|
| 190 |
.. _groups-config: |
| 191 |
|
| 192 |
Node groups |
| 193 |
----------- |
| 194 |
|
| 195 |
ClusterShell defines a *node group* syntax to represent a collection of nodes. |
| 196 |
This is a convenient way to manipulate node sets, especially in HPC (High |
| 197 |
Performance Computing) or with large server farms. This section explains how |
| 198 |
to configure node group **sources**. Please see also :ref:`nodeset node groups |
| 199 |
<nodeset-groups>` for specific usage examples. |
| 200 |
|
| 201 |
.. _groups_config_conf: |
| 202 |
|
| 203 |
groups.conf |
| 204 |
^^^^^^^^^^^ |
| 205 |
|
| 206 |
ClusterShell loads *groups.conf* configuration files that define how to |
| 207 |
obtain node groups configuration, i.e. the way the library should access |
| 208 |
file-based or external node group **sources**. |
| 209 |
|
| 210 |
The following configuration file defines system-wide default values for |
| 211 |
*groups.conf*:: |
| 212 |
|
| 213 |
/etc/clustershell/groups.conf |
| 214 |
|
| 215 |
*groups.conf* settings might then be overridden (globally, or per user) if one |
| 216 |
of the following files is found, in priority order:: |
| 217 |
|
| 218 |
$XDG_CONFIG_HOME/clustershell/groups.conf |
| 219 |
$HOME/.config/clustershell/groups.conf (only if $XDG_CONFIG_HOME is not defined) |
| 220 |
{sys.prefix}/etc/clustershell/groups.conf |
| 221 |
$HOME/.local/etc/clustershell/groups.conf |
| 222 |
|
| 223 |
.. note:: The path using `sys.prefix`_ was added in version 1.9.1 and is |
| 224 |
useful for Python virtual environments. |
| 225 |
|
| 226 |
In addition, if the environment variable ``$CLUSTERSHELL_CFGDIR`` is defined and |
| 227 |
valid, it will be used instead. In that case, the following configuration file |
| 228 |
will be tried first for *groups.conf*:: |
| 229 |
|
| 230 |
$CLUSTERSHELL_CFGDIR/groups.conf |
| 231 |
|
| 232 |
This makes it possible for a user to have their own *node groups* |
| 233 |
configuration. If no readable configuration file is found, group support will |
| 234 |
be disabled but other node set operations will still work. |
| 235 |
|
| 236 |
*groups.conf* defines configuration sub-directories, but may also define |
| 237 |
group sources by itself. These **sources** provide external calls that are |
| 238 |
detailed in :ref:`group-external-sources`. |
| 239 |
|
| 240 |
The following example shows the content of a *groups.conf* file where node |
| 241 |
groups are bound to the source named *genders* by default:: |
| 242 |
|
| 243 |
[Main] |
| 244 |
default: genders |
| 245 |
confdir: /etc/clustershell/groups.conf.d $CFGDIR/groups.conf.d |
| 246 |
autodir: /etc/clustershell/groups.d $CFGDIR/groups.d |
| 247 |
|
| 248 |
[genders] |
| 249 |
map: nodeattr -n $GROUP |
| 250 |
all: nodeattr -n ALL |
| 251 |
list: nodeattr -l |
| 252 |
|
| 253 |
[slurm] |
| 254 |
map: sinfo -h -o "%N" -p $GROUP |
| 255 |
all: sinfo -h -o "%N" |
| 256 |
list: sinfo -h -o "%P" |
| 257 |
reverse: sinfo -h -N -o "%P" -n $NODE |
| 258 |
|
| 259 |
The *groups.conf* files are parsed with Python's `ConfigParser`_. The first |
| 260 |
section whose name is *Main* accepts the settings described in the following |
| 261 |
table. |
| 262 |
|
| 263 |
+---------+------------------------------------------------------------+ |
| 264 |
| Key | Value | |
| 265 |
+=========+============================================================+ |
| 266 |
| default | **Name of the default group source.** | |
| 267 |
| | | |
| 268 |
| | Used when a group is specified without a source, e.g. | |
| 269 |
| | ``@compute`` instead of ``@genders:compute``. Must be the | |
| 270 |
| | name of an existing group source. | |
| 271 |
+---------+------------------------------------------------------------+ |
| 272 |
| confdir | **Directories to search for .conf files that define | |
| 273 |
| | additional group sources.** | |
| 274 |
| | | |
| 275 |
| | Each ``.conf`` file in these directories may define one or | |
| 276 |
| | more group source sections, as documented below. These | |
| 277 |
| | sources are merged with the group sources defined in the | |
| 278 |
| | main *groups.conf*. Duplicate group source sections are | |
| 279 |
| | not allowed in those files. Configuration files that are | |
| 280 |
| | not readable by the current user are ignored (except the | |
| 281 |
| | one that defines the default group source). The variable | |
| 282 |
| | ``$CFGDIR`` is replaced by the path of the highest | |
| 283 |
| | priority configuration directory found (where | |
| 284 |
| | *groups.conf* resides). The default *confdir* value | |
| 285 |
| | enables both system-wide and any installed user | |
| 286 |
| | configuration (thanks to ``$CFGDIR``). Duplicate | |
| 287 |
| | directory paths are ignored. The | |
| 288 |
| | key *groupsdir* is accepted as an alias for *confdir*; if | |
| 289 |
| | both are defined, *groupsdir* takes precedence. | |
| 290 |
+---------+------------------------------------------------------------+ |
| 291 |
| autodir | **Directories to search for YAML group files.** | |
| 292 |
| | | |
| 293 |
| | These files define node groups directly, without the need | |
| 294 |
| | for external commands, and are parsed by the ClusterShell | |
| 295 |
| | library itself, making them faster than upcall-based group | |
| 296 |
| | sources (see :ref:`group-file-based`). A single file may | |
| 297 |
| | define multiple group sources. The variable ``$CFGDIR`` | |
| 298 |
| | is replaced by the path of the highest priority | |
| 299 |
| | configuration directory found (where *groups.conf* | |
| 300 |
| | resides). The default *autodir* value enables both | |
| 301 |
| | system-wide and any installed user configuration (thanks | |
| 302 |
| | to ``$CFGDIR``). Duplicate directory paths are ignored. | |
| 303 |
+---------+------------------------------------------------------------+ |
| 304 |
|
| 305 |
Each following section, like `genders` and `slurm` in the example above, |
| 306 |
defines a group source. The **map**, **mapall**, **all**, **list** and |
| 307 |
**reverse** upcalls are explained below in :ref:`group-sources-upcalls`. |
| 308 |
|
| 309 |
.. _group-file-based: |
| 310 |
|
| 311 |
File-based group sources |
| 312 |
^^^^^^^^^^^^^^^^^^^^^^^^ |
| 313 |
|
| 314 |
Version 1.7 introduces support for native handling of flat files with |
| 315 |
different group sources to avoid the use of external upcalls for such static |
| 316 |
configuration. This can be achieved through the *autodir* feature and YAML |
| 317 |
files described below. |
| 318 |
|
| 319 |
YAML group files |
| 320 |
"""""""""""""""" |
| 321 |
|
| 322 |
Cluster node groups can be defined in straightforward YAML files. In such a |
| 323 |
file, each YAML dictionary defines a group-to-nodes mapping. **Different |
| 324 |
dictionaries** are handled as **different group sources**. |
| 325 |
|
| 326 |
For compatibility reasons with previous versions of ClusterShell, this is not |
| 327 |
the default way to define node groups yet. So here are the steps needed to try |
| 328 |
this out: |
| 329 |
|
| 330 |
Rename the following file:: |
| 331 |
|
| 332 |
/etc/clustershell/groups.d/cluster.yaml.example |
| 333 |
|
| 334 |
to a file having the **.yaml** extension, for example:: |
| 335 |
|
| 336 |
/etc/clustershell/groups.d/cluster.yaml |
| 337 |
|
| 338 |
|
| 339 |
Ensure that *autodir* is set in :ref:`groups_config_conf`:: |
| 340 |
|
| 341 |
autodir: /etc/clustershell/groups.d $CFGDIR/groups.d |
| 342 |
|
| 343 |
In the following example, we also changed the default group source |
| 344 |
to **roles** in :ref:`groups_config_conf` (the first dictionary defined in |
| 345 |
the example), so that *@roles:groupname* can just be shortened to |
| 346 |
*@groupname*. |
| 347 |
|
| 348 |
.. highlight:: yaml |
| 349 |
|
| 350 |
Here is an example of **/etc/clustershell/groups.d/cluster.yaml**:: |
| 351 |
|
| 352 |
roles: |
| 353 |
adm: 'mgmt[1-2]' # define groups @roles:adm and @adm |
| 354 |
login: 'login[1-2]' |
| 355 |
compute: 'node[0001-0288]' |
| 356 |
gpu: 'node[0001-0008]' |
| 357 |
|
| 358 |
servers: # example of yaml list syntax for nodes |
| 359 |
- 'server001' # in a group |
| 360 |
- 'server002,server101' |
| 361 |
- 'server[003-006]' |
| 362 |
|
| 363 |
cpu_only: '@compute!@gpu' # example of inline set operation |
| 364 |
# define group @cpu_only with node[0009-0288] |
| 365 |
|
| 366 |
storage: '@lustre:mds,@lustre:oss' # example of external source reference |
| 367 |
|
| 368 |
all: '@login,@compute,@storage' # special group used for clush/nodeset -a |
| 369 |
# only needed if not including all groups |
| 370 |
|
| 371 |
lustre: |
| 372 |
mds: 'mds[1-4]' |
| 373 |
oss: 'oss[0-15]' |
| 374 |
rbh: 'rbh[1-2]' |
| 375 |
|
| 376 |
|
| 377 |
If you wish to define an empty group (with no nodes), you can either use an |
| 378 |
empty string ``''`` or any valid YAML null value (``null`` or ``~``). |
| 379 |
|
| 380 |
.. note:: |
| 381 |
|
| 382 |
To select **every node** of a group source, use the ``*`` wildcard, for |
| 383 |
example ``@lustre:*`` or, for the default source, ``@*``. This is the |
| 384 |
*all nodes* notation also used by ``clush -a`` and ``nodeset -a``, as |
| 385 |
described in :ref:`group-sources-upcalls`. The word ``all`` is not special: |
| 386 |
it is an ordinary group name, so ``@lustre:*`` and ``@lustre:all`` are |
| 387 |
**not** equivalent. ``@lustre:all`` resolves the group literally named |
| 388 |
``all``, which yields an empty node set here because ``lustre`` defines no |
| 389 |
such group. By default *all nodes* is the union of every group in the |
| 390 |
source. Defining an optional ``all`` group, like the ``all:`` key shown |
| 391 |
above in the ``roles`` source, overrides that union for both ``-a`` and |
| 392 |
``@source:*``. |
| 393 |
|
| 394 |
.. highlight:: console |
| 395 |
|
| 396 |
Testing the syntax of your group file can be quickly performed through the |
| 397 |
``-L`` or ``--list-all`` command of :ref:`nodeset-tool`, doubled here as |
| 398 |
``-LL`` to also display the nodes of each group:: |
| 399 |
|
| 400 |
$ nodeset -LL |
| 401 |
@adm mgmt[1-2] |
| 402 |
@all login[1-2],mds[1-4],node[0001-0288],oss[0-15] |
| 403 |
@compute node[0001-0288] |
| 404 |
@cpu_only node[0009-0288] |
| 405 |
@gpu node[0001-0008] |
| 406 |
@login login[1-2] |
| 407 |
@servers server[001-006,101] |
| 408 |
@storage mds[1-4],oss[0-15] |
| 409 |
@lustre:mds mds[1-4] |
| 410 |
@lustre:oss oss[0-15] |
| 411 |
@lustre:rbh rbh[1-2] |
| 412 |
|
| 413 |
.. _group-external-sources: |
| 414 |
|
| 415 |
External group sources |
| 416 |
^^^^^^^^^^^^^^^^^^^^^^ |
| 417 |
|
| 418 |
.. _group-sources-upcalls: |
| 419 |
|
| 420 |
Group source upcalls |
| 421 |
"""""""""""""""""""" |
| 422 |
|
| 423 |
Each node group source is defined by a section name (*source* name) and up to |
| 424 |
five upcalls, described in the following table. |
| 425 |
|
| 426 |
+---------+------------------------------------------------------------+ |
| 427 |
| Upcall | Description | |
| 428 |
+=========+============================================================+ |
| 429 |
| map | **Resolves a group name into a node set.** | |
| 430 |
| | | |
| 431 |
| | External shell command that should return a node set, list | |
| 432 |
| | of nodes or list of node sets (separated by space | |
| 433 |
| | characters or by carriage returns). The variable *$GROUP* | |
| 434 |
| | is replaced before executing the command. Either ``map`` | |
| 435 |
| | or ``mapall`` must be defined. | |
| 436 |
+---------+------------------------------------------------------------+ |
| 437 |
| mapall | **Returns all group-to-nodes mappings of the source in a | |
| 438 |
| | single call.** | |
| 439 |
| | | |
| 440 |
| | Optional external shell command that should print one | |
| 441 |
| | ``group: nodes`` line per group. Useful when the source | |
| 442 |
| | can dump all its groups at once (e.g. with ``sinfo`` or | |
| 443 |
| | ``ansible-inventory --list``), as a single call then | |
| 444 |
| | serves both ``map`` and ``list`` queries from the cache. | |
| 445 |
| | ``mapall`` output takes precedence over the ``list`` | |
| 446 |
| | upcall. If ``map`` is also defined, it is used as a | |
| 447 |
| | fallback for groups missing from the ``mapall`` output (or | |
| 448 |
| | all groups if caching is disabled); otherwise, missing | |
| 449 |
| | groups resolve to an empty node set. The first ``:`` on | |
| 450 |
| | each line separates the group name from the nodes, so | |
| 451 |
| | group names must be single words without ``:``. Duplicate | |
| 452 |
| | group lines are merged. A malformed output line makes the | |
| 453 |
| | whole ``mapall`` call fail (nothing is cached and the next | |
| 454 |
| | query retries), and a failing ``mapall`` command does not | |
| 455 |
| | fall back to ``map``. | |
| 456 |
+---------+------------------------------------------------------------+ |
| 457 |
| all | **Returns all nodes of the group source.** | |
| 458 |
| | | |
| 459 |
| | Optional external shell command that should return a node | |
| 460 |
| | set, list of nodes or list of node sets. If not specified, | |
| 461 |
| | the library will try to resolve all nodes by using the | |
| 462 |
| | ``list`` external command in the same group source | |
| 463 |
| | followed by ``map`` for each available group. The notion | |
| 464 |
| | of *all nodes* is used by ``clush -a`` and also by the | |
| 465 |
| | special group name ``@*`` (or ``@source:*``). | |
| 466 |
+---------+------------------------------------------------------------+ |
| 467 |
| list | **Returns all group names of the source.** | |
| 468 |
| | | |
| 469 |
| | Optional external shell command that should return the | |
| 470 |
| | group names (separated by space characters or by carriage | |
| 471 |
| | returns). This upcall is not used when ``mapall`` is | |
| 472 |
| | defined (unless caching is disabled), as the group list is | |
| 473 |
| | then derived from its output. If neither ``list`` nor | |
| 474 |
| | ``mapall`` is specified, ClusterShell will not be able to | |
| 475 |
| | list any available groups (e.g. with ``nodeset -l`` or | |
| 476 |
| | ``cluset -l``), so it is highly recommended to set one of | |
| 477 |
| | them. | |
| 478 |
+---------+------------------------------------------------------------+ |
| 479 |
| reverse | **Finds the groups a single node belongs to.** | |
| 480 |
| | | |
| 481 |
| | Optional external shell command. The variable *$NODE* is | |
| 482 |
| | replaced before executing the command. If this external | |
| 483 |
| | call is not specified, the reverse operation is computed | |
| 484 |
| | in memory by the library from the ``list`` and ``map`` | |
| 485 |
| | external calls, if available. Also, if the number of nodes | |
| 486 |
| | to reverse is greater than the number of available groups, | |
| 487 |
| | the reverse external command is avoided automatically to | |
| 488 |
| | reduce resolution time. | |
| 489 |
+---------+------------------------------------------------------------+ |
| 490 |
|
| 491 |
.. highlight:: ini |
| 492 |
|
| 493 |
Example of a Slurm partition group source defined with a single **mapall** |
| 494 |
upcall, instead of separate **map** and **list** upcalls:: |
| 495 |
|
| 496 |
[slurmpart,sp] |
| 497 |
mapall: sinfo -h -o "%R:%N" |
| 498 |
|
| 499 |
In addition to the context-dependent *$GROUP* and *$NODE* variables |
| 500 |
described above, the following two variables are always available and also |
| 501 |
replaced before executing shell commands: |
| 502 |
|
| 503 |
* *$CFGDIR* is replaced by the *groups.conf* base directory path |
| 504 |
* *$SOURCE* is replaced by the current source name (see a usage example just |
| 505 |
below) |
| 506 |
|
| 507 |
Upcall commands are executed with their standard input connected to |
| 508 |
``/dev/null``, so they must not expect any input on stdin. |
| 509 |
|
| 510 |
.. _group-external-caching: |
| 511 |
|
| 512 |
Caching considerations |
| 513 |
"""""""""""""""""""""" |
| 514 |
|
| 515 |
External command results are cached in memory, for a limited amount of time, |
| 516 |
to avoid multiple similar calls. |
| 517 |
|
| 518 |
The optional parameter **cache_time**, when specified within a group source |
| 519 |
section, defines the number of seconds each upcall result is kept in cache, |
| 520 |
in memory only. Please note that caching is actually only useful for |
| 521 |
long-running programs (like daemons) that are using node groups, not for |
| 522 |
one-shot commands like :ref:`clush <clush-tool>` or |
| 523 |
:ref:`cluset <cluset-tool>`/:ref:`nodeset <nodeset-tool>`. |
| 524 |
|
| 525 |
The default value of **cache_time** is 3600 seconds. |
| 526 |
|
| 527 |
Multiple sources section |
| 528 |
"""""""""""""""""""""""" |
| 529 |
|
| 530 |
.. highlight:: ini |
| 531 |
|
| 532 |
Use a comma-separated list of source names in the section header if you want |
| 533 |
to define multiple group sources with similar upcall commands. The special |
| 534 |
variable ``$SOURCE`` is always replaced by the source name before command |
| 535 |
execution (here `cluster`, `racks` and `cpu`), for example:: |
| 536 |
|
| 537 |
[cluster,racks,cpu] |
| 538 |
map: get_nodes_from_source.sh $SOURCE $GROUP |
| 539 |
all: get_all_nodes_from_source.sh $SOURCE |
| 540 |
list: list_nodes_from_source.sh $SOURCE |
| 541 |
|
| 542 |
is equivalent to:: |
| 543 |
|
| 544 |
[cluster] |
| 545 |
map: get_nodes_from_source.sh cluster $GROUP |
| 546 |
all: get_all_nodes_from_source.sh cluster |
| 547 |
list: list_nodes_from_source.sh cluster |
| 548 |
|
| 549 |
[racks] |
| 550 |
map: get_nodes_from_source.sh racks $GROUP |
| 551 |
all: get_all_nodes_from_source.sh racks |
| 552 |
list: list_nodes_from_source.sh racks |
| 553 |
|
| 554 |
[cpu] |
| 555 |
map: get_nodes_from_source.sh cpu $GROUP |
| 556 |
all: get_all_nodes_from_source.sh cpu |
| 557 |
list: list_nodes_from_source.sh cpu |
| 558 |
|
| 559 |
Return code of external calls |
| 560 |
""""""""""""""""""""""""""""" |
| 561 |
|
| 562 |
Each external command might return a non-zero return code when the operation |
| 563 |
is not doable. But if the call returns zero, for instance for a non-existing |
| 564 |
group, the user will not receive any error when trying to resolve such an |
| 565 |
unknown group. The desired behavior is up to the system administrator. |
| 566 |
|
| 567 |
.. _group-slurm-bindings: |
| 568 |
|
| 569 |
Slurm group bindings |
| 570 |
"""""""""""""""""""" |
| 571 |
|
| 572 |
Enable Slurm node group bindings by renaming the example configuration file |
| 573 |
usually installed as ``/etc/clustershell/groups.conf.d/slurm.conf.example`` to |
| 574 |
``slurm.conf``. Seven group sources are defined in this file and are detailed |
| 575 |
below. Each section comes with a long and a short name (for convenience), but |
| 576 |
both define the same group source. |
| 577 |
|
| 578 |
While examples below are based on the :ref:`nodeset-tool` tool, all Python |
| 579 |
tools using ClusterShell and the :class:`.NodeSet` class will automatically |
| 580 |
benefit from these additional node groups. |
| 581 |
|
| 582 |
.. highlight:: ini |
| 583 |
|
| 584 |
The first section **slurmpart,sp** defines a group source based on Slurm |
| 585 |
partitions. Each group is named after the partition name and contains the |
| 586 |
partition's nodes:: |
| 587 |
|
| 588 |
[slurmpart,sp] |
| 589 |
map: sinfo -h -o "%N" -p $GROUP |
| 590 |
mapall: sinfo -h -o "%R:%N" |
| 591 |
all: sinfo -h -o "%N" |
| 592 |
list: sinfo -h -o "%R" |
| 593 |
reverse: sinfo -h -N -o "%R" -n $NODE |
| 594 |
|
| 595 |
.. highlight:: console |
| 596 |
|
| 597 |
Example of use with :ref:`nodeset <nodeset-tool>` on a cluster having two Slurm |
| 598 |
partitions named *kepler* and *pascal*:: |
| 599 |
|
| 600 |
$ nodeset -s sp -ll |
| 601 |
@sp:kepler cluster-[0001-0065] |
| 602 |
@sp:pascal cluster-[0066-0068] |
| 603 |
|
| 604 |
.. highlight:: ini |
| 605 |
|
| 606 |
The second section **slurmresv,sr** defines a group source based on Slurm |
| 607 |
reservations. Each group is based on a different reservation and contains |
| 608 |
the nodes currently in that reservation:: |
| 609 |
|
| 610 |
[slurmresv,sr] |
| 611 |
map: scontrol -o show reservation $GROUP | grep -Po 'Nodes=\K[^ ]+' |
| 612 |
mapall: scontrol -o show reservation | sed -n 's/^ReservationName=\([^ :]*\) .* Nodes=\([^ ]*\).*/\1:\2/p' |
| 613 |
all: scontrol -o show reservation | grep -Po 'Nodes=\K[^ ]+' |
| 614 |
list: scontrol -o show reservation | grep -Po 'ReservationName=\K[^ ]+' |
| 615 |
cache_time: 60 |
| 616 |
|
| 617 |
.. highlight:: console |
| 618 |
|
| 619 |
Example of use on a cluster having a reservation in place for an upcoming |
| 620 |
system maintenance:: |
| 621 |
|
| 622 |
$ nodeset -s slurmresv -l |
| 623 |
@slurmresv:Maintenance_2025-02-04 |
| 624 |
$ clush -w @slurmresv:Maintenance_2025-02-04 uptime |
| 625 |
|
| 626 |
.. highlight:: ini |
| 627 |
|
| 628 |
The next section **slurmstate,st** defines a group source based on Slurm |
| 629 |
node states. Each group is based on a different state name and contains the |
| 630 |
nodes currently in that state:: |
| 631 |
|
| 632 |
[slurmstate,st] |
| 633 |
map: sinfo -h -o "%N" -t $GROUP |
| 634 |
mapall: sinfo -h -o "%T:%N" | sed 's/[*~#!%$@+^-]*:/:/' |
| 635 |
all: sinfo -h -o "%N" |
| 636 |
list: sinfo -h -o "%T" | tr -d '*~#$@+' |
| 637 |
reverse: sinfo -h -N -o "%T" -n $NODE | tr -d '*~#$@+' |
| 638 |
cache_time: 60 |
| 639 |
|
| 640 |
Here, :ref:`cache_time <group-external-caching>` is set to 60 seconds instead |
| 641 |
of the default (3600s) to avoid caching results in memory for too long, in |
| 642 |
case of state change (this is only useful for long-running processes, not |
| 643 |
one-shot commands). |
| 644 |
|
| 645 |
.. highlight:: console |
| 646 |
|
| 647 |
Example of use with :ref:`nodeset <nodeset-tool>` to get the current nodes that |
| 648 |
are in the Slurm state *drained*:: |
| 649 |
|
| 650 |
$ nodeset -f @st:drained |
| 651 |
cluster-[0058,0067] |
| 652 |
|
| 653 |
.. highlight:: ini |
| 654 |
|
| 655 |
The next section **slurmjob,sj** defines a group source based on Slurm jobs. |
| 656 |
Each group is based on a running job ID and contains the nodes currently |
| 657 |
allocated for this job:: |
| 658 |
|
| 659 |
[slurmjob,sj] |
| 660 |
map: squeue -h -j $GROUP -o "%N" |
| 661 |
mapall: squeue -h -o "%i:%N" -t R |
| 662 |
list: squeue -h -o "%i" -t R |
| 663 |
reverse: squeue -h -w $NODE -o "%i" |
| 664 |
cache_time: 60 |
| 665 |
|
| 666 |
The next section **slurmuser,su** defines a group source based on Slurm users. |
| 667 |
Each group is based on a username and contains the nodes currently |
| 668 |
allocated for jobs belonging to the username:: |
| 669 |
|
| 670 |
[slurmuser,su] |
| 671 |
map: squeue -h -u $GROUP -o "%N" -t R |
| 672 |
mapall: squeue -h -o "%u:%N" -t R |
| 673 |
list: squeue -h -o "%u" -t R |
| 674 |
reverse: squeue -h -w $NODE -o "%i" |
| 675 |
cache_time: 60 |
| 676 |
|
| 677 |
.. highlight:: console |
| 678 |
|
| 679 |
Example of use with :ref:`clush <clush-tool>` to execute a command on all nodes |
| 680 |
with running jobs of username:: |
| 681 |
|
| 682 |
$ clush -bw@su:username 'df -Ph /scratch' |
| 683 |
$ clush -bw@su:username 'du -s /scratch/username' |
| 684 |
|
| 685 |
:ref:`cache_time <group-external-caching>` is also set to 60 seconds instead |
| 686 |
of the default (3600s) to avoid caching results in memory for too long, because |
| 687 |
this group source is likely very dynamic (this is only useful for long-running |
| 688 |
processes, not one-shot commands). |
| 689 |
|
| 690 |
.. highlight:: ini |
| 691 |
|
| 692 |
The next section **slurmaccount,sa** defines a group source based on Slurm |
| 693 |
accounts. Each group is based on an account and contains the nodes where there |
| 694 |
are running jobs under this account:: |
| 695 |
|
| 696 |
[slurmaccount,sa] |
| 697 |
map: squeue -h -A $GROUP -o "%N" -t R |
| 698 |
mapall: squeue -h -o "%a:%N" -t R |
| 699 |
list: squeue -h -o "%a" -t R |
| 700 |
reverse: squeue -h -w $NODE -o "%a" 2>/dev/null || true |
| 701 |
cache_time: 60 |
| 702 |
|
| 703 |
.. highlight:: console |
| 704 |
|
| 705 |
For example, to find all nodes that have running jobs from the account ``ruthm``:: |
| 706 |
|
| 707 |
$ cluset -f @sa:ruthm |
| 708 |
sh02-01n57,sh03-09n51,sh03-11n10 |
| 709 |
|
| 710 |
.. highlight:: ini |
| 711 |
|
| 712 |
The next section **slurmqos,sq** defines a group source based on Slurm QoS. |
| 713 |
Each group is based on a qos and contains the nodes where there are running |
| 714 |
jobs under this qos:: |
| 715 |
|
| 716 |
[slurmqos,sq] |
| 717 |
map: squeue -h -q $GROUP -o "%N" -t R |
| 718 |
mapall: squeue -h -o "%q:%N" -t R |
| 719 |
list: squeue -h -o "%q" -t R |
| 720 |
reverse: squeue -h -w $NODE -o "%q" 2>/dev/null || true |
| 721 |
cache_time: 60 |
| 722 |
|
| 723 |
.. highlight:: console |
| 724 |
|
| 725 |
Then it is easy to find nodes currently running jobs in a specified qos, here |
| 726 |
in qos ``long`` for example:: |
| 727 |
|
| 728 |
$ cluset -f @slurmqos:long |
| 729 |
sh02-01n[01-02,16-17,45,51,56],sh03-01n[02,29,61] |
| 730 |
|
| 731 |
.. _group-xcat-bindings: |
| 732 |
|
| 733 |
xCAT group bindings |
| 734 |
""""""""""""""""""" |
| 735 |
|
| 736 |
Enable xCAT node group bindings by renaming the example configuration file |
| 737 |
usually installed as ``/etc/clustershell/groups.conf.d/xcat.conf.example`` to |
| 738 |
``xcat.conf``. A single group source is defined in this file and is detailed |
| 739 |
below. |
| 740 |
|
| 741 |
.. warning:: xCAT installs its own `nodeset`_ command which |
| 742 |
usually takes precedence over ClusterShell's :ref:`nodeset-tool` command. |
| 743 |
In that case, simply use :ref:`cluset <cluset-tool>` instead. |
| 744 |
|
| 745 |
While examples below are based on the :ref:`cluset-tool` tool, all Python |
| 746 |
tools using ClusterShell and the :class:`.NodeSet` class will automatically |
| 747 |
benefit from these additional node groups. |
| 748 |
|
| 749 |
.. highlight:: ini |
| 750 |
|
| 751 |
The section **xcat** defines a group source based on xCAT static node groups:: |
| 752 |
|
| 753 |
[xcat] |
| 754 |
|
| 755 |
# list the nodes in the specified node group |
| 756 |
map: lsdef -s -t node $GROUP | cut -d' ' -f1 |
| 757 |
|
| 758 |
# list all the nodes defined in the xCAT tables |
| 759 |
all: lsdef -s -t node | cut -d' ' -f1 |
| 760 |
|
| 761 |
# list all groups |
| 762 |
list: lsdef -t group | cut -d' ' -f1 |
| 763 |
|
| 764 |
.. highlight:: console |
| 765 |
|
| 766 |
Example of use with :ref:`cluset-tool`:: |
| 767 |
|
| 768 |
$ lsdef -s -t node dtn |
| 769 |
sh-dtn01 (node) |
| 770 |
sh-dtn02 (node) |
| 771 |
|
| 772 |
$ cluset -s xcat -f @dtn |
| 773 |
sh-dtn[01-02] |
| 774 |
|
| 775 |
.. highlight:: text |
| 776 |
|
| 777 |
.. _group-ansible-bindings: |
| 778 |
|
| 779 |
Ansible inventory group bindings |
| 780 |
""""""""""""""""""""""""""""""""" |
| 781 |
|
| 782 |
Enable Ansible inventory group bindings by renaming the example configuration |
| 783 |
file usually installed as |
| 784 |
``/etc/clustershell/groups.conf.d/ansible.conf.example`` to ``ansible.conf``. |
| 785 |
|
| 786 |
**Requirements**: ``ansible-core`` (provides the ``ansible-inventory`` command) |
| 787 |
and ``jq``. |
| 788 |
|
| 789 |
The section **ansible** defines a group source backed by Ansible inventory. |
| 790 |
Each upcall command uses ``ANSIBLE_INVENTORY`` as an inline environment variable |
| 791 |
prefix so that multiple inventory sources (comma-separated paths) are supported. |
| 792 |
The default path defined in the configuration file is used as a fallback when |
| 793 |
``$ANSIBLE_INVENTORY`` is not set in the environment:: |
| 794 |
|
| 795 |
ANSIBLE_INVENTORY="${ANSIBLE_INVENTORY:-/path/to/inventory}" ansible-inventory --list ... |
| 796 |
|
| 797 |
The example upcalls resolve hosts to their Ansible ``inventory_hostname`` rather |
| 798 |
than the ``ansible_host`` connection address, so names from non-resolvable |
| 799 |
aliases (e.g. with dynamic inventory) are not directly usable with |
| 800 |
:ref:`clush-tool`. These commands can be adapted to your inventory as needed, |
| 801 |
for instance to emit ``ansible_host`` instead. |
| 802 |
|
| 803 |
Another common adaptation is to strip a DNS domain suffix when the inventory |
| 804 |
contains fully qualified hostnames but short names resolve on the cluster. |
| 805 |
Append ``| sub("\\.example\\.com$"; "")`` to the ``map`` and ``all`` filters, |
| 806 |
and in ``mapall``, apply it to each hostname by changing ``[r($d;.)]`` to |
| 807 |
``[r($d;.) | sub("\\.example\\.com$"; "")]``. |
| 808 |
|
| 809 |
The ``mapall`` upcall resolves every group in a single ``ansible-inventory |
| 810 |
--list`` call. As ``--list`` always dumps the whole inventory regardless of the |
| 811 |
group being queried, this avoids running one ``ansible-inventory`` command per |
| 812 |
group when listing or resolving several groups at once (e.g. ``nodeset -ll``). |
| 813 |
Group names that contain ``:`` or whitespace cannot be expressed in the |
| 814 |
``mapall`` output format; they are skipped from ``mapall`` and resolved through |
| 815 |
the ``map`` upcall instead, so they still resolve but do not appear in |
| 816 |
``nodeset -l`` output. |
| 817 |
|
| 818 |
.. highlight:: console |
| 819 |
|
| 820 |
Example of use with :ref:`nodeset-tool` on a cluster managed with Ansible:: |
| 821 |
|
| 822 |
$ nodeset -s ansible -l |
| 823 |
@ansible:db |
| 824 |
@ansible:web |
| 825 |
@ansible:web_prod |
| 826 |
@ansible:web_test |
| 827 |
$ clush -w @ansible:web uptime |
| 828 |
|
| 829 |
.. highlight:: text |
| 830 |
|
| 831 |
.. _topology-config: |
| 832 |
|
| 833 |
Tree topology |
| 834 |
------------- |
| 835 |
|
| 836 |
The optional *topology.conf* file defines the propagation routes used by |
| 837 |
ClusterShell's :ref:`tree execution mode <clush-tree>` to reach target nodes |
| 838 |
through gateway nodes. It is loaded from the same configuration directories as |
| 839 |
the other ClusterShell configuration files, the system-wide default being:: |
| 840 |
|
| 841 |
/etc/clustershell/topology.conf |
| 842 |
|
| 843 |
.. highlight:: ini |
| 844 |
|
| 845 |
Routes are declared under a ``[routes]`` section, for example:: |
| 846 |
|
| 847 |
[routes] |
| 848 |
rio0: rio[10-13] |
| 849 |
rio[10-11]: rio[100-240] |
| 850 |
rio[12-13]: rio[300-440] |
| 851 |
|
| 852 |
.. highlight:: text |
| 853 |
|
| 854 |
An example file is provided with ClusterShell as *topology.conf.example*. See |
| 855 |
:ref:`clush-tree` for a full description of tree mode, including how routes are |
| 856 |
turned into a propagation tree and the related command line options (such as |
| 857 |
``--topology``). |
| 858 |
|
| 859 |
.. _defaults-config: |
| 860 |
|
| 861 |
Library Defaults |
| 862 |
---------------- |
| 863 |
|
| 864 |
.. warning:: Modifying library defaults is for advanced users only as that |
| 865 |
could change the behavior of tools using ClusterShell. Moreover, tools are |
| 866 |
free to enforce their own defaults, so changing library defaults may not |
| 867 |
change a global behavior as expected. |
| 868 |
|
| 869 |
Since version 1.7, most defaults of the ClusterShell library may be overridden |
| 870 |
in *defaults.conf*. |
| 871 |
|
| 872 |
The following configuration file defines ClusterShell system-wide defaults:: |
| 873 |
|
| 874 |
/etc/clustershell/defaults.conf |
| 875 |
|
| 876 |
*defaults.conf* settings might then be overridden (globally, or per user) if |
| 877 |
one of the following files is found, in priority order:: |
| 878 |
|
| 879 |
$XDG_CONFIG_HOME/clustershell/defaults.conf |
| 880 |
$HOME/.config/clustershell/defaults.conf (only if $XDG_CONFIG_HOME is not defined) |
| 881 |
{sys.prefix}/etc/clustershell/defaults.conf |
| 882 |
$HOME/.local/etc/clustershell/defaults.conf |
| 883 |
|
| 884 |
In addition, if the environment variable ``$CLUSTERSHELL_CFGDIR`` is defined and |
| 885 |
valid, it will be used instead. In that case, the following configuration file |
| 886 |
will be tried first for ClusterShell defaults:: |
| 887 |
|
| 888 |
$CLUSTERSHELL_CFGDIR/defaults.conf |
| 889 |
|
| 890 |
Settings |
| 891 |
^^^^^^^^ |
| 892 |
|
| 893 |
Library defaults are organized in sections, each of them covering a |
| 894 |
particular ClusterShell subsystem. The following tables describe the |
| 895 |
available settings, grouped by section. |
| 896 |
|
| 897 |
The ``[task.default]`` section defines Task worker defaults. |
| 898 |
|
| 899 |
+--------------------+----------------------------------------------------+ |
| 900 |
| Key | Value | |
| 901 |
+====================+====================================================+ |
| 902 |
| stderr | Whether to store stderr separately from stdout | |
| 903 |
| | (default: no). | |
| 904 |
+--------------------+----------------------------------------------------+ |
| 905 |
| stdin | Whether to keep the command's standard input open | |
| 906 |
| | for writing (e.g. via ``Worker.write()``); if | |
| 907 |
| | disabled, EOF is sent at startup so commands that | |
| 908 |
| | read from stdin do not block (default: yes). | |
| 909 |
+--------------------+----------------------------------------------------+ |
| 910 |
| stdout_msgtree | Whether to gather stdout in a message tree, as | |
| 911 |
| | required to display gathered output, e.g. with | |
| 912 |
| | ``clush -b`` (default: yes). | |
| 913 |
+--------------------+----------------------------------------------------+ |
| 914 |
| stderr_msgtree | Whether to gather stderr in a message tree | |
| 915 |
| | (default: yes). | |
| 916 |
+--------------------+----------------------------------------------------+ |
| 917 |
| engine | Event engine backend: *auto*, *epoll*, *poll* or | |
| 918 |
| | *select* (default: *auto*). With *auto*, the best | |
| 919 |
| | available backend is selected: *epoll* first, then | |
| 920 |
| | *poll*, then *select*. Overriding the default is | |
| 921 |
| | rarely needed and mostly useful for debugging. | |
| 922 |
+--------------------+----------------------------------------------------+ |
| 923 |
| port_qlimit | Accepted here only for 1.8 compatibility; a | |
| 924 |
| | non-default value in the ``[engine]`` section | |
| 925 |
| | takes precedence. | |
| 926 |
+--------------------+----------------------------------------------------+ |
| 927 |
| auto_tree | Whether to automatically enable | |
| 928 |
| | :ref:`tree mode <clush-tree>` when a | |
| 929 |
| | *topology.conf* file is found (default: yes). | |
| 930 |
+--------------------+----------------------------------------------------+ |
| 931 |
| local_workername | Name of the worker module used for local | |
| 932 |
| | execution (default: *exec*). | |
| 933 |
+--------------------+----------------------------------------------------+ |
| 934 |
| distant_workername | Name of the worker module used for remote | |
| 935 |
| | execution (default: *ssh*; see the *rsh* use | |
| 936 |
| | case below). | |
| 937 |
+--------------------+----------------------------------------------------+ |
| 938 |
|
| 939 |
The ``[task.info]`` section defines Task runtime defaults. |
| 940 |
|
| 941 |
+--------------------+----------------------------------------------------+ |
| 942 |
| Key | Value | |
| 943 |
+====================+====================================================+ |
| 944 |
| debug | Whether to enable library debugging output | |
| 945 |
| | (default: no). | |
| 946 |
+--------------------+----------------------------------------------------+ |
| 947 |
| fanout | Size of the sliding window of connectors (e.g. max | |
| 948 |
| | number of *ssh(1)* processes allowed to run at the | |
| 949 |
| | same time) (default: 64). | |
| 950 |
+--------------------+----------------------------------------------------+ |
| 951 |
| grooming_delay | Delay in seconds during which gateways aggregate | |
| 952 |
| | identical output lines and return codes before | |
| 953 |
| | sending them back in batch (tree mode) | |
| 954 |
| | (default: 0.25). | |
| 955 |
+--------------------+----------------------------------------------------+ |
| 956 |
| connect_timeout | Timeout in seconds to allow a connection to | |
| 957 |
| | establish; if set to 0, no timeout occurs | |
| 958 |
| | (default: 10). | |
| 959 |
+--------------------+----------------------------------------------------+ |
| 960 |
| command_timeout | Timeout in seconds to allow a command to | |
| 961 |
| | complete; if set to 0, no timeout occurs | |
| 962 |
| | (default: 0). | |
| 963 |
+--------------------+----------------------------------------------------+ |
| 964 |
|
| 965 |
The ``[engine]`` section defines event engine defaults. |
| 966 |
|
| 967 |
+--------------------+----------------------------------------------------+ |
| 968 |
| Key | Value | |
| 969 |
+====================+====================================================+ |
| 970 |
| port_qlimit | Maximum number of messages that can be queued on | |
| 971 |
| | an engine port, used for inter-thread task | |
| 972 |
| | messaging (default: 100). This is the preferred | |
| 973 |
| | section for this key; a non-default value here | |
| 974 |
| | takes precedence over ``[task.default]`` (kept | |
| 975 |
| | for 1.8 compatibility). | |
| 976 |
+--------------------+----------------------------------------------------+ |
| 977 |
|
| 978 |
The ``[nodeset]`` section defines NodeSet defaults. |
| 979 |
|
| 980 |
+--------------------+----------------------------------------------------+ |
| 981 |
| Key | Value | |
| 982 |
+====================+====================================================+ |
| 983 |
| fold_axis | Axis or axes along which nD node sets are folded | |
| 984 |
| | for display; empty by default, meaning that | |
| 985 |
| | folding is computed on all axes (see | |
| 986 |
| | :ref:`defaults-config-slurm`). | |
| 987 |
+--------------------+----------------------------------------------------+ |
| 988 |
|
| 989 |
Use case: rsh |
| 990 |
^^^^^^^^^^^^^^ |
| 991 |
|
| 992 |
If your cluster uses an rsh variant like ``mrsh`` or ``krsh``, you may want to |
| 993 |
change it in the library defaults. |
| 994 |
|
| 995 |
An example file is usually available in |
| 996 |
``/usr/share/doc/clustershell-*/examples/defaults.conf-rsh`` and could be |
| 997 |
copied to ``/etc/clustershell/defaults.conf`` or to an alternate path |
| 998 |
described above. Basically, the change consists in defining an alternate |
| 999 |
distant worker by Python module name as follows:: |
| 1000 |
|
| 1001 |
[task.default] |
| 1002 |
distant_workername: Rsh |
| 1003 |
|
| 1004 |
|
| 1005 |
.. _defaults-config-slurm: |
| 1006 |
|
| 1007 |
Use case: Slurm |
| 1008 |
^^^^^^^^^^^^^^^ |
| 1009 |
|
| 1010 |
If your cluster naming scheme has multiple dimensions, as in ``node-93-02``, we |
| 1011 |
recommend that you disengage some nD folding when using Slurm, which is |
| 1012 |
currently unable to detect some multidimensional node indexes when not |
| 1013 |
explicitly enclosed with square brackets. |
| 1014 |
|
| 1015 |
To do so, define ``fold_axis`` to -1 in the :ref:`defaults-config` so that nD |
| 1016 |
folding is only computed on the last axis (seems to work best with Slurm):: |
| 1017 |
|
| 1018 |
[nodeset] |
| 1019 |
fold_axis: -1 |
| 1020 |
|
| 1021 |
That way, node sets computed by ClusterShell tools can be passed to Slurm |
| 1022 |
without error. |
| 1023 |
|
| 1024 |
Since this only affects how node sets are folded for display, you may also fold |
| 1025 |
along a single axis per invocation with the ``--axis`` option of |
| 1026 |
:ref:`nodeset <nodeset-tool>`, :ref:`cluset <cluset-tool>` and |
| 1027 |
:ref:`clush <clush-axis>`, instead of setting ``fold_axis`` here. |
| 1028 |
|
| 1029 |
.. _ConfigParser: https://docs.python.org/3/library/configparser.html |
| 1030 |
.. _nodeset: https://xcat-docs.readthedocs.io/en/stable/guides/admin-guides/references/man8/nodeset.8.html |
| 1031 |
.. _sys.prefix: https://docs.python.org/3/library/sys.html#sys.prefix |