-
Notifications
You must be signed in to change notification settings - Fork 113
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 MemoryDataSet
not displaying on metadata panel
#1113
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like the right fix to me but is exactly what @deepyaman tried here and apparently didn't solve it? #1093 (comment)
modifying https://github.com/kedro-org/kedro-viz/blob/v5.1.1/package/kedro_viz/data_access/repositories/catalog.py#L59 to
dataset_obj = MemoryDataSet()
causes the flicker regardless of whether or not theMemoryDataSet
is explicitly defined in the catalog.
dataset_obj = None | ||
# if dataset has no catalog entry, it is a MemoryDataSet | ||
if not dataset_obj: | ||
dataset_obj = MemoryDataSet() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this any different from the below? Can dataset_obj
ever evaluate to false if the exception doesn't get thrown?
dataset_obj = None | |
# if dataset has no catalog entry, it is a MemoryDataSet | |
if not dataset_obj: | |
dataset_obj = MemoryDataSet() | |
dataset_obj = MemoryDataSet() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it work's if you just add it in the exception. the reason why it flickered was because filepath is none for MemoryDataSets and it is a required field in DataNodeMetaDataResponseAPI which now I have made Optional.
I will make the above change :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with this. Yeah, I just didn't understand/get to finding what was happening with the validation error, but this solves it.
@@ -2,8 +2,9 @@ | |||
centralise access to Kedro data catalog.""" | |||
# pylint: disable=missing-class-docstring,missing-function-docstring,protected-access | |||
from typing import Dict, Optional | |||
from joblib import Memory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from joblib import Memory |
|
||
X_train: | ||
type: MemoryDataSet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
X_train: | |
type: MemoryDataSet |
I guess we can revert it?
@@ -55,8 +56,9 @@ def get_dataset(self, dataset_name: str) -> Optional[AbstractDataSet]: | |||
dataset_obj = self._catalog._get_dataset(dataset_name, suggest=False) | |||
else: # pragma: no cover | |||
dataset_obj = self._catalog._get_dataset(dataset_name) | |||
# if dataset has no catalog entry, it is a MemoryDataSet | |||
except DataSetNotFoundError: # pragma: no cover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if this should be covered in tests, given that it does make a functional difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, i will write the tests now !
@@ -55,8 +56,9 @@ def get_dataset(self, dataset_name: str) -> Optional[AbstractDataSet]: | |||
dataset_obj = self._catalog._get_dataset(dataset_name, suggest=False) | |||
else: # pragma: no cover | |||
dataset_obj = self._catalog._get_dataset(dataset_name) | |||
# if dataset has no catalog entry, it is a MemoryDataSet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think this is bordering on a redundant comment (the code seems really self-explanatory), but I suppose one could argue that it adds a bit of value. Not strong feelings, just a hunch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
MemoryDataSet
not displaying on metadata panel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's working nicely. Great job!
Description
Resolves #1093
Development notes
@deepyaman , @tynandebold -- I have made an attempt to fix this issue at the backend. Let me know if this is good approach.
Basically, in the kedro-viz backend we add datasets to the node based on the catalog entries. If there's no catalog entry for a dataset, we just leave it blank. I have fixed this part by adding MemoryDataSet() to a dataset without any catalog entry.
Also MemoryDataSets don't have any file path which was a sort of required field in the ResponseAPI for DataNodes (which is why u got the pydantic error), so I have made that optional.
QA notes
I will add the necessary tests once everyone's ok with this fix.
Checklist
RELEASE.md
file