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

%run_viz Jupyter line magic inconsistency #1823

Open
1 task done
ravi-kumar-pilla opened this issue Mar 26, 2024 · 4 comments · May be fixed by #2267
Open
1 task done

%run_viz Jupyter line magic inconsistency #1823

ravi-kumar-pilla opened this issue Mar 26, 2024 · 4 comments · May be fixed by #2267
Assignees
Labels
Issue: Bug Report Python Pull requests that update Python code

Comments

@ravi-kumar-pilla
Copy link
Contributor

Description

Tried executing %run_viz line magic on Jupyter notebook to test --inlcude-hooks option, while the command gets passed appropriately, Open Viz link appears even before considering the flag. This shows, we are not terminating the previous session.

This inconsistency was also detected during #1733

Image

The image above is from a debug session using print statements placed at -

  1. run_viz function at kedro_viz/launchers/jupyter.py line 120
  2. checked if viz is up for the second run by placing a print statement at kedro_viz/launchers/jupyter.py line 133
  3. placed a print statement in load_data function at kedro_viz/integrations/kedro/data_loader.py line 99

Context

I am not an expert in using Jupyter notebook but when I execute %run_viz line magic with differing options, each execution box should take in the options before restarting the viz server. Currently, we check if the viz is up and we show the Open Kedro Viz link which has a stale session.

Steps to Reproduce

  1. Setup Kedro Viz and have a Kedro Project
  2. Execute kedro jupyter notebook
  3. Create a notebook and execute %run_viz
  4. It takes some time and gives you a link to open kedro viz
  5. Try executing %run_viz --ignore-hooks or any other option and debug it using print statements
  6. The link to open kedro viz appears instantly, without restarting the server with new arguments

Actual Result

Image

Your Environment

Include as many relevant details as possible about the environment you experienced the bug in:

  • Web browser system and version: Chrome/Safari
  • Operating system and version: macOS
  • NodeJS version used (if relevant):
  • Kedro version used (if relevant):
  • Python version used (if relevant):

Checklist

  • Include labels so that we can categorise your issue
@ravi-kumar-pilla ravi-kumar-pilla added Issue: Bug Report Python Pull requests that update Python code labels Mar 26, 2024
@ravi-kumar-pilla ravi-kumar-pilla moved this to Inbox in Kedro-Viz Mar 26, 2024
@rashidakanchwala rashidakanchwala moved this from Inbox to Backlog in Kedro-Viz Apr 8, 2024
@astrojuanlu
Copy link
Member

If we succeed in #1993, maybe %run_viz is not so important?

@ravi-kumar-pilla
Copy link
Contributor Author

If we succeed in #1993, maybe %run_viz is not so important?

Yes, it might be in future. As of now #1993 focusses on simple pipeline objects rather than full blown kedro project. Since we are injecting json data into the html, we need to consider -

  1. The html document size
  2. Performance issues considering the <script> tag which holds the json can block html rendering
  3. XSS - Embedding large json directly inside html is not recommended (serving via an API endpoint is ideal)

Thank you

@astrojuanlu
Copy link
Member

Let's check if this is still the case after #2052 was addressed in 10.1.0

@ravi-kumar-pilla
Copy link
Contributor Author

Hi Team,

The issue is still there but it is a quick fix (work from @SajidAlamQB fix) with run command

Issue still there in notebook as the fix was only added to kedro viz run

Image

I will raise a quick PR now (hopefully we can merge before release)
After fix:
Image

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Bug Report Python Pull requests that update Python code
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants