summaryrefslogtreecommitdiff
path: root/oslo_messaging/opts.py
diff options
context:
space:
mode:
authorMehdi Abaakouk <sileht@redhat.com>2015-07-18 14:32:34 +0200
committerMehdi Abaakouk <sileht@redhat.com>2015-07-20 15:37:16 +0200
commitd94d6d6892291b195649d1a9666cc6b49b39a7a4 (patch)
tree72d7d2fdaba268ac40e47908e69384ecb587eaf1 /oslo_messaging/opts.py
parent10bc6244aa8a31a610a4cc7180dcf7772d6ff17e (diff)
downloadoslo-messaging-d94d6d6892291b195649d1a9666cc6b49b39a7a4.tar.gz
Allows to change defaults opts
This change introduces to possibility for the consumer application to change the default oslo.messaging config options. Same API interface as oslo.db have been taken. The first option is executor_thread_pool_size. This option was called rpc_thread_pool_size, but because it's used by notification and rpc 'executor_thread_pool_size' looks a better name. Changing executor_thread_pool_size default will be useful for ceilometer the default of 64 is really to small to consume many notifications at once for batching them. When is clearly sufficient for rpc stuffs. Change-Id: Iea0d7a72e38d27c600403c815258aa5eee0d0c8c
Diffstat (limited to 'oslo_messaging/opts.py')
-rw-r--r--oslo_messaging/opts.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/oslo_messaging/opts.py b/oslo_messaging/opts.py
index 1f065b5..267b7ec 100644
--- a/oslo_messaging/opts.py
+++ b/oslo_messaging/opts.py
@@ -76,3 +76,23 @@ def list_opts():
:returns: a list of (group_name, opts) tuples
"""
return [(g, copy.deepcopy(o)) for g, o in _opts]
+
+
+def set_defaults(conf, executor_thread_pool_size=None):
+ """Set defaults for configuration variables.
+
+ Overrides default options values.
+
+ :param conf: Config instance specified to set default options in it. Using
+ of instances instead of a global config object prevents conflicts between
+ options declaration.
+ :type conf: oslo.config.cfg.ConfigOpts instance.
+
+ :keyword executor_thread_pool_size: Size of executor thread pool.
+ :type executor_thread_pool_size: int
+ :default executor_thread_pool_size: None
+
+ """
+ if executor_thread_pool_size is not None:
+ conf.set_default('executor_thread_pool_size',
+ executor_thread_pool_size)