There are lots of places where some setup needs to happen before a
code block, and some action needs to happen afterwards:
- DBUpdatesBuffer: start/stop pusher thread, flush buffered updates
- AmpelLogger: flush buffered records
- AbsWorker and co: set current run id, clear cached unit instances
- AbsConsumer: subscribe/unsubscribe from queue
- AbsProducer: flush buffered messages
While all of these can be handled by try/finally blocks, this puts
onus on the user to clean up afterwards. Use context managers to
encapsulate these steps in the objects themselves.