Beispiel #1
0
 def configure_eventbus(self, enabled):
     if enabled:
         if not EventBus.instance:
             EventBus.create(f"{self.working_dir}/_events")
             EventBus.start()
     else:
         EventBus.shutdown()
Beispiel #2
0
Datei: mcp.py Projekt: Yelp/Tron
 def configure_eventbus(self, enabled):
     if enabled:
         if not EventBus.instance:
             EventBus.create(f"{self.working_dir}/_events")
             EventBus.start()
     else:
         EventBus.shutdown()
Beispiel #3
0
    def test_setup_eventbus_dir(self, time):
        os.rmdir(self.logdir.name)

        time.time = mock.Mock(return_value=1.0)
        eb = EventBus.create(self.logdir.name)
        assert os.path.exists(self.logdir.name)
        assert os.path.exists(os.path.join(self.logdir.name, "current"))

        time.time = mock.Mock(return_value=2.0)
        eb.event_log = {'foo': 'bar'}
        eb.sync_save_log("test")

        new_eb = EventBus.create(self.logdir.name)
        new_eb.sync_load_log()
        assert new_eb.event_log == eb.event_log
Beispiel #4
0
 def setup(self):
     self.log_dir = tempfile.TemporaryDirectory(prefix="tron_eventbus_test")
     self.eventbus = EventBus.create(self.log_dir.name)
     self.eventbus.enabled = True