-
Notifications
You must be signed in to change notification settings - Fork 906
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
[Parent] - Notebook/IPython Debug line magic %load_node
feature discussion thread
#3535
Comments
As stretch goal a runner like |
This is actually a very cool idea - alternatively, instead of a notebook it could be a (pdb) session |
|
Context for Tech Design - 31/1/24Feature motivation - #1832To summarise, debugging Kedro projects in notebooks is a painful process. One of the suggestions to make this easier for users included the proposal of a Steps to test the MVP
The current implementationThe line magic currently will load any imports in the source file of the node, the node's inputs (assumed to be declared in the catalog), and the body of the node function. This serves as an excellent starting point, the implementation successfully resolves:
However, it does not account/allow for:
This brings us to the points of our discussion. What makes a complete feature?The focus of this discussion is to iron out the expectations for the first version of this feature, and possible future extensions. In this, there are four primary themes to consider. In this discussion, we must determine if a particular use case should be addressed now, later, much later, or never. Additionally, if something is to be done later, much later, or never, what will we do in the interim? Consider: Extending the current implementationSeveral edge cases are not handled by the line magic: 1. If a node input is a MemoryDatasetThe current implementation assumes all inputs exist in the catalogue, and running the cell that loads the node inputs will result in an error if the input is not defined in the catalog. We have several options when addressing this: a. Ignore it - expect users to understand the error. b. Add a comment to the imports block explaining the above. c. Resolve it with the line magic. 2. Node references an object defined within the source-file but outside of node scopeIncluding only imports and the node function means we don't have access to any helper functions defined inside the file but outside of the node function. Any references to these when the node function is loaded will result in an error. a. Ignore it - expect users to understand the error. b. Add 3. Return statements make unrunnable cellsWhen loading a node function, we omit the defining line. Including return statements then results in a syntax error when the cell is run. a. Ignore it - expect users to understand the error. b. Comment out the return statement
c. Comment out return statement and introduce print statement as replacement. Consider: Supporting Other Platforms#3510 Only supports jupyter lab/notebook. #3536 introduces support for
And if we choose not to support any platforms in the current iteration, how do we inform users? (Multiple selections allowed)
Consider: Supporting the node-finding process by making changes to the default node nameAs mentioned briefly above, node names are not required when defining a node, and are often omitted by users. However, the current implementation of the line magic searches for the specified by filtering the pipeline for matching node names, and so if the name is not defined, the We could address this by:
[Extra] Consider: The future of notebook debuggingThere were some suggestions for the future of this feature, for completeness I am listing them here
References: main PR: #3510, original discussion: #1832, experiments: #3568, related: #3575, #3536 |
My 2 cents: Extending the current implementation2c. Bringing the full contents of the corresponding file, including the function definitions themselves Supporting Other PlatformsFrankly I'd ignore The future of notebook debuggingI would say let's not bring back Having a |
Extending the current implementation
Supporting Other PlatformsFor a lot of these edge cases, as well as for other platforms, I think I'm OK with having some friction (and perhaps marking the feature as experimental for now). I think there's a risk of going too deep in this feature, without understanding how many people actually use it/how they use it. |
Tech Design SummaryNow (part of #3510):
Next:
Later
|
Sad I couldn't join the design meeting but this looks great - thanks @noklam for initial innovation which now feels like a tangible reality and also @AhdraMeraliQB for making the decisions made easy to grok! |
One salient point I just realized about unpacking the function body and transforming A silly example:
so However:
will nuke your filesystem. Could we reconsider my proposal above
? I think we never got to discuss it during the call (my fault, the conversation drifted exactly at that point and I forgot to bring it up) |
%load_node
thread and bug reports
%load_node
thread and bug reports%load_node
feature discussion thread
%load_node
feature discussion thread %load_node
feature discussion thread
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
Closing this as this is released in 0.19.3. Follow up improvement discussion will be document here: #3580 |
Description
This ticket is created to track and discuss the development of this feature.
What does this feature do?
In short, it tries to recreate the context of a pipeline error by eliminating manual steps as much as possible to provide better UX. It loads up the data, imports (and) function body in notebook cells, allowing user to quickly start debugging, plotting the data etc.
Tracked Tickets:
create line magic to debug a node in notebook workflow #3510 is the initial PR for the implementation
Refactor jupyter magic unit tests with conftest #3585
Document how users can debug Kedro inside notebooks using the %load_node magic #2011
Support
kedro ipython
for the debugging line magic #3536e2e-test for %load_node magic #3528 - Add e2e test, blocked by an issue that running notebook programatically yield different result.
Comments
I have collected some comments from a few users and these are some quotes categorised by themes.
IPython
Support more platform
Two-way sync
Recursive definition of function body
Edge Case improvement
The text was updated successfully, but these errors were encountered: