blob: a26ddfde87825fd311d1e8730abfff5c42825ad8 [file] [log] [blame]
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04001import threading
2import time
Scott Baker286a78f2015-02-18 16:13:48 -08003from ec2_observer.event_loop import XOSObserver
Sapan Bhatia26d40bc2014-05-12 15:28:02 -04004from ec2_observer.event_manager import EventListener
5from util.logger import Logger, logging
6
7logger = Logger(level=logging.INFO)
8
9class Backend:
10
11 def run(self):
12 try:
13 # start the openstack observer
Scott Baker286a78f2015-02-18 16:13:48 -080014 observer = XOSObserver()
Sapan Bhatia26d40bc2014-05-12 15:28:02 -040015 observer_thread = threading.Thread(target=observer.run)
16 observer_thread.start()
17
18 # start event listene
19 event_manager = EventListener(wake_up=observer.wake_up)
20 event_manager_thread = threading.Thread(target=event_manager.run)
21 event_manager_thread.start()
22 except:
23 logger.log_exc("Exception in child thread")
24