Ejemplo n.º 1
0
    def test_start_creates_thread_scoped_tracer(self):
        # Arrange nothing
        driver = Driver(*self.init_args)

        # Act
        driver.start()

        # Assert
        self.thread_scoped_tracer.start.assert_called_once_with()
Ejemplo n.º 2
0
    def test_stop_stops_thread_scoped_tracer(self):
        # Arrange
        driver = Driver(*self.init_args)
        driver.start()

        # Act
        driver.stop()

        # Assert
        self.thread_scoped_tracer.stop.assert_called_once_with()
Ejemplo n.º 3
0
class Trace(object):
    def __init__(self, base_path, callback):
        self.async_publisher = AsyncPublisher(callback)
        self.model = ObservableModel(self.async_publisher)

        entity_id_generator = EntityIdGenerator(base_path)
        modeling_orchestrator = Orchestrator(base_path, self.model)
        self.dynamic_modeling_driver = DynamicModelingDriver(self,
                                                     entity_id_generator,
                                                     modeling_orchestrator)

    def start(self):
        self.async_publisher.start()
        self.dynamic_modeling_driver.start()

    def stop(self):
        self.dynamic_modeling_driver.stop()
        self.async_publisher.stop()