Miscellaneous

class wishbone.config.configfile.ConfigFile(filename, logstyle, loglevel=6, identification='wishbone', colorize_stdout=True)[source]

Generates a wishbone.router configuration object used to initialize a wishbone router object.

This config generator has some tailered functionality which makes it suitable when bootstrapping from CLI.

It does following automatic configurations:

  • Initializes a wishbone.module.flow.funnel module called _logs which is connected to the _logs queue of all modules except if this module has already been connected in the bootstrap file.

  • Initializes a wishbone.module.flow.funnel module called _metrics which is connected to the _metrics queue of all modules except if this module has already been connected in the bootstrap file. The _metrics modules is by default not connected to any other modules. The effect of this is that all metrics are dropped unless the user connects a module for furhter processing the metrics.

  • Adds a wishbone.module.flow.queueselect module called _logs_filter responsible for dropping logs which log level do not correspond to the define --log-level

  • Adds either a wishbone.module.output.stdout called _logs_stdout module or wishbone.module.output.syslog module called _logs_syslog and connects this instance to _logs.outbox.

  • Initializes the following template functions and makes them available to each initialized module:

    - strftime()
    - env()
    - epoch()
    - version()
    
Parameters:
  • filename – The filename of the configuration to load.
  • logstyle – How logging should be setup. Possible options are: stdout and syslog.
  • loglevel – The loglevel for the router to use to use.
  • identification – A string which identifies the router instance
  • colorize_stdout – When True, colors each stdout printed logline using proper coloring.
addConnection(source_module, source_queue, destination_module, destination_queue)[source]

Adds connections between module queues.

Parameters:
  • source_module – The source module instance name
  • source_queue – The source module instance queue name
  • destination_module – The destination instance name
  • destination_queue – The destination instance queue name
addModule(name, module, arguments={}, description='', functions={}, protocol=None, event=False)[source]

Adds a module to the configuration.

Parameters:
  • name – The module instance name
  • module – The module name
  • arguments – The module variables
  • description – A description of the module instance
  • functions – The module functions
  • protocol – The protocol to apply to the module
  • event – Whether incoming or outgoing events need to be treated as full events.
addModuleFunction(name, function, arguments={})[source]

Adds a module function to the configuration.

Parameters:
  • name – The name of the function instance
  • function – The entry point name of the function
  • arguments – The arguments to initiate the function class.
addProtocol(name, protocol, arguments={})[source]

Adds a protocol to the configuration

Parameters:
  • name – The name of the protocol instance
  • protcol – The entry point name of the protocol
  • arguments – The arguments to initiate the protocol class.
addTemplateFunction(name, function, arguments={})[source]

Adds a template funtion to the configuration.

Parameters:
  • name – The name of the function instance
  • function – The entry point name of the function
  • arguments – The arguments to initiate the function class.
dump()[source]

Dumps the configuration as an EasyDict instance.

load(filename)[source]

Loads a YAML bootstrap file.

Parameters:filename – The filename to load.