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 Kedro Viz stays waiting even if no valid project was found #1793

Closed
wants to merge 9 commits into from

Conversation

rashidakanchwala
Copy link
Contributor

@rashidakanchwala rashidakanchwala commented Mar 5, 2024

Description

Resolves #1761

Development notes

Before we start running any of the viz processing, we first call the bootstrap_project(project_path) from kedro.framework.startup to ensure that we are running kedro viz run from a valid kedro project.

QA notes

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added new entries to the RELEASE.md file
  • Added tests to cover my changes

@rashidakanchwala rashidakanchwala marked this pull request as draft March 5, 2024 11:12
@rashidakanchwala rashidakanchwala changed the title Fix/wrong dir err handling Fix Kedro Viz stays waiting even if no valid project was found Mar 5, 2024
@rashidakanchwala rashidakanchwala marked this pull request as ready for review March 5, 2024 12:39
from kedro_viz.server import run_server

project_path = Path.cwd()

bootstrap_project(project_path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine but instead of showing an error stack trace, it would be nice to show a custom error message with the exception, something like -

# check if the project_path points to a valid Kedro Project
    try:
        bootstrap_project(project_path)
    except Exception as exc:
        display_cli_message(f"ERROR: Unable to start Kedro-Viz : {exc} ", "red")
        return

@@ -158,7 +164,6 @@ def run(
"extra_params": params,
}
if autoreload:
project_path = Path.cwd()
run_server_kwargs["project_path"] = project_path
run_process_kwargs = {
"path": project_path,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above process calls run_server -> load_and_populate_data -> load_data . In load_data we again call bootstrap_project (line 91) which is a duplicate call. Though I like the idea of having bootstrap_project inside data_loader which makes sense considering it loads metadata, we need to remove this if we go by the approach in this PR. For the dev mode we already have bootstrap_project(project_path) in server.py -> main at line 143

@rashidakanchwala
Copy link
Contributor Author

closing this for now. will work on this from #1796

@rashidakanchwala rashidakanchwala deleted the fix/wrong-dir-err-handling branch July 3, 2024 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kedro Viz stays waiting even if no valid project was found
2 participants