1- import { injectable , inject , named , optional } from 'inversify' ;
1+ import { injectable , inject , named } from 'inversify' ;
22import { EventEmitter , Uri , CancellationToken , l10n } from 'vscode' ;
33import { generateUuid as uuid } from '../../../platform/common/uuid' ;
4- import { IConfigurationService , IExtensionContext , IOutputChannel } from '../../../platform/common/types' ;
4+ import { IExtensionContext , IOutputChannel } from '../../../platform/common/types' ;
55import { IExtensionSyncActivationService } from '../../../platform/activation/types' ;
66import { logger } from '../../../platform/logging' ;
77import { DeepnoteEnvironmentStorage } from './deepnoteEnvironmentStorage.node' ;
88import { CreateDeepnoteEnvironmentOptions , DeepnoteEnvironment } from './deepnoteEnvironment' ;
9- import {
10- IDeepnoteEnvironmentManager ,
11- IDeepnoteServerProvider ,
12- IDeepnoteServerStarter ,
13- IDeepnoteToolkitInstaller
14- } from '../types' ;
9+ import { IDeepnoteEnvironmentManager , IDeepnoteServerStarter } from '../types' ;
1510import { Cancellation } from '../../../platform/common/cancellation' ;
1611import { STANDARD_OUTPUT_CHANNEL } from '../../../platform/common/constants' ;
17- import { IJupyterRequestAgentCreator , IJupyterRequestCreator } from '../../jupyter/types' ;
1812
1913/**
2014 * Manager for Deepnote kernel environments.
@@ -27,23 +21,14 @@ export class DeepnoteEnvironmentManager implements IExtensionSyncActivationServi
2721
2822 private environments : Map < string , DeepnoteEnvironment > = new Map ( ) ;
2923 private environmentServers : Map < string , Uri [ ] > = new Map ( ) ;
30- // private serversByFile: Map<string, DeepnoteServerInfo> = new Map();
31- private tmpStartingServers : Map < string , boolean > = new Map ( ) ;
3224 private readonly _onDidChangeEnvironments = new EventEmitter < void > ( ) ;
3325 public readonly onDidChangeEnvironments = this . _onDidChangeEnvironments . event ;
3426 private initializationPromise : Promise < void > | undefined ;
3527
3628 constructor (
3729 @inject ( IExtensionContext ) private readonly context : IExtensionContext ,
3830 @inject ( DeepnoteEnvironmentStorage ) private readonly storage : DeepnoteEnvironmentStorage ,
39- @inject ( IDeepnoteToolkitInstaller ) private readonly toolkitInstaller : IDeepnoteToolkitInstaller ,
4031 @inject ( IDeepnoteServerStarter ) private readonly serverStarter : IDeepnoteServerStarter ,
41- @inject ( IDeepnoteServerProvider ) private readonly serverProvider : IDeepnoteServerProvider ,
42- @inject ( IJupyterRequestCreator ) private readonly requestCreator : IJupyterRequestCreator ,
43- @inject ( IJupyterRequestAgentCreator )
44- @optional ( )
45- private readonly requestAgentCreator : IJupyterRequestAgentCreator | undefined ,
46- @inject ( IConfigurationService ) private readonly configService : IConfigurationService ,
4732 @inject ( IOutputChannel ) @named ( STANDARD_OUTPUT_CHANNEL ) private readonly outputChannel : IOutputChannel
4833 ) { }
4934
@@ -193,106 +178,6 @@ export class DeepnoteEnvironmentManager implements IExtensionSyncActivationServi
193178 logger . info ( `Deleted environment: ${ config . name } (${ id } )` ) ;
194179 }
195180
196- // /**
197- // * Start the Jupyter server for an environment
198- // */
199- // // public async startServer(id: string, token?: CancellationToken): Promise<void> {
200- // public async startServer(id: string, deepnoteFileUri: Uri, token?: CancellationToken): Promise<void> {
201- // const config = this.environments.get(id);
202- // if (!config) {
203- // throw new Error(`Environment not found: ${id}`);
204- // }
205-
206- // this.tmpStartingServers.set(id, true);
207- // this._onDidChangeEnvironments.fire();
208-
209- // try {
210- // logger.info(`Ensuring server is running for environment: ${config.name} (${id})`);
211-
212- // // First ensure venv is created and toolkit is installed
213- // const { pythonInterpreter, toolkitVersion } = await this.toolkitInstaller.ensureVenvAndToolkit(
214- // config.pythonInterpreter,
215- // config.venvPath,
216- // token
217- // );
218-
219- // // Install additional packages if specified
220- // if (config.packages && config.packages.length > 0) {
221- // await this.toolkitInstaller.installAdditionalPackages(config.venvPath, config.packages, token);
222- // }
223-
224- // // Start the Jupyter server (serverStarter is idempotent - returns existing if running)
225- // // IMPORTANT: Always call this to ensure we get the current server info
226- // // Don't return early based on config.serverInfo - it may be stale!
227- // const serverInfo = await this.serverStarter.startServer(
228- // pythonInterpreter,
229- // config.venvPath,
230- // id,
231- // deepnoteFileUri,
232- // token
233- // );
234-
235- // config.pythonInterpreter = pythonInterpreter;
236- // config.toolkitVersion = toolkitVersion;
237- // config.serverInfo = serverInfo;
238- // config.lastUsedAt = new Date();
239-
240- // await this.persistEnvironments();
241- // this._onDidChangeEnvironments.fire();
242-
243- // logger.info(`Server running for environment: ${config.name} (${id}) at ${serverInfo.url}`);
244- // } catch (error) {
245- // logger.error(`Failed to start server for environment: ${config.name} (${id})`, error);
246- // throw error;
247- // } finally {
248- // this.tmpStartingServers.delete(id);
249- // }
250- // }
251-
252- // /**
253- // * Stop the Jupyter server for an environment
254- // */
255- // // public async stopServer(id: string, token?: CancellationToken): Promise<void> {
256- // public async stopServer(deepnoteFileUri: Uri, token?: CancellationToken): Promise<void> {
257- // // const config = this.environments.get(id);
258- // // if (!config) {
259- // // throw new Error(`Environment not found: ${id}`);
260- // // }
261-
262- // // if (!config.serverInfo) {
263- // // logger.info(`No server running for environment: ${config.name} (${id})`);
264- // // return;
265- // // }
266-
267- // try {
268- // logger.info(`Stopping server for environment: ${deepnoteFileUri.fsPath}`);
269-
270- // await this.serverStarter.stopServer(deepnoteFileUri, token);
271-
272- // // config.serverInfo = undefined;
273-
274- // // await this.persistEnvironments();
275- // // this._onDidChangeEnvironments.fire();
276-
277- // logger.info(`Server stopped successfully for environment: ${deepnoteFileUri.fsPath}`);
278- // } catch (error) {
279- // logger.error(`Failed to stop server for environment: ${deepnoteFileUri.fsPath}`, error);
280- // throw error;
281- // }
282- // }
283-
284- // /**
285- // * Restart the Jupyter server for an environment
286- // */
287- // // public async restartServer(id: string, token?: CancellationToken): Promise<void> {
288- // public async restartServer(deepnoteFileUri: Uri, token?: CancellationToken): Promise<void> {
289- // logger.info(`Restarting server for environment: ${deepnoteFileUri.fsPath}`);
290- // await this.stopServer(deepnoteFileUri, token);
291- // Cancellation.throwIfCanceled(token);
292- // await this.startServer(deepnoteFileUri, token);
293- // logger.info(`Server restarted successfully for environment: ${deepnoteFileUri.fsPath}`);
294- // }
295-
296181 /**
297182 * Update the last used timestamp for an environment
298183 */
0 commit comments