Merge branch 'master' of git.planet-lab.org:/git/plstackapi
diff --git a/planetstack/openstack/event_manager.py b/planetstack/openstack/event_manager.py
index d7102b6..a849f09 100644
--- a/planetstack/openstack/event_manager.py
+++ b/planetstack/openstack/event_manager.py
@@ -7,7 +7,7 @@
import os
import base64
-import fofum
+from fofum import Fofum
# decorator that marks dispatachable event methods
def event(func):
@@ -102,13 +102,17 @@
class EventListener:
def __init__(self,wake_up=None):
self.handler = EventHandler()
- self.wake_up = wake_up()
+ self.wake_up = wake_up
def handle_event(self, payload):
payload_dict = json.loads(payload)
- event = payload_dict['event']
- ctx = payload_dict['ctx']
- self.handler.dispatch(event,**ctx)
+
+ # The code below will come back when we optimize the observer syncs
+ # into 'small' and 'big' syncs.
+
+ #event = payload_dict['event']
+ #ctx = payload_dict['ctx']
+ #self.handler.dispatch(event,**ctx)
if (self.wake_up):
self.wake_up()
diff --git a/planetstack/openstack/observer.py b/planetstack/openstack/observer.py
index dce26aa..fbacb67 100644
--- a/planetstack/openstack/observer.py
+++ b/planetstack/openstack/observer.py
@@ -8,8 +8,8 @@
from core.models import *
from django.db.models import F, Q
from openstack.manager import OpenStackManager
-from util.logger import Logger, logging
-from timeout import timeout
+from util.logger import Logger, logging, logger
+#from timeout import timeout
logger = Logger(logfile='observer.log', level=logging.INFO)
@@ -27,6 +27,7 @@
self.event_cond.release()
def wake_up(self):
+ logger.info('Wake up routine called. Event cond %r'%self.event_cond)
self.event_cond.acquire()
self.event_cond.notify()
self.event_cond.release()
@@ -36,16 +37,18 @@
return
while True:
try:
+ logger.info('Observer run loop')
#self.sync_roles()
+ logger.info('Calling sync tenants')
self.sync_tenants()
self.sync_users()
self.sync_user_tenant_roles()
self.sync_slivers()
self.sync_sliver_ips()
+ logger.info('Calling sync external routes')
self.sync_external_routes()
-
- self.wait_for_event(timeout=30)
-
+ self.wait_for_event(timeout=300)
+ logger.info('Observer woken up')
except:
traceback.print_exc()