Package emma :: Module complement :: Class Complement
[hide private]
[frames] | no frames]

Class Complement

source code

Empty class mented to be inhered by interface and module

It handles the configuration, identifier and locker.

There will be some useful variables:

Instance Methods [hide private]
 
__init__(self, identifier, conf, db) source code
 
run(self)
The starting method of the complement
source code
 
log(self, msg, level=logging.INFO)
Output a log string
source code
 
update_db(self)
Update database
source code
Method Details [hide private]

__init__(self, identifier, conf, db)
(Constructor)

source code 
Parameters:
  • identifier (string) - complement unique identifier, on interface it is use for the Event invocation
  • conf (dictionary) - the configuration of the module as {item: value}
  • db (database collection (mongoDB)) - the database collection of the complement

run(self)

source code 

The starting method of the complement

Each interface or module should define here the initialization, subscribe to events, the periodic actions, ...

log(self, msg, level=logging.INFO)

source code 

Output a log string

If loggin activated prompts on standard output the string adding to it "[complement_name identifier] ". Uses emma.logger.log().

Parameters:
  • msg (string) - the text to output
  • level (logging level) - default logging.INFO

update_db(self)

source code 

Update database

Stores the emma version on the collection of the complement. And returns the old version from the database and the actual version of emma.

Returns:
(old version, new version)

Note: That is meant to be use for updating the database structure of the complement.