Make event waiting/notification generic
diff --git a/planetstack/ec2_observer/event_loop.py b/planetstack/ec2_observer/event_loop.py
index 12e88ab..caabd1e 100644
--- a/planetstack/ec2_observer/event_loop.py
+++ b/planetstack/ec2_observer/event_loop.py
@@ -49,16 +49,16 @@
else:
self.driver = NoOpDriver()
- def wait_for_event(self, timeout):
- self.event_cond.acquire()
- self.event_cond.wait(timeout)
- self.event_cond.release()
+ def wait_for_event(self, timeout, cond=self.event_cond):
+ cond.acquire()
+ cond.wait(timeout)
+ cond.release()
- def wake_up(self):
+ def wake_up(self, cond=self.event_cond):
logger.info('Wake up routine called. Event cond %r'%self.event_cond)
- self.event_cond.acquire()
- self.event_cond.notify()
- self.event_cond.release()
+ cond.acquire()
+ cond.notify()
+ cond.release()
def load_sync_step_modules(self, step_dir=None):
if step_dir is None: