def test_pipeline_server_config_change():

    _dir = os.path.dirname(os.path.abspath(__file__))

    source_cfg = {
        "uri": os.path.join(_dir, "./avsource/test2-cam-person1.mkv")
    }

    config_manager.set(Config({"pipelines": {"test": [{"source": "test"}]}}))

    srv = PipelineServerEv(config_manager.get_pipelines())
    srv.start()

    config_manager.get().add_callback(srv.trigger_event)
    config_manager.get_sources().set("test", source_cfg)
    # the callback will restart the process
    assert srv.triggered
Ejemplo n.º 2
0
def test_config_getters():

    config_manager.stop()
    config_manager.CONFIG_FILE = 'test-config2.yaml'
    _dir = os.path.dirname(os.path.abspath(__file__))
    config_manager.load(_dir)

    assert config_manager.get_ai_models() is not None
    assert config_manager.get_ai_model("image_detection") is not None

    assert config_manager.get_sources() is not None
    assert config_manager.get_source("front_door_camera") is not None

    assert config_manager.get_data_dir() is not None
Ejemplo n.º 3
0
def save(source_id, source):
    """Save source configuration information"""
    log.info("Saving source_id=%s", source_id)
    source = validate(source_id, source)
    config_manager.get_sources().set(source["id"], source)
    return config_manager.get_source(source["id"]).to_values()
Ejemplo n.º 4
0
def remove(source_id):
    """Remove source by id"""
    log.info("Removing source_id=%s", source_id)
    get(source_id)
    del config_manager.get_sources()[source_id]