Skip to content

Commit

Permalink
Move kernel execution into the 'kernels' folder (#10354)
Browse files Browse the repository at this point in the history
* Move cellExecution logic into 'kernels' tree

* Update telemetry
  • Loading branch information
rchiodo authored Jun 8, 2022
1 parent 98262a2 commit cf7da9f
Show file tree
Hide file tree
Showing 77 changed files with 252 additions and 248 deletions.
18 changes: 9 additions & 9 deletions TELEMETRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ No properties for event

## Locations Used

[src/notebooks/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/execution/kernelExecution.ts)
[src/kernels/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/execution/kernelExecution.ts)
```typescript
this.documentExecutions.set(document, newCellExecutionQueue);
return newCellExecutionQueue;
Expand Down Expand Up @@ -2689,7 +2689,7 @@ function resetData(resource: Resource, eventName: string, properties: any) {
```


[src/notebooks/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/execution/kernelExecution.ts)
[src/kernels/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/execution/kernelExecution.ts)
```typescript
// Otherwise a real error occurred.
sendKernelTelemetryEvent(
Expand All @@ -2701,7 +2701,7 @@ function resetData(resource: Resource, eventName: string, properties: any) {
```


[src/notebooks/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/execution/kernelExecution.ts)
[src/kernels/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/execution/kernelExecution.ts)
```typescript
})();

Expand Down Expand Up @@ -5238,7 +5238,7 @@ No properties for event

## Locations Used

[src/notebooks/execution/cellExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/execution/cellExecution.ts)
[src/kernels/execution/cellExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/execution/cellExecution.ts)
```typescript
const props = { notebook: true };
if (!CellExecution.sentExecuteCellTelemetry) {
Expand Down Expand Up @@ -5281,7 +5281,7 @@ No properties for event

## Locations Used

[src/notebooks/execution/cellExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/execution/cellExecution.ts)
[src/kernels/execution/cellExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/execution/cellExecution.ts)
```typescript
CellExecution.sentExecuteCellTelemetry = true;
sendTelemetryEvent(Telemetry.ExecuteCellPerceivedCold, this.stopWatchForTelemetry.elapsedTime, props);
Expand Down Expand Up @@ -5799,7 +5799,7 @@ No properties for event

## Locations Used

[src/notebooks/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/execution/kernelExecution.ts)
[src/kernels/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/execution/kernelExecution.ts)
```typescript
return newCellExecutionQueue;
}
Expand Down Expand Up @@ -7995,7 +7995,7 @@ No properties for event

## Locations Used

[src/notebooks/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/execution/kernelExecution.ts)
[src/kernels/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/execution/kernelExecution.ts)
```typescript
}

Expand Down Expand Up @@ -8023,7 +8023,7 @@ No properties for event

## Locations Used

[src/notebooks/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/execution/kernelExecution.ts)
[src/kernels/execution/kernelExecution.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/execution/kernelExecution.ts)
```typescript
});
}
Expand Down Expand Up @@ -8671,7 +8671,7 @@ No description provided

## Locations Used

[src/notebooks/helpers.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/helpers.ts)
[src/kernels/execution/helpers.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/execution/helpers.ts)
```typescript
// Unless we already know its an unknown output type.
const outputType: nbformat.OutputType =
Expand Down
3 changes: 1 addition & 2 deletions src/intellisense/cellLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import {
getLanguageInNotebookMetadata
} from '../kernels/helpers';
import { KernelConnectionMetadata } from '../kernels/types';
import { isJupyterNotebook, getNotebookMetadata } from '../notebooks/helpers';
import { translateKernelLanguageToMonaco } from '../platform/common/utils';
import { getNotebookMetadata, isJupyterNotebook, translateKernelLanguageToMonaco } from '../platform/common/utils';

export const LastSavedNotebookCellLanguage = 'DATASCIENCE.LAST_SAVED_CELL_LANGUAGE';
/**
Expand Down
4 changes: 2 additions & 2 deletions src/intellisense/diagnosticsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import { PYTHON_LANGUAGE } from '../platform/common/constants';
import { disposeAllDisposables } from '../platform/common/helpers';
import { IDisposable, IDisposableRegistry } from '../platform/common/types';
import { DataScience } from '../platform/common/utils/localize';
import { JupyterNotebookView } from '../notebooks/constants';
import { getAssociatedJupyterNotebook } from '../notebooks/helpers';
import { JupyterNotebookView } from '../platform/common/constants';
import { getAssociatedJupyterNotebook } from '../platform/common/utils';

type CellUri = string;
type CellVersion = number;
Expand Down
5 changes: 2 additions & 3 deletions src/intellisense/emptyNotebookCellLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import { PYTHON_LANGUAGE } from '../platform/common/constants';
import { traceError } from '../platform/logging';
import { IDisposableRegistry } from '../platform/common/types';
import { noop } from '../platform/common/utils/misc';
import { chainWithPendingUpdates } from '../notebooks/execution/notebookUpdater';
import { isJupyterNotebook } from '../notebooks/helpers';
import { chainWithPendingUpdates } from '../kernels/execution/notebookUpdater';
import { INotebookControllerManager } from '../notebooks/types';
import { translateKernelLanguageToMonaco } from '../platform/common/utils';
import { isJupyterNotebook, translateKernelLanguageToMonaco } from '../platform/common/utils';
import { IVSCodeNotebookController } from '../notebooks/controllers/types';
/**
* If user creates a blank notebook, then they'll mostl likely end up with a blank cell with language, lets assume `Python`.
Expand Down
2 changes: 1 addition & 1 deletion src/intellisense/intellisenseProvider.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import { IDisposableRegistry, IConfigurationService, IsPreRelease } from '../pla
import { IInterpreterService } from '../platform/interpreter/contracts';
import { PythonEnvironment } from '../platform/pythonEnvironments/info';
import { getInterpreterId } from '../platform/pythonEnvironments/info/interpreter';
import { isJupyterNotebook } from '../notebooks/helpers';
import { INotebookControllerManager, INotebookCompletionProvider, INotebookEditorProvider } from '../notebooks/types';
import { LanguageServer } from './languageServer.node';
import { IVSCodeNotebookController } from '../notebooks/controllers/types';
import { getComparisonKey } from '../platform/vscode-path/resources';
import { CompletionRequest } from 'vscode-languageclient';
import { NotebookPythonPathService } from './notebookPythonPathService';
import { isJupyterNotebook } from '../platform/common/utils';

const EmptyWorkspaceKey = '';

Expand Down
2 changes: 1 addition & 1 deletion src/intellisense/pythonKernelCompletionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { waitForPromise } from '../platform/common/utils/async';
import { isNotebookCell } from '../platform/common/utils/misc';
import { StopWatch } from '../platform/common/utils/stopWatch';
import { IJupyterSession, IKernelProvider } from '../kernels/types';
import { getAssociatedJupyterNotebook } from '../notebooks/helpers';
import { INotebookCompletionProvider, INotebookEditorProvider } from '../notebooks/types';
import { mapJupyterKind } from './conversion';
import { isTestExecution, Settings } from '../platform/common/constants';
import { INotebookCompletion } from './types';
import { getAssociatedJupyterNotebook } from '../platform/common/utils';

let IntellisenseTimeout = Settings.IntellisenseTimeout;
export function setIntellisenseTimeout(timeoutMs: number) {
Expand Down
2 changes: 1 addition & 1 deletion src/interactive-window/commands/exportCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import { DataScience } from '../../platform/common/utils/localize';
import { isUri } from '../../platform/common/utils/misc';
import { PythonEnvironment } from '../../platform/pythonEnvironments/info';
import { sendTelemetryEvent } from '../../telemetry';
import { getNotebookMetadata, isPythonNotebook } from '../../notebooks/helpers';
import { INotebookControllerManager } from '../../notebooks/types';
import { Commands, Telemetry } from '../../platform/common/constants';
import { IFileConverter, ExportFormat } from '../../platform/export/types';
import { IExportCommands, IInteractiveWindowProvider } from '../types';
import { IFileSystem } from '../../platform/common/platform/types';
import { isPythonNotebook, getNotebookMetadata } from '../../platform/common/utils';

interface IExportQuickPickItem extends QuickPickItem {
handler(): void;
Expand Down
2 changes: 1 addition & 1 deletion src/interactive-window/editor-integration/cellFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { NotebookCell, NotebookCellKind, NotebookDocument, Range, TextDocument,

import { appendLineFeed, generateMarkdownFromCodeLines, parseForComments } from '../../webviews/webview-side/common';
import { CellMatcher } from './cellMatcher';
import { createJupyterCellFromVSCNotebookCell } from '../../notebooks/helpers';
import { ICell, ICellRange, IJupyterSettings, Resource } from '../../platform/common/types';
import { noop } from '../../platform/common/utils/misc';
import { getInteractiveCellMetadata } from '../helpers';
import { createJupyterCellFromVSCNotebookCell } from '../../kernels/execution/helpers';

export function createCodeCell(): nbformat.ICodeCell;
// eslint-disable-next-line @typescript-eslint/unified-signatures
Expand Down
3 changes: 1 addition & 2 deletions src/interactive-window/editor-integration/codeLensFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import { ICellRange, IConfigurationService, IDisposableRegistry, Resource } from
import * as localize from '../../platform/common/utils/localize';
import { getInteractiveCellMetadata } from '../helpers';
import { IKernelProvider } from '../../kernels/types';
import { InteractiveWindowView } from '../../notebooks/constants';
import { CodeLensCommands, Commands } from '../../platform/common/constants';
import { CodeLensCommands, Commands, InteractiveWindowView } from '../../platform/common/constants';
import { generateCellRangesFromDocument } from './cellFactory';
import { ICodeLensFactory, IGeneratedCode, IGeneratedCodeStorageFactory } from './types';
import { getAssociatedNotebookDocument } from '../../kernels/helpers';
Expand Down
2 changes: 1 addition & 1 deletion src/interactive-window/editor-integration/decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IPythonExtensionChecker } from '../../platform/api/types';
import { IDocumentManager } from '../../platform/common/application/types';
import { PYTHON_LANGUAGE } from '../../platform/common/constants';
import { IConfigurationService, IDisposable, IDisposableRegistry } from '../../platform/common/types';
import { getAssociatedJupyterNotebook } from '../../notebooks/helpers';
import { getAssociatedJupyterNotebook } from '../../platform/common/utils';
import { generateCellRangesFromDocument } from './cellFactory';

@injectable()
Expand Down
3 changes: 1 addition & 2 deletions src/interactive-window/editor-integration/hoverProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ import * as vscode from 'vscode';
import { IExtensionSyncActivationService } from '../../platform/activation/types';
import { IVSCodeNotebook } from '../../platform/common/application/types';
import { Cancellation } from '../../platform/common/cancellation';
import { Identifiers, PYTHON, Telemetry } from '../../platform/common/constants';
import { Identifiers, InteractiveWindowView, PYTHON, Telemetry } from '../../platform/common/constants';
import { traceError } from '../../platform/logging';
import { IDisposableRegistry } from '../../platform/common/types';

import { sleep } from '../../platform/common/utils/async';
import { StopWatch } from '../../platform/common/utils/stopWatch';
import { sendTelemetryEvent } from '../../telemetry';
import { IKernel, IKernelProvider } from '../../kernels/types';
import { InteractiveWindowView } from '../../notebooks/constants';
import { IJupyterVariables } from '../../kernels/variables/types';
import { IInteractiveWindowProvider } from '../types';
import { getInteractiveCellMetadata } from '../helpers';
Expand Down
2 changes: 1 addition & 1 deletion src/interactive-window/generatedCodeStoreManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { inject, injectable } from 'inversify';
import { NotebookDocument } from 'vscode';
import { getAssociatedNotebookDocument } from '../kernels/helpers';
import { IKernel, IKernelProvider } from '../kernels/types';
import { InteractiveWindowView } from '../notebooks/constants';
import { INotebookControllerManager } from '../notebooks/types';
import { IExtensionSyncActivationService } from '../platform/activation/types';
import { InteractiveWindowView } from '../platform/common/constants';
import { disposeAllDisposables } from '../platform/common/helpers';
import { IDisposable, IDisposableRegistry } from '../platform/common/types';
import { ICodeGeneratorFactory, IGeneratedCodeStorageFactory } from './editor-integration/types';
Expand Down
6 changes: 3 additions & 3 deletions src/interactive-window/interactiveWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ import { DataScience } from '../platform/common/utils/localize';
import { createDeferred, Deferred } from '../platform/common/utils/async';
import { IServiceContainer } from '../platform/ioc/types';
import { SysInfoReason } from '../platform/messageTypes';
import { chainWithPendingUpdates } from '../notebooks/execution/notebookUpdater';
import { updateNotebookMetadata } from '../notebooks/helpers';
import { CellExecutionCreator } from '../notebooks/execution/cellExecutionCreator';
import { createOutputWithErrorMessageForDisplay } from '../platform/errors/errorUtils';
import { INotebookExporter } from '../kernels/jupyter/types';
import { IDataScienceErrorHandler } from '../platform/errors/types';
Expand All @@ -74,6 +71,9 @@ import {
InteractiveCellMetadata
} from './editor-integration/types';
import { IInteractiveWindowDebuggingManager } from '../kernels/debugger/types';
import { CellExecutionCreator } from '../kernels/execution/cellExecutionCreator';
import { updateNotebookMetadata } from '../kernels/execution/helpers';
import { chainWithPendingUpdates } from '../kernels/execution/notebookUpdater';

export class InteractiveWindow implements IInteractiveWindowLoadable {
public get onDidChangeViewState(): Event<void> {
Expand Down
11 changes: 8 additions & 3 deletions src/interactive-window/interactiveWindowCommandListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ import {
IDocumentManager,
IVSCodeNotebook
} from '../platform/common/application/types';
import { Commands, JVSC_EXTENSION_ID, PYTHON_LANGUAGE, Telemetry } from '../platform/common/constants';
import {
Commands,
JupyterNotebookView,
JVSC_EXTENSION_ID,
PYTHON_LANGUAGE,
Telemetry
} from '../platform/common/constants';
import { traceError, traceInfo } from '../platform/logging';
import { IFileSystem } from '../platform/common/platform/types';
import { IConfigurationService, IDataScienceCommandListener, IDisposableRegistry } from '../platform/common/types';
Expand All @@ -33,15 +39,14 @@ import { CommandSource } from '../platform/testing/common/constants';
import { JupyterInstallError } from '../platform/errors/jupyterInstallError';
import { INotebookControllerManager, INotebookEditorProvider } from '../notebooks/types';
import { KernelConnectionMetadata } from '../kernels/types';
import { chainWithPendingUpdates } from '../notebooks/execution/notebookUpdater';
import { INotebookExporter, IJupyterExecution } from '../kernels/jupyter/types';
import { IDataScienceErrorHandler } from '../platform/errors/types';
import { IFileConverter, IExportDialog, ExportFormat } from '../platform/export/types';
import { IStatusProvider } from '../platform/progress/types';
import { generateCellsFromDocument } from './editor-integration/cellFactory';
import { IInteractiveWindowProvider } from './types';
import { JupyterNotebookView } from '../notebooks/constants';
import { getDisplayPath, getFilePath } from '../platform/common/platform/fs-paths';
import { chainWithPendingUpdates } from '../kernels/execution/notebookUpdater';

@injectable()
export class InteractiveWindowCommandListener implements IDataScienceCommandListener {
Expand Down
3 changes: 1 addition & 2 deletions src/interactive-window/interactiveWindowProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { IServiceContainer } from '../platform/ioc/types';
import { KernelConnectionMetadata } from '../kernels/types';
import { IEmbedNotebookEditorProvider, INotebookControllerManager, INotebookEditorProvider } from '../notebooks/types';
import { InteractiveWindow } from './interactiveWindow';
import { JVSC_EXTENSION_ID, NotebookCellScheme } from '../platform/common/constants';
import { InteractiveWindowView, JVSC_EXTENSION_ID, NotebookCellScheme } from '../platform/common/constants';
import {
IInteractiveWindow,
IInteractiveWindowDebugger,
Expand All @@ -56,7 +56,6 @@ import { INotebookExporter } from '../kernels/jupyter/types';
import { IDataScienceErrorHandler } from '../platform/errors/types';
import { IExportDialog } from '../platform/export/types';
import { IVSCodeNotebookController } from '../notebooks/controllers/types';
import { InteractiveWindowView } from '../notebooks/constants';
import { ICodeGeneratorFactory, IGeneratedCodeStorageFactory } from './editor-integration/types';
import { IInteractiveWindowDebuggingManager } from '../kernels/debugger/types';
import { getResourceType } from '../platform/common/utils';
Expand Down
2 changes: 1 addition & 1 deletion src/interactive-window/outputs/tracebackFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import { inject, injectable } from 'inversify';
import { NotebookCell, Uri } from 'vscode';
import { ITracebackFormatter } from '../../kernels/types';
import { InteractiveWindowView } from '../../notebooks/constants';
import { IGeneratedCode, IFileGeneratedCodes, IGeneratedCodeStorageFactory } from '../editor-integration/types';
import { untildify } from '../../platform/common/utils/platform';
import { traceInfoIfCI } from '../../platform/logging';
import { getDisplayPath, getFilePath } from '../../platform/common/platform/fs-paths';
import { IPlatformService } from '../../platform/common/platform/types';
import { stripAnsi } from '../../platform/common/utils/regexp';
import { InteractiveWindowView } from '../../platform/common/constants';

// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
const _escapeRegExp = require('lodash/escapeRegExp') as typeof import('lodash/escapeRegExp'); // NOSONAR
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/activation.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

import { inject, injectable } from 'inversify';
import { NotebookDocument } from 'vscode';
import { isJupyterNotebook } from '../notebooks/helpers';
import { IExtensionSingleActivationService } from '../platform/activation/types';
import { IPythonExtensionChecker } from '../platform/api/types';
import { IVSCodeNotebook } from '../platform/common/application/types';
import { Telemetry, JupyterDaemonModule } from '../platform/common/constants';
import { IPythonExecutionFactory, IPythonDaemonExecutionService } from '../platform/common/process/types.node';
import { IDisposableRegistry } from '../platform/common/types';
import { isJupyterNotebook } from '../platform/common/utils';
import { debounceAsync, swallowExceptions } from '../platform/common/utils/decorators';
import { sendTelemetryEvent } from '../telemetry';
import { JupyterInterpreterService } from './jupyter/interpreter/jupyterInterpreterService.node';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { injectable } from 'inversify';
import { NotebookCell, NotebookCellOutput, NotebookDocument, workspace } from 'vscode';
import { isJupyterNotebook } from '../helpers';
import { isJupyterNotebook } from '../../platform/common/utils';

@injectable()
export class CellOutputDisplayIdTracker {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { traceError, traceInfoIfCI, traceWarning } from '../../platform/logging'
import { IDisposable } from '../../platform/common/types';
import { createDeferred } from '../../platform/common/utils/async';
import { StopWatch } from '../../platform/common/utils/stopWatch';
import { NotebookCellStateTracker, traceCellMessage } from '../helpers';
import { sendTelemetryEvent } from '../../telemetry';
import { Telemetry } from '../../webviews/webview-side/common/constants';
import { noop } from '../../platform/common/utils/misc';
Expand All @@ -33,6 +32,7 @@ import { isCancellationError } from '../../platform/common/cancellation';
import { activeNotebookCellExecution, CellExecutionMessageHandler } from './cellExecutionMessageHandler';
import { CellExecutionMessageHandlerService } from './cellExecutionMessageHandlerService';
import { IJupyterSession, KernelConnectionMetadata, NotebookCellRunState } from '../../kernels/types';
import { NotebookCellStateTracker, traceCellMessage } from './helpers';

export class CellExecutionFactory {
constructor(
Expand Down
Loading

0 comments on commit cf7da9f

Please sign in to comment.