Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: implement _exists for SharedMemoryDataset #4121

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Enhanced `OmegaConfigLoader` configuration validation to detect duplicate keys at all parameter levels, ensuring comprehensive nested key checking.
## Bug fixes and other changes
* Fixed bug where using dataset factories breaks with `ThreadRunner`.
* Fixed a bug where `SharedMemoryDataset.exists` would not call the underlying `MemoryDataset`.
* Fixed template projects example tests.
* Made credentials loading consistent between `KedroContext._get_catalog()` and `resolve_patterns` so that both us
e `_get_config_credentials()`
Expand All @@ -30,6 +31,7 @@
* [ethanknights](https://github.com/ethanknights)
* [Manezki](https://github.com/Manezki)
* [MigQ2](https://github.com/MigQ2)
* [Felix Scherz](https://github.com/felixscherz)

Check warning on line 34 in RELEASE.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Kedro.Spellings] Did you really mean 'Scherz'? Raw Output: {"message": "[Kedro.Spellings] Did you really mean 'Scherz'?", "location": {"path": "RELEASE.md", "range": {"start": {"line": 34, "column": 10}}}, "severity": "WARNING"}

# Release 0.19.8

Expand Down
5 changes: 5 additions & 0 deletions kedro/io/shared_memory_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ def save(self, data: Any) -> None:
def _describe(self) -> dict[str, Any]:
"""SharedMemoryDataset doesn't have any constructor argument to return."""
return {}

def _exists(self) -> bool:
if not self.shared_memory_dataset:
return False
return self.shared_memory_dataset.exists() # type: ignore[no-any-return]
6 changes: 6 additions & 0 deletions tests/io/test_shared_memory_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,9 @@ def test_saving_none(self, shared_memory_dataset):
def test_str_representation(self, shared_memory_dataset):
"""Test string representation of the dataset"""
assert "MemoryDataset" in str(shared_memory_dataset)

def test_exists(self, shared_memory_dataset, input_data):
"""Check that exists returns the expected values"""
assert not shared_memory_dataset.exists()
shared_memory_dataset.save(input_data)
assert shared_memory_dataset.exists()
Loading