shellbot.observer module¶
-
class
shellbot.observer.
Observer
(engine=None)[source]¶ Bases:
multiprocessing.process.Process
Dispatches inbound records to downwards updaters
-
EMPTY_DELAY
= 0.005¶
-
process
(item)[source]¶ Handles one record or command
Parameters: item (str or object) – the record or command
-
run
()[source]¶ Continuously handle inbound records and commands
This function is looping on items received from the queue, and is handling them one by one in the background.
Processing should be handled in a separate background process, like in the following example:
observer = Observer(engine=my_engine) observer.start()
The recommended way for stopping the process is to change the parameter
general.switch
in the context. For example:engine.set('general.switch', 'off')
Alternatively, the loop is also broken when an exception is pushed to the queue. For example:
engine.fan.put(None)
-