Fallback to default kernel if none specified.#860
Conversation
|
Just bumping this! |
|
Bump |
|
Sorry for the direct ping @Borda - this has been sitting for a month and this issue is blocking us. Any chance we can get a review? |
|
Sorry to direct ping someone else - @rgbkrk |
|
Can you rebase? This branch is out of date for me to merge. I promise I'll come back 😬 |
d629ec9 to
e914a95
Compare
|
@rgbkrk rebased! |
|
Alright so I'm looking at this with fresh eyes now. This is a major breaking change to the API. I would have to make a major release just for this. What is stopping your system from setting the appropriate metadata in the notebook format? |
|
We check in our notebooks to git, and they execute in many different environments, one of which is dagstermill in a "production" setup. There will always be skew for the specifics of the kernel name. For example, on developer machines, it could be arbitrary based on the venv name, and that will certainly not match the production environment. We therefore strip the kernel metadata from the notebook when we check it in, so every environment can run it in whichever kernel they feel is appropriate. This also prevents lots of churn when multiple people with different settings edit a notebook, which causes endless merge conflicts within git. I don't think we are the only ones who have adopted this solution, because this pre-commit hook seems to be pretty widely used to me: https://github.com/srstevenson/nb-clean Our production environment which runs papermill has only one kernel available, so falling back to the default kernel would be the behavior which makes the most sense for our use case. I think that the specific issue we face about kernel mismatched names is the same issue faced by the poster in #338 |
|
Also it's not my project so my opinion on semantic versioning is fairly meaningless, but for what it's worth from my understanding, I think this would be a minor version change, not a major one. Before this PR, papermill never ran notebooks that did not have a version specified, rejecting them as invalid. This PR adds support to execute them by using the default executor, if available. Because it does not break existing supported flows and only adds a new one, I think it would be a minor version change (e.g. for |
|
Thanks for that context. That helps. I really hate the mess that is arbitrary kernels per venv rather than having the notebook presume to use the current venv/project from the directory its in. I'm working on a notebook app that handles that in nteract/desktop but it doesn't solve every single place people run notebooks (VS Code, Jupyterlab, classic, etc.) I think I'll want to take your perspectives into account there too. You've still got language info in the notebook metadata right? Just double checking as then we can rely on the default language kernel matching up with the stated language of the notebook. |
|
I'm still seeing merge conflicts with |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #860 +/- ##
==========================================
- Coverage 91.54% 91.17% -0.38%
==========================================
Files 17 17
Lines 1621 1632 +11
==========================================
+ Hits 1484 1488 +4
- Misses 137 144 +7
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
We are being overly aggressive by raising an error if a kernel cannot be detected in a notebook. In an environment with only one kernel installed, the notebook executes just fine without errors, and we should not prematurely raise an error.
e914a95 to
e12aafd
Compare
|
Rebased again! |
|
Thank you for spending so much time thinking about our use case. The pre-commit hook we use also strips language out. It's not the reason we started using it, but is a consequence of the tool we use. Because we're only running with one kernel available, falling back to the default language for that kernel is the preferred behavior, but I'm sure we could try to figure out how to modify that pre-commit hook if for some reason that was not possible. |
|
I'll have to ship this tomorrow or sometime this week after looking at everything else we've been up to as well. |
We are being overly aggressive by raising an error if a kernel cannot be detected in a notebook. In an environment with only one kernel installed, the notebook executes just fine without errors, and we should not prematurely raise an error.
Fixes #338