Defaults

ClusterShell Defaults module.

Manage library defaults.

class ClusterShell.Defaults.Defaults(filenames)

Class used to manipulate ClusterShell defaults.

The following attributes may be read at any time and also changed programmatically, for most of them before ClusterShell objects (Task or NodeSet) are initialized.

NodeSet defaults:

  • fold_axis (tuple of axis integers; default is empty tuple ())

Task defaults:

  • stderr (boolean; default is False)
  • stdin (boolean; default is True)
  • stdout_msgtree (boolean; default is True)
  • stderr_msgtree (boolean; default is True)
  • engine (string; default is 'auto')
  • local_workername (string; default is 'exec')
  • distant_workername (string; default is 'ssh')
  • debug (boolean; default is False)
  • print_debug (function; default is internal)
  • fanout (integer; default is 64)
  • grooming_delay (float; default is 0.25)
  • connect_timeout (float; default is 10)
  • command_timeout (float; default is 0)

Engine defaults:

  • port_qlimit (integer; default is 100)

Example of use:

>>> from ClusterShell.Defaults import DEFAULTS
>>> from ClusterShell.Task import task_self
>>> # Change default distant worker to rsh (WorkerRsh)
... DEFAULTS.distant_workername = 'rsh'
>>> task = task_self()
>>> task.run("uname -r", nodes="cs[01-03]")
<ClusterShell.Worker.Rsh.WorkerRsh object at 0x1f4a410>
>>> list((str(msg), nodes) for msg, nodes in task.iter_buffers())
[('3.10.0-229.7.2.el7.x86_64', ['cs02', 'cs01', 'cs03'])]

The library default values of all of the above attributes may be changed using the defaults.conf configuration file, except for print_debug (cf. Library Defaults). An example defaults.conf file should be included with ClusterShell. Remember that this could affect all applications using ClusterShell.

ClusterShell.Defaults.DEFAULTS

Globally accessible Defaults object.