Skip to content

Commit

Permalink
[FEATURE][KED-2577] Adds DeprecationWarning to Journal constructor (k…
Browse files Browse the repository at this point in the history
  • Loading branch information
jiriklein authored Apr 20, 2021
1 parent 39bfc28 commit d5f3327
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ print(pipelines["__default__"]) # pipeline loading is only triggered here
* Fixed error when using starter on Windows with Python 3.7 (Issue [#722](https://github.com/quantumblacklabs/kedro/issues/722))
* Fixed decoding error of config file that contains accented characters by opening config files for reading in UTF-8.
* Fixed an issue where `after_dataset_loaded` run would finish before a dataset is actually loaded when using `--async` flag.
* Added `DeprecationWarning` to `kedro.versioning.journal.Journal` as it will be removed in release 0.18.0.

## Minor breaking changes to the API

Expand Down
11 changes: 10 additions & 1 deletion kedro/versioning/journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import json
import logging
import subprocess
import warnings
from pathlib import Path
from typing import Any, Dict, Mapping, Optional, Union

Expand All @@ -47,8 +48,16 @@ def __init__(self, record_data: Dict[str, Any]):
Args:
record_data: JSON serializable dictionary specific to project context.
Raises:
DeprecationWarning
"""
warnings.warn(
"`Journal` is now deprecated and will be removed in Kedro 0.18.0."
"For more information, please visit "
"https://github.com/quantumblacklabs/kedro/blob/master/RELEASE.md",
DeprecationWarning,
)

self.run_id = record_data["run_id"]
record_data["git_sha"] = _git_sha(record_data["project_path"])
self._log_journal("ContextJournalRecord", record_data)
Expand Down
5 changes: 5 additions & 0 deletions tests/versioning/test_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ def test_log_catalog(self, tmp_path):
assert catalog_log["version"] == "fake_version"
assert catalog_log["run_id"] == context_log["run_id"]

def test_deprecation_warning(self, tmp_path):
record_data = {"run_id": "fake_id", "project_path": str(tmp_path)}
with pytest.warns(DeprecationWarning):
Journal(record_data)


def test_git_sha(tmp_path, mocker):
mocker.patch("subprocess.check_output", return_value="mocked_return".encode())
Expand Down

0 comments on commit d5f3327

Please sign in to comment.