def get_mlflow_config(context: KedroContext):
    try:
        conf_mlflow_yml = context.config_loader.get("mlflow*", "mlflow*/**")
    except MissingConfigException:
        raise KedroMlflowConfigError(
            "No 'mlflow.yml' config file found in environment. Use ``kedro mlflow init`` command in CLI to create a default config file."
        )
    conf_mlflow = KedroMlflowConfig(context.project_path)
    conf_mlflow.from_dict(conf_mlflow_yml)
    return conf_mlflow
Exemplo n.º 2
0
def get_mlflow_config(session: Optional[KedroSession] = None):
    session = session or get_current_session()
    context = session.load_context()
    try:
        conf_mlflow_yml = context.config_loader.get("mlflow*", "mlflow*/**")
    except MissingConfigException:
        raise KedroMlflowConfigError(
            "No 'mlflow.yml' config file found in environment. Use ``kedro mlflow init`` command in CLI to create a default config file."
        )
    conf_mlflow = KedroMlflowConfig(context.project_path)
    conf_mlflow.from_dict(conf_mlflow_yml)
    return conf_mlflow
Exemplo n.º 3
0
def test_from_dict_to_dict_idempotent(mocker, kedro_project_with_mlflow_conf):
    mocker.patch("mlflow.tracking.MlflowClient", return_value=None)
    mocker.patch(
        "kedro_mlflow.framework.context.config.KedroMlflowConfig._get_or_create_experiment",
        return_value=None,
    )

    config = KedroMlflowConfig(project_path=kedro_project_with_mlflow_conf)
    original_config_dict = config.to_dict()
    # modify config
    config.from_dict(original_config_dict)
    assert config.to_dict() == original_config_dict
Exemplo n.º 4
0
def get_mlflow_config(project_path=None, env="local"):
    if project_path is None:
        project_path = Path.cwd()
    project_path = Path(project_path)
    conf_paths = [
        str(project_path / "conf" / "base"),
        str(project_path / "conf" / env),
    ]
    config_loader = ConfigLoader(conf_paths=conf_paths)
    conf_mlflow_yml = config_loader.get("mlflow*", "mlflow*/**")
    conf_mlflow = KedroMlflowConfig(project_path=project_path)
    conf_mlflow.from_dict(conf_mlflow_yml)
    return conf_mlflow
Exemplo n.º 5
0
def get_mlflow_config(context: KedroContext):

    conf_mlflow_yml = context.config_loader.get("mlflow*", "mlflow*/**")
    conf_mlflow = KedroMlflowConfig(context.project_path)
    conf_mlflow.from_dict(conf_mlflow_yml)
    return conf_mlflow