concurrent.core.config.config module
Config Sybsystem. Features hot reloading of configs and propagation
within the environment
-
exception concurrent.core.config.config.BaseConfigError(message, title=None, show_traceback=False)[source]
Bases: concurrent.core.exceptions.baseerror.BaseError
Base error class for config related errors
-
title = '[Config Error]'
-
class concurrent.core.config.config.ConfigHandle(filename)[source]
Bases: object
Config parser that represents a config handle (file or memory).
-
conditional_parse()[source]
Will parse the filename in case some has been changed. Takes in account any config
file this one is based on!
-
defaults()[source]
Return dictionary of default values
-
get(section, name, default='')[source]
Get a config item from a section. If no value is specified return default.
-
get_bool(section, name, default='')[source]
Get an item as a bool value.
-
get_int(section, name, default='')[source]
Get an item as an integer value.
-
get_path(section, name, default='')[source]
get an item as an absolute path
-
getlist(section, name, default='', sep=', ', trim_empty=True)[source]
Get a list of an list-like item
-
has_item(section, name)[source]
return True if the specified item exists in the section
-
is_file_valid()[source]
returns true if the current config file is valid or not
-
items(section)[source]
Return a list of (name, value) tuples for every item in the
specified section.
-
remove(section, name)[source]
remove an item
-
save()[source]
Save current sections and items. This will make them persisten!
-
sections()[source]
get a list of section names from our self and any one we’re based on
-
set(section, name, value)[source]
Set a value. Needs to be saved to be persistent!
-
stamp()[source]
Stamps the LastModified time on the file
-
class concurrent.core.config.config.ConfigSection(config, name)[source]
Bases: object
Objects that represents a config section
-
config
-
get(name, default='')[source]
Get a plain item value
-
get_bool(name, default='')[source]
Return the value of the specified item as bool.
-
get_float(name, default='')[source]
Return the value of the specified item as float.
@raise BaseConfigError: if value is not an float
-
get_host(name, default='localhost:80')[source]
Get a host tuple in form of (host,port)
-
get_int(name, default='')[source]
Return the value of the specified item as integer.
@raise BaseConfigError: if value is not an integer
-
get_list(name, default='', sep='|', trim_empty=False)[source]
Return a list of values that are separated by default with ‘|’.
trim_empty can be used to trim empty elements.
-
get_path(name, default='')[source]
Get the relative path of the file from where the item was reed:
-
items()[source]
Return items in form of (name, value) tuples.
-
name
-
overridden
-
set(name, value)[source]
Change a config value. Needs to be saved before it will be persistent.
-
class concurrent.core.config.config.ConfigItem(section_name, item_name, default_value=None, doc_string='')[source]
Bases: object
A config item is a (name,value) pair in a section uded by a config handle
-
access_method(name, default='')
We have to register every new item instance in our class member holder, so it’s globally accessable
-
reg_dict = {('pickler', 'aes_padding'): <IntItem [pickler] "aes_padding">, ('ZMQTaskScheduler', 'backend_port'): <IntItem [ZMQTaskScheduler] "backend_port">, ('ZMQTaskScheduler', 'frontend_port'): <IntItem [ZMQTaskScheduler] "frontend_port">, ('pickler', 'secret'): <ConfigItem [pickler] "secret">, ('ZMQTaskManager', 'num_workers'): <IntItem [ZMQTaskManager] "num_workers">, ('GenericTaskManager', 'num_workers'): <IntItem [GenericTaskManager] "num_workers">, ('pickler', 'protocol'): <IntItem [pickler] "protocol">, ('ZMQTaskManager', 'master_backend_port'): <HostItem [ZMQTaskManager] "master_backend_port">, ('pickler', 'num_iterations'): <IntItem [pickler] "num_iterations">, ('generictaskscheduler', 'strategy'): <ExtensionPointItem [generictaskscheduler] "strategy">, ('pickler', 'salt_size'): <IntItem [pickler] "salt_size">}
-
class concurrent.core.config.config.BoolItem(section_name, item_name, default_value=None, doc_string='')[source]
Bases: concurrent.core.config.config.ConfigItem
Boolean item
-
access_method(name, default='')
Return the value of the specified item as bool.
-
class concurrent.core.config.config.IntItem(section_name, item_name, default_value=None, doc_string='')[source]
Bases: concurrent.core.config.config.ConfigItem
Integer item
-
access_method(name, default='')
Return the value of the specified item as integer.
@raise BaseConfigError: if value is not an integer
-
class concurrent.core.config.config.PathItem(section_name, item_name, default_value=None, doc_string='')[source]
Bases: concurrent.core.config.config.ConfigItem
An item representing a aboslute path
-
access_method(name, default='')
Get the relative path of the file from where the item was reed:
-
class concurrent.core.config.config.ListItem(section, name, default=None, sep=', ', keep_empty=False, doc='')[source]
Bases: concurrent.core.config.config.ConfigItem
A list
-
accessor(section, name, default)[source]
-
class concurrent.core.config.config.ExtensionPointItem(section, name, interface, default=None, doc='')[source]
Bases: concurrent.core.config.config.ConfigItem
Item that represents an extension point