Pre warm raw kernel daemons #11487
Conversation
* ipykernelInstaller: Add missing service Oops Typo Added tests Use separate class to manage kernel depedencies Ensure interrupt button is always enabled (#11461) Add collapsible sections to the bug issue template (#11462) Support ipywidgets in the kernel work (#11444) Ensure isolate script is passed as command arg when installing modules (#11447) Send LS version in static enabled/ready/startup events via lazy properties (#11448)
* master: Use separate class to manage kernel dependencies (#11472) Add ability to pass interpreter into kernel launcher (#11482) Use full path in argv to find interpreter matching a kernel (#11478) make sure we use our resource to get interpreter details (#11474) Handle failure to launch kernel while connecting (#11454) make raw kernel launch respect launching resource environment (#11463)
Codecov Report
@@ Coverage Diff @@
## master #11487 +/- ##
=======================================
Coverage 60.35% 60.35%
=======================================
Files 618 618
Lines 33751 33751
Branches 4762 4762
=======================================
Hits 20372 20372
Misses 12368 12368
Partials 1011 1011 Continue to review full report at Codecov.
|
* master: Track notebook/interactive start dates (#11484) Merging back from release to master. (#11488)
* master: Adds missing entries in the unittest ioc container for extract var tests (#11493) Add debugger package root api. (#11464) Replace word "browse" with "find" (#11460) Route python interpreter into kernel launcher (#11486)
| await daemonPool.preWarmKernelDaemons(); | ||
|
|
||
| // Verify we only created 2 daemons. | ||
| verify(pythonExecutionFactory.createDaemon(anything())).twice(); |
There was a problem hiding this comment.
This feels like you're understanding implementation details. Would it be better to just check that the daemonPool object has 2 daemons running?
There was a problem hiding this comment.
For that I need to expose the list, but i don't want to expose that list.
Its either expose the list for testing puproses or verify we called createDaemon twice.
There was a problem hiding this comment.
Maybe we need a team chat at some point about handling testing, especially post the testing talk that Graham gave? I'll confess to sometimes being a bit unsure about when I'm using verify in particular.
| let daemon = await daemonPool.get(workspace1, kernelSpec, interpreter1); | ||
| assert.equal(daemon, instance(daemon1)); | ||
| // Verify this daemon was pre-warmed. | ||
| verify(daemon1.preWarm()).atLeast(1); |
There was a problem hiding this comment.
preWarm [](start = 23, length = 7)
Same here, the daemon should have something to tell what state it is in. Like 'waiting for prewarm' or something. I think unit tests that know about internal details are brittle.
There was a problem hiding this comment.
Can expose a state, but thats only being used for testing purpose, which means we're adding API for testing alone (i.e. exposing internal test for testing purposes).
There was a problem hiding this comment.
Isn't that better than exposing the internal implementation details?
There was a problem hiding this comment.
FYI - prewarm is a public API.
| await daemonPool.preWarmKernelDaemons(); | ||
|
|
||
| // Verify we only created 2 daemons. | ||
| verify(pythonExecutionFactory.createDaemon(anything())).twice(); |
There was a problem hiding this comment.
createDaemon [](start = 38, length = 12)
Yeah I guess it seems bad to me to verify all of these objects by inspecting their internal algorithm.
There was a problem hiding this comment.
Same as above, we either expose a list of all created daemons for testing purposes or verify 2 were created.
I'm happy to go with the exposing of list for testing purposes if you're fine with that. However thats similar, as were exposing object internals for testing purposes.
There was a problem hiding this comment.
It's the difference between exposing private details and public. If we make the list (or maybe just the count) public, then we're committing to support that. Changes to this code later will know that it needs to keep that up to date. But if we change the internal details, we'll have to fix up a whole bunch of other stuff and these tests might not even work anymore.
Did you get a chance to read Grant's talk yet?
In reply to: 417633144 [](ancestors = 417633144)
There was a problem hiding this comment.
Did you get a chance to read Grant's talk yet?
Yes, guess need to put it into practice and be more disciplined.
* master: Support language servers that don't allow incremental doc updates (#11490)
| } | ||
|
|
||
| // Finally create if needed | ||
| let resource: Resource = options.identity; |
There was a problem hiding this comment.
Or this should use the actual resource that started the interactive window. I believe it used to. We might have messed it up when we created the notebook provider.
There was a problem hiding this comment.
Yes, but looking at the code I could'nt find this being provided. I'll file an issue to ensure we pass this into NotebookProvider.
Originally it wasn't required, then we started using identity for the wrong reason.
* master: Do not perform pipenv interpreter discovery on activation (#11369) Remove IJMPConnection and uses of it while maintaining same tests (#11503)
| suppressShutdownErrors(this.realKernel); | ||
| return this.realKernel.shutdown().then(() => this.kernelProcess.dispose()); | ||
| await this.kernelProcess.dispose(); | ||
| this.socket.dispose(); |
There was a problem hiding this comment.
@rchiodo @IanMatthewHuff Changed here as previous implementation would fall over.
We cannot call shutdown of the realKernel cuz it tries to make http call to jupyter.
There was a problem hiding this comment.
Yeah but it just fails silently. I thought it also set state on itself. This would mean we're not setting that state.
In reply to: 417673182 [](ancestors = 417673182)
|
Kudos, SonarCloud Quality Gate passed!
|
@rchiodo @IanMatthewHuff