Skip to content

Commit

Permalink
FIX #105 - Remove deprecated pipeline_ml and MlflowDataSet
Browse files Browse the repository at this point in the history
  • Loading branch information
Galileo-Galilei committed Oct 31, 2020
1 parent 34a4c4f commit 9e3359e
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 79 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

### Removed

- `kedro mlflow init` command is no longer declaring hooks in `run.py`. You must now [register your hooks manually](docs/source/03_tutorial/02_setup.md#declaring-kedro-mlflow-hooks) in the ``run.py`` (kedro > 0.16.0), ``.kedro.yml`` (kedro >= 0.16.5) or ``pyproject.toml`` (kedro >= 0.16.5) [](https://github.com/Galileo-Galilei/kedro-mlflow/issues/70)
- `kedro mlflow init` command is no longer declaring hooks in `run.py`. You must now [register your hooks manually](docs/source/03_tutorial/02_setup.md#declaring-kedro-mlflow-hooks) in the ``run.py`` (kedro > 0.16.0), ``.kedro.yml`` (kedro >= 0.16.5) or ``pyproject.toml`` (kedro >= 0.16.5) ([#62](https://github.com/Galileo-Galilei/kedro-mlflow/issues/62))
- Remove `pipeline_ml` function which was deprecated in 0.3.0. It is now replaced by `pipeline_ml_factory` ([#105](https://github.com/Galileo-Galilei/kedro-mlflow/issues/105))
- Remove `MlflowDataSet` dataset which was deprecated in 0.3.0. It is now replaced by `MlflowArtifactDataSet` ([#105](https://github.com/Galileo-Galilei/kedro-mlflow/issues/105))

## [0.3.0] - 2020-10-11

Expand Down
2 changes: 1 addition & 1 deletion kedro_mlflow/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .mlflow_dataset import MlflowArtifactDataSet, MlflowDataSet
from .mlflow_dataset import MlflowArtifactDataSet
from .mlflow_metrics_dataset import MlflowMetricsDataSet
27 changes: 0 additions & 27 deletions kedro_mlflow/io/mlflow_dataset.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from typing import Any, Dict, Union
from warnings import warn

import mlflow
from kedro.io import AbstractVersionedDataSet
Expand Down Expand Up @@ -90,29 +89,3 @@ def _describe(self) -> Dict[str, Any]: # pragma: no cover
and consequently does not implements abtracts methods
"""
pass


class MlflowDataSet(MlflowArtifactDataSet):
def __new__(
cls,
data_set: Union[str, Dict],
run_id: str = None,
artifact_path: str = None,
credentials: Dict[str, Any] = None,
):
deprecation_msg = (
"'MlflowDataSet' is now deprecated and "
"has been renamed 'MlflowArtifactDataSet' "
"in 'kedro-mlflow>=0.3.0'. "
"\nPlease change your 'catalog.yml' entries accordingly, "
"since 'MlflowDataSet' will be removed in next release."
)

warn(deprecation_msg, DeprecationWarning, stacklevel=2)
super().__new__(
cls=cls,
data_set=data_set,
run_id=run_id,
artifact_path=artifact_path,
credentials=credentials,
)
2 changes: 1 addition & 1 deletion kedro_mlflow/pipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
KedroMlflowPipelineMLInputsError,
KedroMlflowPipelineMLOutputsError,
)
from .pipeline_ml_factory import pipeline_ml, pipeline_ml_factory
from .pipeline_ml_factory import pipeline_ml_factory
22 changes: 0 additions & 22 deletions kedro_mlflow/pipeline/pipeline_ml_factory.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pathlib import Path
from typing import Any, Dict, Optional, Union
from warnings import warn

from kedro.pipeline import Pipeline
from mlflow.models import ModelSignature
Expand Down Expand Up @@ -73,24 +72,3 @@ def pipeline_ml_factory(
model_signature=model_signature,
)
return pipeline


def pipeline_ml(
training: Pipeline,
inference: Pipeline,
input_name: str = None,
conda_env: Optional[Union[str, Path, Dict[str, Any]]] = None,
model_name: Optional[str] = "model",
) -> PipelineML:

deprecation_msg = (
"'pipeline_ml' is now deprecated and "
"has been renamed 'pipeline_ml_factory' "
"in 'kedro-mlflow>=0.3.0'. "
"\nPlease change your 'pipeline.py' or 'hooks.py' entries "
"accordingly, since 'pipeline_ml' will be removed in next release."
)

warn(deprecation_msg, DeprecationWarning, stacklevel=2)

return pipeline_ml_factory(training, inference, input_name, conda_env, model_name)
9 changes: 1 addition & 8 deletions tests/io/test_mlflow_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from mlflow.tracking import MlflowClient
from pytest_lazyfixture import lazy_fixture

from kedro_mlflow.io import MlflowArtifactDataSet, MlflowDataSet
from kedro_mlflow.io import MlflowArtifactDataSet


@pytest.fixture
Expand Down Expand Up @@ -159,10 +159,3 @@ def test_is_versioned_dataset_logged_correctly_in_mlflow(tmp_path, tracking_uri,
assert df1.equals(mlflow_csv_dataset.load()) # and must loadable

mlflow.end_run()


def test_raise_deprecation_warning_mlflow_dataset():
with pytest.deprecated_call():
MlflowDataSet(
data_set=dict(type="pandas.CSVDataSet", filepath="fake/path/to/file.csv"),
)
20 changes: 1 addition & 19 deletions tests/pipeline/test_pipeline_ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
KedroMlflowPipelineMLDatasetsError,
KedroMlflowPipelineMLInputsError,
KedroMlflowPipelineMLOutputsError,
pipeline_ml,
pipeline_ml_factory,
)
from kedro_mlflow.pipeline.pipeline_ml import PipelineML
Expand Down Expand Up @@ -76,23 +75,6 @@ def pipeline_ml_with_tag(pipeline_with_tag):
return pipeline_ml_with_tag


def test_raise_deprecation_warning_pipeline_ml(pipeline_with_tag):
with pytest.deprecated_call():
pipeline_ml(
training=pipeline_with_tag,
inference=Pipeline(
[
node(
func=predict_fun,
inputs=["model", "data"],
outputs="predictions",
)
]
),
input_name="data",
)


@pytest.fixture
def pipeline_ml_with_intermediary_artifacts():
full_pipeline = Pipeline(
Expand Down Expand Up @@ -381,7 +363,7 @@ def test_too_many_free_inputs():
with pytest.raises(
KedroMlflowPipelineMLInputsError, match="No free input is allowed"
):
pipeline_ml(
pipeline_ml_factory(
training=Pipeline(
[
node(
Expand Down

0 comments on commit 9e3359e

Please sign in to comment.