Skip to content

Commit

Permalink
Refactor into connection, session start, launch (#12951)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored Feb 28, 2023
1 parent 3390b9c commit e1152ca
Show file tree
Hide file tree
Showing 50 changed files with 141 additions and 135 deletions.
2 changes: 1 addition & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { IShowDataViewerFromVariablePanel } from './messageTypes';
import { Commands as DSCommands, CommandSource } from './platform/common/constants';
import { PythonEnvironment } from './platform/pythonEnvironments/info';
import { Channel } from './platform/common/application/types';
import { SelectJupyterUriCommandSource } from './kernels/jupyter/serverSelector';
import { SelectJupyterUriCommandSource } from './kernels/jupyter/connection/serverSelector';

export type CommandsWithoutArgs = keyof ICommandNameWithoutArgumentTypeMapping;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
// Licensed under the MIT License.

import { inject, injectable } from 'inversify';
import { IExtensionSyncActivationService } from '../../platform/activation/types';
import { IDisposableRegistry } from '../../platform/common/types';
import { noop } from '../../platform/common/utils/misc';
import { RemoteJupyterServerUriProviderError } from '../errors/remoteJupyterServerUriProviderError';
import { BaseError } from '../../platform/errors/types';
import { IJupyterConnection } from '../types';
import { IExtensionSyncActivationService } from '../../../platform/activation/types';
import { IDisposableRegistry } from '../../../platform/common/types';
import { noop } from '../../../platform/common/utils/misc';
import { RemoteJupyterServerUriProviderError } from '../../errors/remoteJupyterServerUriProviderError';
import { BaseError } from '../../../platform/errors/types';
import { IJupyterConnection } from '../../types';
import {
computeServerId,
createRemoteConnectionInfo,
extractJupyterServerHandleAndId,
generateUriFromRemoteProvider
} from './jupyterUtils';
} from '../jupyterUtils';
import {
IJupyterServerUri,
IJupyterServerUriStorage,
IJupyterSessionManager,
IJupyterSessionManagerFactory,
IJupyterUriProviderRegistration
} from './types';
} from '../types';

/**
* Creates IJupyterConnection objects for URIs and 3rd party handles/ids.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Licensed under the MIT License.

import { inject, injectable } from 'inversify';
import { traceWarning } from '../../platform/logging';
import { LiveRemoteKernelConnectionMetadata } from '../types';
import { extractJupyterServerHandleAndId } from './jupyterUtils';
import { traceWarning } from '../../../platform/logging';
import { LiveRemoteKernelConnectionMetadata } from '../../types';
import { extractJupyterServerHandleAndId } from '../jupyterUtils';
import {
IJupyterRemoteCachedKernelValidator,
IJupyterServerUriStorage,
IJupyterUriProviderRegistration,
ILiveRemoteKernelConnectionUsageTracker
} from './types';
} from '../types';

/**
* Used to verify remote jupyter connections from 3rd party URIs are still valid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,27 @@

import { inject, injectable, named } from 'inversify';
import { EventEmitter, Memento } from 'vscode';
import { JVSC_EXTENSION_ID } from '../../platform/common/constants';
import { JVSC_EXTENSION_ID } from '../../../platform/common/constants';

import { GLOBAL_MEMENTO, IDisposable, IDisposableRegistry, IExtensions, IMemento } from '../../platform/common/types';
import { swallowExceptions } from '../../platform/common/utils/decorators';
import * as localize from '../../platform/common/utils/localize';
import { noop } from '../../platform/common/utils/misc';
import { InvalidRemoteJupyterServerUriHandleError } from '../errors/invalidRemoteJupyterServerUriHandleError';
import {
GLOBAL_MEMENTO,
IDisposable,
IDisposableRegistry,
IExtensions,
IMemento
} from '../../../platform/common/types';
import { swallowExceptions } from '../../../platform/common/utils/decorators';
import * as localize from '../../../platform/common/utils/localize';
import { noop } from '../../../platform/common/utils/misc';
import { InvalidRemoteJupyterServerUriHandleError } from '../../errors/invalidRemoteJupyterServerUriHandleError';
import { JupyterUriProviderWrapper } from './jupyterUriProviderWrapper';
import { computeServerId, generateUriFromRemoteProvider } from './jupyterUtils';
import { computeServerId, generateUriFromRemoteProvider } from '../jupyterUtils';
import {
IJupyterServerUri,
IJupyterUriProvider,
IJupyterUriProviderRegistration,
JupyterServerUriHandle
} from './types';
} from '../types';

const REGISTRATION_ID_EXTENSION_OWNER_MEMENTO_KEY = 'REGISTRATION_ID_EXTENSION_OWNER_MEMENTO_KEY';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Licensed under the MIT License.

import * as vscode from 'vscode';
import { IDisposableRegistry } from '../../platform/common/types';
import * as localize from '../../platform/common/utils/localize';
import { IJupyterUriProvider, JupyterServerUriHandle, IJupyterServerUri } from './types';
import { IDisposableRegistry } from '../../../platform/common/types';
import * as localize from '../../../platform/common/utils/localize';
import { IJupyterUriProvider, JupyterServerUriHandle, IJupyterServerUri } from '../types';

/**
* This class wraps an IJupyterUriProvider provided by another extension. It allows us to show
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

import { inject, injectable, named } from 'inversify';
import { Memento, Uri } from 'vscode';
import { IExtensionSyncActivationService } from '../../platform/activation/types';
import { GLOBAL_MEMENTO, IDisposableRegistry, IMemento } from '../../platform/common/types';
import { noop } from '../../platform/common/utils/misc';
import { LiveRemoteKernelConnectionMetadata } from '../types';
import { computeServerId } from './jupyterUtils';
import { IJupyterServerUriEntry, IJupyterServerUriStorage, ILiveRemoteKernelConnectionUsageTracker } from './types';
import { IExtensionSyncActivationService } from '../../../platform/activation/types';
import { GLOBAL_MEMENTO, IDisposableRegistry, IMemento } from '../../../platform/common/types';
import { noop } from '../../../platform/common/utils/misc';
import { LiveRemoteKernelConnectionMetadata } from '../../types';
import { computeServerId } from '../jupyterUtils';
import { IJupyterServerUriEntry, IJupyterServerUriStorage, ILiveRemoteKernelConnectionUsageTracker } from '../types';

export const mementoKeyToTrackRemoveKernelUrisAndSessionsUsedByResources = 'removeKernelUrisAndSessionsUsedByResources';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { inject, injectable, named } from 'inversify';
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-require-imports */
import cloneDeep from 'lodash/cloneDeep';
import { Memento, Uri } from 'vscode';
import { traceVerbose } from '../../platform/logging';
import { getDisplayPath } from '../../platform/common/platform/fs-paths';
import { IMemento, GLOBAL_MEMENTO, ICryptoUtils } from '../../platform/common/types';
import { sendTelemetryEvent, Telemetry } from '../../telemetry';
import { traceVerbose } from '../../../platform/logging';
import { getDisplayPath } from '../../../platform/common/platform/fs-paths';
import { IMemento, GLOBAL_MEMENTO, ICryptoUtils } from '../../../platform/common/types';
import { sendTelemetryEvent, Telemetry } from '../../../telemetry';

export const ActiveKernelIdList = 'Active_Kernel_Id_List';
// This is the number of kernel ids that will be remembered between opening and closing VS code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

import { inject, injectable } from 'inversify';
import { Disposable } from 'vscode';
import { IExtensionSyncActivationService } from '../platform/activation/types';
import { disposeAllDisposables } from '../platform/common/helpers';
import { IDisposable, IDisposableRegistry } from '../platform/common/types';
import { noop } from '../platform/common/utils/misc';
import { IJupyterServerUriStorage } from './jupyter/types';
import { IKernel, IKernelProvider, isRemoteConnection } from './types';
import { IExtensionSyncActivationService } from '../../../platform/activation/types';
import { disposeAllDisposables } from '../../../platform/common/helpers';
import { IDisposable, IDisposableRegistry } from '../../../platform/common/types';
import { noop } from '../../../platform/common/utils/misc';
import { IJupyterServerUriStorage } from '../types';
import { IKernel, IKernelProvider, isRemoteConnection } from '../../types';

const INTERVAL_IN_SECONDS_TO_UPDATE_MRU = 60_000;
@injectable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,43 @@

import { inject, injectable } from 'inversify';
import { EventEmitter, QuickPickItem, ThemeIcon, Uri } from 'vscode';
import { IApplicationShell, IClipboard, IWorkspaceService } from '../../platform/common/application/types';
import { traceDecoratorError, traceError, traceWarning } from '../../platform/logging';
import { DataScience } from '../../platform/common/utils/localize';
import { IApplicationShell, IClipboard, IWorkspaceService } from '../../../platform/common/application/types';
import { traceDecoratorError, traceError, traceWarning } from '../../../platform/logging';
import { DataScience } from '../../../platform/common/utils/localize';
import {
IMultiStepInputFactory,
IMultiStepInput,
InputStep,
IQuickPickParameters,
InputFlowAction
} from '../../platform/common/utils/multiStepInput';
import { capturePerfTelemetry, sendTelemetryEvent } from '../../telemetry';
import { Telemetry } from '../../telemetry';
} from '../../../platform/common/utils/multiStepInput';
import { capturePerfTelemetry, sendTelemetryEvent } from '../../../telemetry';
import { Telemetry } from '../../../telemetry';
import {
IJupyterUriProvider,
IJupyterUriProviderRegistration,
IJupyterServerUriStorage,
JupyterServerUriHandle,
IJupyterServerUriEntry
} from './types';
import { IDataScienceErrorHandler } from '../errors/types';
} from '../types';
import { IDataScienceErrorHandler } from '../../errors/types';
import {
IConfigurationService,
IDisposableRegistry,
IFeaturesManager,
IsWebExtension,
KernelPickerType
} from '../../platform/common/types';
} from '../../../platform/common/types';
import {
handleExpiredCertsError,
handleSelfCertsError,
computeServerId,
generateUriFromRemoteProvider
} from './jupyterUtils';
} from '../jupyterUtils';
import { JupyterConnection } from './jupyterConnection';
import { JupyterSelfCertsError } from '../../platform/errors/jupyterSelfCertsError';
import { RemoteJupyterServerConnectionError } from '../../platform/errors/remoteJupyterServerConnectionError';
import { JupyterSelfCertsExpiredError } from '../../platform/errors/jupyterSelfCertsExpiredError';
import { JupyterSelfCertsError } from '../../../platform/errors/jupyterSelfCertsError';
import { RemoteJupyterServerConnectionError } from '../../../platform/errors/remoteJupyterServerConnectionError';
import { JupyterSelfCertsExpiredError } from '../../../platform/errors/jupyterSelfCertsExpiredError';

const defaultUri = 'https://hostname:8080/?token=849d61a414abafab97bc4aab1f3547755ddc232c2b8cb7fe';
interface ISelectUriQuickPickItem extends QuickPickItem {
Expand Down
4 changes: 2 additions & 2 deletions src/kernels/jupyter/finder/remoteKernelFinder.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import {
} from '../../types';
import { JupyterSessionManager } from '../session/jupyterSessionManager';
import { JupyterSessionManagerFactory } from '../session/jupyterSessionManagerFactory';
import { ActiveKernelIdList, PreferredRemoteKernelIdProvider } from '../preferredRemoteKernelIdProvider';
import { ActiveKernelIdList, PreferredRemoteKernelIdProvider } from '../connection/preferredRemoteKernelIdProvider';
import { IJupyterKernel, IJupyterRemoteCachedKernelValidator, IJupyterSessionManager } from '../types';
import { KernelFinder } from '../../kernelFinder';
import { NotebookProvider } from '../launcher/notebookProvider';
import { PythonExtensionChecker } from '../../../platform/api/pythonApi';
import { IFileSystemNode } from '../../../platform/common/platform/types.node';
import { JupyterServerUriStorage } from '../launcher/serverUriStorage';
import { JupyterServerUriStorage } from '../connection/serverUriStorage';
import { FileSystem } from '../../../platform/common/platform/fileSystem.node';
import { IApplicationEnvironment } from '../../../platform/common/application/types';
import { RemoteKernelSpecsCacheKey } from '../../common/commonFinder';
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/kernels/jupyter/jupyterUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IApplicationShell, IWorkspaceService } from '../../platform/common/appl
import { noop } from '../../platform/common/utils/misc';
import { IJupyterConnection } from '../types';
import { IJupyterServerUri, JupyterServerUriHandle } from './types';
import { getJupyterConnectionDisplayName } from './launcher/helpers';
import { getJupyterConnectionDisplayName } from './helpers';
import { IConfigurationService, IWatchableJupyterSettings, Resource } from '../../platform/common/types';
import { getFilePath } from '../../platform/common/platform/fs-paths';
import { DataScience } from '../../platform/common/utils/localize';
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/jupyter/launcher/jupyterConnection.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { RegExpValues } from '../../../platform/common/constants';
import { JupyterConnectError } from '../../../platform/errors/jupyterConnectError';
import { IJupyterConnection } from '../../types';
import { JupyterServerInfo } from '../types';
import { getJupyterConnectionDisplayName } from './helpers';
import { getJupyterConnectionDisplayName } from '../helpers';
import { arePathsSame } from '../../../platform/common/platform/fileUtils';
import { getFilePath } from '../../../platform/common/platform/fs-paths';
import { JupyterNotebookNotInstalled } from '../../../platform/errors/jupyterNotebookNotInstalled';
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/jupyter/launcher/jupyterExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
INotebookServerFactory
} from '../types';
import { IJupyterSubCommandExecutionService } from '../types.node';
import { JupyterConnection } from '../jupyterConnection';
import { JupyterConnection } from '../connection/jupyterConnection';
import { RemoteJupyterServerConnectionError } from '../../../platform/errors/remoteJupyterServerConnectionError';
import { LocalJupyterServerConnectionError } from '../../../platform/errors/localJupyterServerConnectionError';
import { JupyterSelfCertsExpiredError } from '../../../platform/errors/jupyterSelfCertsExpiredError';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
IJupyterServerUriStorage
} from '../../types';
import { IJupyterSubCommandExecutionService } from '../../types.node';
import { JupyterConnection } from '../../jupyterConnection';
import { JupyterConnection } from '../../connection/jupyterConnection';

/* eslint-disable @typescript-eslint/no-explicit-any */

Expand Down
16 changes: 8 additions & 8 deletions src/kernels/jupyter/serviceRegistry.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ import {
import { JupyterInterpreterSubCommandExecutionService } from './interpreter/jupyterInterpreterSubCommandExecutionService.node';
import { NbConvertExportToPythonService } from './interpreter/nbconvertExportToPythonService.node';
import { NbConvertInterpreterDependencyChecker } from './interpreter/nbconvertInterpreterDependencyChecker.node';
import { JupyterConnection } from './jupyterConnection';
import { JupyterConnection } from './connection/jupyterConnection';
import { JupyterDetectionTelemetry } from './jupyterDetectionTelemetry.node';
import { JupyterKernelService } from './jupyterKernelService.node';
import { JupyterRemoteCachedKernelValidator } from './jupyterRemoteCachedKernelValidator';
import { JupyterUriProviderRegistration } from './jupyterUriProviderRegistration';
import { JupyterKernelService } from './session/jupyterKernelService.node';
import { JupyterRemoteCachedKernelValidator } from './connection/jupyterRemoteCachedKernelValidator';
import { JupyterUriProviderRegistration } from './connection/jupyterUriProviderRegistration';
import { JupyterCommandLineSelector } from './launcher/commandLineSelector';
import { JupyterNotebookProvider } from './launcher/jupyterNotebookProvider';
import { JupyterPasswordConnect } from './launcher/jupyterPasswordConnect';
import { JupyterPasswordConnect } from './connection/jupyterPasswordConnect';
import { HostJupyterExecution } from './launcher/liveshare/hostJupyterExecution';
import { HostJupyterServerFactory } from './launcher/liveshare/hostJupyterServerFactory';
import { NotebookProvider } from './launcher/notebookProvider';
import { NotebookServerProvider } from './launcher/notebookServerProvider';
import { NotebookStarter } from './launcher/notebookStarter.node';
import { JupyterServerUriStorage } from './launcher/serverUriStorage';
import { LiveRemoteKernelConnectionUsageTracker } from './liveRemoteKernelConnectionTracker';
import { JupyterServerSelector } from './serverSelector';
import { JupyterServerUriStorage } from './connection/serverUriStorage';
import { LiveRemoteKernelConnectionUsageTracker } from './connection/liveRemoteKernelConnectionTracker';
import { JupyterServerSelector } from './connection/serverSelector';
import { BackingFileCreator } from './session/backingFileCreator.node';
import { JupyterRequestCreator } from './session/jupyterRequestCreator.node';
import { JupyterSessionManagerFactory } from './session/jupyterSessionManagerFactory';
Expand Down
16 changes: 8 additions & 8 deletions src/kernels/jupyter/serviceRegistry.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import { IServiceManager } from '../../platform/ioc/types';
import { DataScienceErrorHandlerWeb } from '../errors/kernelErrorHandler.web';
import { IDataScienceErrorHandler } from '../errors/types';
import { INotebookProvider } from '../types';
import { JupyterConnection } from './jupyterConnection';
import { JupyterKernelService } from './jupyterKernelService.web';
import { JupyterRemoteCachedKernelValidator } from './jupyterRemoteCachedKernelValidator';
import { JupyterUriProviderRegistration } from './jupyterUriProviderRegistration';
import { JupyterConnection } from './connection/jupyterConnection';
import { JupyterKernelService } from './session/jupyterKernelService.web';
import { JupyterRemoteCachedKernelValidator } from './connection/jupyterRemoteCachedKernelValidator';
import { JupyterUriProviderRegistration } from './connection/jupyterUriProviderRegistration';
import { JupyterCommandLineSelector } from './launcher/commandLineSelector';
import { JupyterNotebookProvider } from './launcher/jupyterNotebookProvider';
import { JupyterPasswordConnect } from './launcher/jupyterPasswordConnect';
import { JupyterPasswordConnect } from './connection/jupyterPasswordConnect';
import { HostJupyterExecution } from './launcher/liveshare/hostJupyterExecution';
import { HostJupyterServerFactory } from './launcher/liveshare/hostJupyterServerFactory';
import { NotebookProvider } from './launcher/notebookProvider';
import { NotebookServerProvider } from './launcher/notebookServerProvider';
import { JupyterServerUriStorage } from './launcher/serverUriStorage';
import { LiveRemoteKernelConnectionUsageTracker } from './liveRemoteKernelConnectionTracker';
import { JupyterServerSelector } from './serverSelector';
import { JupyterServerUriStorage } from './connection/serverUriStorage';
import { LiveRemoteKernelConnectionUsageTracker } from './connection/liveRemoteKernelConnectionTracker';
import { JupyterServerSelector } from './connection/serverSelector';
import { BackingFileCreator } from './session/backingFileCreator.web';
import { JupyterRequestCreator } from './session/jupyterRequestCreator.web';
import { JupyterSessionManagerFactory } from './session/jupyterSessionManagerFactory';
Expand Down
Loading

0 comments on commit e1152ca

Please sign in to comment.