blob: fe623ca32fc4751ecba757c65beed432be7bdc7c [file] [log] [blame]
Tony Mack79a49c82013-06-15 23:51:57 -04001import threading
Tony Mackb4cf1002014-04-29 12:26:12 -04002import time
Sapan Bhatia757e0b62013-09-02 16:55:00 -04003from observer.event_loop import PlanetStackObserver
4from observer.event_manager import EventListener
Tony Mackb4cf1002014-04-29 12:26:12 -04005from util.logger import Logger, logging
Sapan Bhatia254198c2015-01-23 16:17:12 +00006from model_policy import run_policy
Tony Mackb4cf1002014-04-29 12:26:12 -04007
8logger = Logger(level=logging.INFO)
Tony Mack79a49c82013-06-15 23:51:57 -04009
10class Backend:
11
12 def run(self):
Tony Mackb4cf1002014-04-29 12:26:12 -040013 # start the openstack observer
14 observer = PlanetStackObserver()
15 observer_thread = threading.Thread(target=observer.run)
16 observer_thread.start()
17
Sapan Bhatia254198c2015-01-23 16:17:12 +000018 # start model policies thread
19 model_policy_thread = threading.Thread(target=run_policy)
20 model_policy_thread.start()
21
Tony Mackb4cf1002014-04-29 12:26:12 -040022 # start event listene
23 event_manager = EventListener(wake_up=observer.wake_up)
24 event_manager_thread = threading.Thread(target=event_manager.run)
25 event_manager_thread.start()
Tony Mack79a49c82013-06-15 23:51:57 -040026