-
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
Deferred dependencies import into run_server #2060
Conversation
Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com>
Is it possible to extract load and populate data instead? That doesn't sound like something belong to server.py to start with. |
@noklam I started with that moved |
I think we can definitely move load data to a different file.
I might be missing some context here. I was in an impression that you created the file just to resolve the import errors. So suggested to move the imports within the function. We can do the refactoring as well. |
What would that look likes?
What's the reason for that? I am fine with the deferred approach but I think
include_hook also doesn't affect the data at all. This bundle the data for flowchart and the application itself (i.e. dataset preview).
|
Yes, I created the file just to resolve the import errors. |
80d35b6#diff-94c1c8a57783f10e120cb066fe8582a44e256679802723204e8b5b4d7fd8d6b4 |
I agree with you, there is definitely a room to refactor the server.py file and keep it only to run server. We do have a refactoring ticket here - #2061 and we can consider some refactor of server.py in this.
include_hook is used to create a NullPluginManager when we do KedroSession._hook_manager. Again, we can decouple and create more pure python functions. We can go ahead with deferred imports for now if it makes sense and you can add suggestion to #2061 or we can create a different ticket to refactor these as it might involve file changes in tests as well and other references and keep PRs small. Let me know what do you think Thank you |
Perfect, since there is a refactor ticket going on let's do the proper refactoring there. For now keeping this import deferred is sufficient. |
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.
As discussed in the comment, let's do this as deferred import and address the refactoring in a separate PR.
…on (#2049) * get_kedro_project_json_data function added Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com> * lint fix Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com> * Lint fix Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com> * Test fix Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com> * lint fix Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com> * Deferred dependencies import into run_server (#2060) * Load data functions move out of server Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com> * Refactor Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com> * Lint fix Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com> * lint fix Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com> --------- Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com> --------- Signed-off-by: Jitendra Gundaniya <jitendra_gundaniya@mckinsey.com> Co-authored-by: Nok Lam Chan <nok_lam_chan@mckinsey.com>
Description
Resolves kedro-org/vscode-kedro#72
#2049 To get current Kedro project JSON data required by Kedro-Viz React component when running inside VSCode, We introduce
get_kedro_project_json_data
function inresponses.py
which returns current Kedro project JSON data. But beforeget_kedro_project_json_data
we need to load and populate data withload_and_populate_data
method fromserver.py
To avoid ImportError when importing
load_and_populate_data
fromserver.py
in VSCode extension, Deferred dependencies likefsspec
,uvicorn
,multiprocessing
andwatchgod
insideRun_server
.Development notes
fsspec
,uvicorn
,multiprocessing
andwatchgod
insideRun_server
.Checklist
RELEASE.md
file