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 for Kedro Viz Connection Error #1507

Merged
merged 33 commits into from
Sep 11, 2023
Merged

Conversation

ravi-kumar-pilla
Copy link
Contributor

@ravi-kumar-pilla ravi-kumar-pilla commented Aug 29, 2023

Description

Resolves #1277

Development notes

  • Start Fast API server using multiprocessing similar to jupyter launcher with/without --autoreload option
  • Wait for server to start before opening web browser

Resolved_Connection_Error

QA notes

  • Checkout branch fix/connection-error
  • Build frontend using make build
  • Build backend using pip install -e package
  • cd demo-project, execute command kedro viz or kedro viz --autoreload
  • Browser window should open after FAST API server is started and the browser should not dispay a connection error

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

ravi-kumar-pilla and others added 27 commits August 28, 2023 22:15
…1499)

* add stats to data node

* lint and format check fix

* fix pytests

* fix layout issue

* fix transcoded data stats

Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
* initial draft for python 3.11 support

* update release doc

* add python warnings for e2e tests

* modify e2e test

* modify e2e test

* test by removing lower req scenario

* skip e2e tests for lower bound requirement on python 3.11

* skip e2e tests for lower bound requirement on python 3.11

* remove print statements

---------

Co-authored-by: Nok Lam Chan <nok_lam_chan@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
* initial draft for python 3.11 support

* update release doc

* add python warnings for e2e tests

* modify e2e test

* modify e2e test

* test by removing lower req scenario

* skip e2e tests for lower bound requirement on python 3.11

* skip e2e tests for lower bound requirement on python 3.11

* remove python upperbounds initial draft

* fix lint and format errors

* test remove upperbound warning

* test lowerbound pandas install

* revert back pandas requirement

* bump lower requirements for pandas

* remove upper bound clean up

* update release notes

* fix PR comments

---------

Co-authored-by: Nok Lam Chan <nok_lam_chan@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
* Fix: Adding favicon to Kedro Demo

* Fix: Change in approach for serving favicon

* Lint error fix

* Lint error fix

* Favicon endpoint test added

* Favicon endpoint test added

* Lint error fixed

* Fix: Adding favicon to Kedro Demo

Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com>

* Fix: Change in approach for serving favicon

Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com>

* Lint error fix

Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com>

* Lint error fix

Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com>

* Favicon endpoint test added

Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com>

* Favicon endpoint test added

Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com>

* Lint error fixed

Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com>

* Fixed favicon endpoint test

* Release doc updated

* Update RELEASE.md

Co-authored-by: rashidakanchwala <37628668+rashidakanchwala@users.noreply.github.com>

* Removed pytest.fixture as per review comment

---------

Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com>
Co-authored-by: rashidakanchwala <37628668+rashidakanchwala@users.noreply.github.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
* v6.5.0

* release

* update-reminder-content

* update reminder

Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
@ravi-kumar-pilla ravi-kumar-pilla marked this pull request as ready for review August 31, 2023 21:41
Copy link
Contributor

@noklam noklam left a comment

Choose a reason for hiding this comment

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

Leave a small comment. So to check with my understanding, the main change here is moving the start_browser from run_server to the cli, and the run_server only handle the backend process.

I have a quick question, why multiprocessing is needed?

@@ -175,7 +116,7 @@ def run_viz(port: int = None, local_ns: Dict[str, Any] = None) -> None:
viz_process.start()
_VIZ_PROCESSES[port] = viz_process

_wait_for(func=_check_viz_up, host=host, port=port)
wait_for(func=check_viz_up, host=host, port=port)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason to change from private function to public one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Earlier these functions were inside jupyter.py and used only by jupyter, now it is also used in cli launcher. so moved it to a utils file and these functions are now used in both places

Copy link
Contributor

Choose a reason for hiding this comment

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

I see they are now shared among two modules, but I think it should be an internal method _wait_for instead of wait_for.

For example, we have similar internal utils here:
https://github.com/kedro-org/kedro/blob/edbbcc7f7a863b7c980f9efcaa444e2fa01f45fa/kedro/config/common.py#L209

Changing from _wait_for -> wait_for singals this is a public function. (though in reality 99% people are using kedro-viz as an appllication but not a module). So this is just to keep things clean internally for ourselves.

https://stackoverflow.com/questions/1301346/what-is-the-meaning-of-single-and-double-underscore-before-an-object-name

Comment on lines 146 to 147
if browser:
start_browser(host, port)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏼

@ravi-kumar-pilla
Copy link
Contributor Author

Leave a small comment. So to check with my understanding, the main change here is moving the start_browser from run_server to the cli, and the run_server only handle the backend process.

Yes, I have moved the start_browser logic out of run_server as run_server should just focus on starting the FAST API server.

I have a quick question, why multiprocessing is needed?

So, earlier we used to start the browser without waiting for backend server to start. Now if one process is used to start the server, there should be another process which can wait for the server to start and then start a browser (This can also be done using threading, but since we were using multiprocessing in jupyter already, I thought of using the same in cli launcher as well. )

@noklam noklam self-requested a review September 6, 2023 16:19
Copy link
Contributor

@noklam noklam left a comment

Choose a reason for hiding this comment

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

I've experienced this issue, definitely an improvement for UX. Great fix, thanks!

@tynandebold tynandebold removed the request for review from yetudada September 7, 2023 15:08
Copy link
Contributor

@rashidakanchwala rashidakanchwala left a comment

Choose a reason for hiding this comment

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

LGTM. thanks :)

Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
@ravi-kumar-pilla ravi-kumar-pilla merged commit 335be7d into main Sep 11, 2023
20 checks passed
@ravi-kumar-pilla ravi-kumar-pilla deleted the fix/connection-error branch September 11, 2023 19:17
@tynandebold tynandebold mentioned this pull request Oct 10, 2023
5 tasks
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.

Browser launches too soon, causing a connection error
5 participants