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

Clicking on a dataset node in kedro-viz doesn't navigate to code when the dataset is defined as dataset factory #122

Open
2 tasks done
Calychas opened this issue Sep 23, 2024 · 6 comments
Labels
feature Improvement of existing feature or new feature javascript Pull requests that update Javascript code Python Pull requests that update Python code

Comments

@Calychas
Copy link

Calychas commented Sep 23, 2024

Description

Clicking on a dataset node in kedro-viz doesn't navigate to code.

Steps to Reproduce

In my case

  1. Run kedro-viz via the extension
  2. Click on dataset node that is defined by dataset factory

Checklist

  • Have you read the "Requirements" section already?
  • Have you make sure you are running the extension with the correct virtual environment? Cmd + P and Python: Select Interpeter

Expected Result

Navigated to the code

Actual Result

Nothing happens and errors in logs:

2024-09-23 13:45:42.369 [info] [Trace - 13:45:42] Sending request 'workspace/executeCommand - (4)'.
2024-09-23 13:45:42.437 [info] [Trace - 13:45:42] Received response 'workspace/executeCommand - (4)' in 68ms. Request failed: AttributeError: 'NoneType' object has no attribute 'text_document' (-32603).
2024-09-23 13:45:42.437 [info] [Error - 13:45:42] Request workspace/executeCommand failed.
2024-09-23 13:45:42.437 [info]   Message: AttributeError: 'NoneType' object has no attribute 'text_document'
  Code: -32603 
[object Object]

Your Environment

  • Kedro version used (pip show kedro or kedro -V): 0.19.8
  • Kedro VSCode version used: v0.2.0 (pre-release)
  • Python version used (python -V): Python 3.10.11
  • Operating system and version: Mac OS M2, Sonoma 14.6.1
@noklam
Copy link
Contributor

noklam commented Sep 23, 2024

@Calychas Thanks for trying this in pre-release already! Does clicking on any nodes lead to navigation? Or is it a specific type of nodes? Try clicking on a dataset, or a function node.

Can I also ask what's the path of that pipeline/node file stored?

@noklam noklam added the bug Something isn't working label Sep 23, 2024
@noklam
Copy link
Contributor

noklam commented Sep 23, 2024

Saying this because we have a rather simple logic to search for functions:
filePattern = '**/pipelines/**/*.py';

@Calychas
Copy link
Author

Calychas commented Sep 24, 2024

@noklam hey! Functions actually work -> it navigates me to the code.

It turns out I have only problems with datasets -> nothing happens (no navigation)

Can I also ask what's the path of that pipeline/node file stored?
Could find a dataset node on which the navigation works. An example of one where it doesn't:

"{group_class}.payload_raw":
  type: json.JSONDataset
  filepath: data/01_raw/{group_class}/model_payload_{group_class}.json
  metadata:
    kedro-viz:
      layer: raw

@Calychas
Copy link
Author

I think I managed to pinpoint the issue -> dataset factories

Specifying it this way fixes navigation:

na.payload_raw:
  type: json.JSONDataset
  filepath: data/01_raw/na/model_payload_na.json
  metadata:
    kedro-viz:
      layer: raw

@noklam
Copy link
Contributor

noklam commented Sep 24, 2024

@Calychas Thanks for reporting! factory indeed is not working yet since it is not "explicitly" defined in catalog. I have idea how to add support for dataset factory.

I will update the issue to reflect this is a specific issue about Dataset Factory and make it a feature request, hope that is fine!

@noklam noklam added feature Improvement of existing feature or new feature and removed bug Something isn't working labels Sep 24, 2024
@noklam noklam changed the title Clicking on a node in kedro-viz doesn't navigate to code. Clicking on a dataset node in kedro-viz doesn't navigate to code when the dataset is defined as dataset factory Sep 24, 2024
@noklam
Copy link
Contributor

noklam commented Sep 24, 2024

My current idea is keeping existing resolution logic, but add a new factory pattern logic.

  1. Search for exact match, since this has higher priority
  2. If not found, try to match pattern to see if it matches any pattern

Alternatively:
The extension can eagerly resolve all the pattern (a tricky part here is the resolution logic depends on the pipeline, maybe we can assume default as a starting point). Then the rest is just mapping which dataset was generated from pattern, and re-direct the dataset definition to the pattern entry.

@noklam noklam moved this to Todo in Kedro VS Code Sep 25, 2024
@jitu5 jitu5 added javascript Pull requests that update Javascript code Python Pull requests that update Python code labels Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Improvement of existing feature or new feature javascript Pull requests that update Javascript code Python Pull requests that update Python code
Projects
No open projects
Status: Todo
Development

No branches or pull requests

3 participants