Skip to content

Commit e5e2285

Browse files
authored
chore(runtime-core): Add deepnote runtime-core dependency, and use it instead of existing implementation (#355)
* chore(dep): Update deepnote database integrations package * Reformat code * chore(runtime-core): Add deepnote runtime-core dependency, and use it instead of existing implementation * Refactor Deepnote server management to utilize a new mock child process helper - Introduced `createMockChildProcess` in `deepnoteTestHelpers.ts` for consistent mock process creation in tests. - Updated `DeepnoteLspClientManager` and `DeepnoteServerStarter` to include the mock process in server info. - Removed unnecessary `runtimeCoreServerInfo` from `ProjectContext` and adjusted related logic to use the new `serverInfo` structure. - Ensured all relevant tests are updated to reflect these changes, improving test reliability and maintainability. * Fix eslint error * Enhance Deepnote server stopping logic to handle missing project context - Added a warning log when no project context is found, preventing server stop attempts. - Updated the `stopServerForEnvironment` method to require a non-null project context, ensuring safer operation handling. * Refactor Deepnote server management to use fileKey instead of serverKey - Updated the DeepnoteServerStarter class to consistently use fileKey for managing pending operations and project contexts, improving clarity and reducing potential errors. - Adjusted logging messages to reflect the change, ensuring accurate information is logged during server operations. * Refactor DeepnoteServerStarter to remove port allocation logic - Eliminated the port allocation serialization logic from the DeepnoteServerStarter class, as it is now handled by the @deepnote/runtime-core's startServer method. - Updated related logging messages to reflect the changes in server startup processes. - Adjusted unit tests to focus on SQL environment variable gathering and lifecycle orchestration, removing tests related to port reservation. * Enhance DeepnoteServerStarter with output tracking and error reporting improvements - Introduced a new `serverOutputByFile` map to track stdout and stderr outputs for each server instance, limiting the output length to improve performance and manageability. - Updated error handling in the server startup process to capture and report both stdout and stderr in case of failures, providing better diagnostics. - Adjusted the `dispose` method to ensure all internal states, including the new output tracking, are cleared appropriately. - Enhanced unit tests to validate the new output tracking functionality and ensure proper handling of cancellation errors. * Update error handling in DeepnoteServerStarter to improve diagnostics - Modified the error reporting logic to ensure that stderr output is captured only when available, enhancing clarity in error messages. - This change aims to streamline the error handling process during server startup, providing more accurate feedback in case of failures. * Reformat code
1 parent 62a5275 commit e5e2285

10 files changed

Lines changed: 361 additions & 1014 deletions

package-lock.json

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,6 +2676,7 @@
26762676
"@deepnote/blocks": "^4.3.0",
26772677
"@deepnote/convert": "^3.2.0",
26782678
"@deepnote/database-integrations": "^1.4.3",
2679+
"@deepnote/runtime-core": "^0.2.0",
26792680
"@deepnote/sql-language-server": "^3.0.0",
26802681
"@enonic/fnv-plus": "^1.3.0",
26812682
"@jupyter-widgets/base": "^6.0.8",

src/kernels/deepnote/deepnoteLspClientManager.node.vscode.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { assert } from 'chai';
22
import { Uri } from 'vscode';
33

44
import { DeepnoteLspClientManager } from './deepnoteLspClientManager.node';
5+
import { createMockChildProcess } from './deepnoteTestHelpers.node';
56
import { IDisposableRegistry } from '../../platform/common/types';
67
import { PythonEnvironment } from '../../platform/pythonEnvironments/info';
78
import * as path from '../../platform/vscode-path/path';
@@ -84,7 +85,8 @@ suite('DeepnoteLspClientManager Integration Tests', () => {
8485
url: 'http://localhost:8888',
8586
jupyterPort: 8888,
8687
lspPort: 8889,
87-
token: 'test-token'
88+
token: 'test-token',
89+
process: createMockChildProcess()
8890
};
8991

9092
// This will attempt to start LSP clients but may fail if pylsp isn't installed
@@ -135,7 +137,8 @@ suite('DeepnoteLspClientManager Integration Tests', () => {
135137
url: 'http://localhost:8888',
136138
jupyterPort: 8888,
137139
lspPort: 8889,
138-
token: 'test-token'
140+
token: 'test-token',
141+
process: createMockChildProcess()
139142
};
140143

141144
try {
@@ -166,7 +169,8 @@ suite('DeepnoteLspClientManager Integration Tests', () => {
166169
url: 'http://localhost:8888',
167170
jupyterPort: 8888,
168171
lspPort: 8889,
169-
token: 'test-token'
172+
token: 'test-token',
173+
process: createMockChildProcess()
170174
};
171175

172176
try {

0 commit comments

Comments
 (0)