Package ClusterShell :: Module Defaults :: Class Defaults
[hide private]
[frames] | no frames]

Class Defaults

source code


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 are initialized (like Task):

* stderr (boolean; default is ``False``) * stdout_msgtree (boolean; default is ``True``) * stderr_msgtree (boolean; default is ``True``) * engine (string; default is ``'auto'``) * port_qlimit (integer; default is ``100``) * 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``)

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. :ref:`defaults-config`). An example defaults.conf file should be included with ClusterShell. Remember that this could affect all applications using ClusterShell.

Instance Methods [hide private]
 
__init__(self, filenames)
Initialize Defaults from config filenames
source code
 
_parse_config(self, config)
parse config
source code
 
__getattr__(self, name)
Defaults attribute lookup
source code
 
__setattr__(self, name, value)
Defaults attribute assignment
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _TASK_DEFAULT = {'auto_tree': True, 'distant_workername': 'ssh...
  _TASK_DEFAULT_CONVERTERS = {'auto_tree': <unbound method Confi...
  _TASK_INFO = {'command_timeout': 0, 'connect_timeout': 10, 'de...
  _TASK_INFO_CONVERTERS = {'command_timeout': <unbound method Co...
  _TASK_INFO_PKEYS_BL = ['engine', 'print_debug']
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, filenames)
(Constructor)

source code 

Initialize Defaults from config filenames

Overrides: object.__init__

__setattr__(self, name, value)

source code 

Defaults attribute assignment

Overrides: object.__setattr__

Class Variable Details [hide private]

_TASK_DEFAULT

Value:
{'auto_tree': True,
 'distant_workername': 'ssh',
 'engine': 'auto',
 'local_workername': 'exec',
 'port_qlimit': 100,
 'stderr': False,
 'stderr_msgtree': True,
 'stdout_msgtree': True}

_TASK_DEFAULT_CONVERTERS

Value:
{'auto_tree': <unbound method ConfigParser.getboolean>,
 'distant_workername': <unbound method ConfigParser.get>,
 'engine': <unbound method ConfigParser.get>,
 'local_workername': <unbound method ConfigParser.get>,
 'port_qlimit': <unbound method ConfigParser.getint>,
 'stderr': <unbound method ConfigParser.getboolean>,
 'stderr_msgtree': <unbound method ConfigParser.getboolean>,
 'stdout_msgtree': <unbound method ConfigParser.getboolean>}

_TASK_INFO

Value:
{'command_timeout': 0,
 'connect_timeout': 10,
 'debug': False,
 'fanout': 64,
 'grooming_delay': 0.25,
 'print_debug': <function _task_print_debug at 0x1e1e050>}

_TASK_INFO_CONVERTERS

Value:
{'command_timeout': <unbound method ConfigParser.getfloat>,
 'connect_timeout': <unbound method ConfigParser.getfloat>,
 'debug': <unbound method ConfigParser.getboolean>,
 'fanout': <unbound method ConfigParser.getint>,
 'grooming_delay': <unbound method ConfigParser.getfloat>}