def test_pipeline_server_heal(): conf = _get_config(_TestSourceElement3) server = PipelineServer(conf) assert len(server._pipelines) == 1 assert len(server._threaded_jobs) == 1 source_pe = server._pipelines[0]._pipe_elements[0] assert source_pe.state == pipeline.PIPE_STATE_STOPPED assert not server._threaded_jobs[0].is_alive() server.MAX_HEARTBEAT_INTERVAL = 1 server.start() source_pe._test_sample_released.wait(timeout=5) assert source_pe.state == pipeline.PIPE_STATE_RUNNING assert server._threaded_jobs[0].is_alive() server.healthcheck() assert source_pe._test_heal_called.wait(timeout=5) server.stop() assert source_pe.state == pipeline.PIPE_STATE_STOPPED assert not server._threaded_jobs[0].is_alive()
def test_pipeline_server_start_stop(): conf = _get_config(_TestSourceElement2) server = PipelineServer(conf) assert len(server._pipelines) == 1 assert len(server._threaded_jobs) == 1 source_pe = server._pipelines[0]._pipe_elements[0] assert source_pe.state == pipeline.PIPE_STATE_STOPPED assert not server._threaded_jobs[0].is_alive() server.start() source_pe._test_element_started.wait(timeout=3) assert source_pe.state == pipeline.PIPE_STATE_RUNNING assert server._threaded_jobs[0].is_alive() server.stop() # give it enough time to clean up resources # in child threads (if any). time.sleep(3) assert source_pe.state == pipeline.PIPE_STATE_STOPPED assert not server._threaded_jobs[0].is_alive()
def test_pipeline_server_start_stop(): _dir = os.path.dirname(os.path.abspath(__file__)) config_manager.set( Config({ "sources": { "test": { "uri": os.path.join(_dir, "./avsource/test2-cam-person1.mkv") } }, "pipelines": { "test": [{ "source": "test" }] } })) srv = PipelineServer(config_manager.get_pipelines()) srv.start() srv.stop()
def test_pipeline_server_start_stop(): _dir = os.path.dirname(os.path.abspath(__file__)) config.update({ "sources": { "test": { "uri": "file://" + os.path.join(_dir, "avsource/test2-cam-person1.mkv") } }, "pipelines": { "test": [{ "source": "test" }] } }) srv = PipelineServer(config) srv.start() srv.stop()
def test_pipeline_server_init(): conf = _get_config(_TestSourceElement) server = PipelineServer(conf) assert len(server._pipelines) == 1 assert len(server._threaded_jobs) == 1
def test_pipeline_server_config_change(): conf = _get_config(_TestSourceElement2) server = PipelineServer(conf) del conf['pipelines']["pipeline_one"][0]