Skip to content

Commit

Permalink
Rest of 'notebooks' removal from 'kernels' (#10380)
Browse files Browse the repository at this point in the history
* Rest of notebooks references

* Get rid of jupyterExporter.node dependency on notebooks

* Update telemetry

* More moves

* Add lint rule to reenforce layer

* Update telemetry
  • Loading branch information
rchiodo authored Jun 8, 2022
1 parent fb7cd13 commit 28cb722
Show file tree
Hide file tree
Showing 18 changed files with 126 additions and 123 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ module.exports = {
from: './src/interactive-window/**/*.ts',
message:
'Importing modules from ./src/interactive-window into ./src/notebooks code is not allowed.'
},
{
target: './src/kernels/**/*.ts',
from: './src/notebooks/**/*.ts',
message: 'Importing modules from ./src/notebooks into ./src/kernels code is not allowed.'
}
]
}
Expand Down
128 changes: 64 additions & 64 deletions TELEMETRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ No description provided
sendTelemetryEvent(Telemetry.ClickedExportNotebookAsQuickPick, undefined, {
format: ExportFormat.python
});
void this.commandManager.executeCommand(Commands.ExportAsPythonScript, sourceDocument, interpreter);
this.commandManager
```


Expand All @@ -77,7 +77,7 @@ No description provided
sendTelemetryEvent(Telemetry.ClickedExportNotebookAsQuickPick, undefined, {
format: ExportFormat.html
});
void this.commandManager.executeCommand(
this.commandManager
```


Expand All @@ -89,7 +89,7 @@ No description provided
sendTelemetryEvent(Telemetry.ClickedExportNotebookAsQuickPick, undefined, {
format: ExportFormat.pdf
});
void this.commandManager.executeCommand(
this.commandManager
```

</details>
Expand Down Expand Up @@ -535,7 +535,7 @@ No description provided
[src/kernels/debugger/kernelDebugAdapterBase.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/debugger/kernelDebugAdapterBase.ts)
```typescript
this.kernel.onDisposed(() => {
void debug.stopDebugging(this.session);
debug.stopDebugging(this.session).then(noop, noop);
this.endSession.fire(this.session);
sendTelemetryEvent(DebuggingTelemetry.endedSession, undefined, { reason: 'onKernelDisposed' });
})
Expand Down Expand Up @@ -1225,7 +1225,7 @@ No properties for event
} catch (e) {
traceError(e);
sendTelemetryEvent(Telemetry.FailedShowDataViewer);
void this.appShell.showErrorMessage(localize.DataScience.showDataViewerFail());
this.appShell.showErrorMessage(localize.DataScience.showDataViewerFail()).then(noop, noop);
}
}
```
Expand Down Expand Up @@ -1608,9 +1608,9 @@ No description provided

[src/platform/api/apiAccessService.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/platform/api/apiAccessService.ts)
```typescript
extensionPermissions.push({ allowed: allow ? 'yes' : 'no', extensionId: info.extensionId });
return this.globalState.update(API_ACCESS_GLOBAL_KEY, extensionPermissions);
});
return this.globalState.update(API_ACCESS_GLOBAL_KEY, extensionPermissions);
})
.then(noop, noop);
sendTelemetryEvent(Telemetry.JupyterKernelApiAccess, undefined, {
extensionId: info.extensionId,
allowed: allow ? 'yes' : 'no'
Expand Down Expand Up @@ -1739,7 +1739,7 @@ No properties for event
```typescript
.map((item) => item.connection)
.filter((item) => !selectedItems.has(item));
void this.kernelFilter.storeHiddenKernels(hiddenConnections.map((item) => item));
this.kernelFilter.storeHiddenKernels(hiddenConnections.map((item) => item)).then(noop, noop);
sendTelemetryEvent(Telemetry.JupyterKernelFilterUsed);
},
this,
Expand Down Expand Up @@ -1938,9 +1938,9 @@ No properties for event

[src/notebooks/notebookEditorProvider.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/notebookEditorProvider.ts)
```typescript
const nb = await this.vscodeNotebook.openNotebookDocument(file);
await this.vscodeNotebook.showNotebookDocument(nb);
}
export class NotebookEditorProvider implements INotebookEditorProvider {
private providers: Set<IEmbedNotebookEditorProvider> = new Set();
constructor(@inject(IVSCodeNotebook) private readonly vscodeNotebook: IVSCodeNotebook) {}
@captureTelemetry(Telemetry.CreateNewNotebook, undefined, false)
public async createNew(options?: { contents?: string; defaultCellLanguage: string }): Promise<void> {
// contents will be ignored
Expand Down Expand Up @@ -2964,61 +2964,61 @@ No description provided

[src/kernels/variables/pythonVariableRequester.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/variables/pythonVariableRequester.ts)
```typescript
{
traceErrors: true,
traceErrorsMessage: 'Failure in execute_request for getDataFrameInfo',
telemetryName: Telemetry.PythonVariableFetchingCodeFailure
}
)
: [];
{
traceErrors: true,
traceErrorsMessage: 'Failure in execute_request for getDataFrameInfo',
telemetryName: Telemetry.PythonVariableFetchingCodeFailure
}
);

```


[src/kernels/variables/pythonVariableRequester.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/variables/pythonVariableRequester.ts)
```typescript
{
traceErrors: true,
traceErrorsMessage: 'Failure in execute_request for getDataFrameRows',
telemetryName: Telemetry.PythonVariableFetchingCodeFailure
}
)
: [];
{
traceErrors: true,
traceErrorsMessage: 'Failure in execute_request for getDataFrameRows',
telemetryName: Telemetry.PythonVariableFetchingCodeFailure
}
);

```


[src/kernels/variables/pythonVariableRequester.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/variables/pythonVariableRequester.ts)
```typescript
{
traceErrors: true,
traceErrorsMessage: 'Failure in execute_request for getVariableProperties',
telemetryName: Telemetry.PythonVariableFetchingCodeFailure
}
)
: [];
{
traceErrors: true,
traceErrorsMessage: 'Failure in execute_request for getVariableProperties',
telemetryName: Telemetry.PythonVariableFetchingCodeFailure
}
);
result = { ...result, ...this.deserializeJupyterResult(attributes) };
```


[src/kernels/variables/pythonVariableRequester.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/variables/pythonVariableRequester.ts)
```typescript
{
traceErrors: true,
traceErrorsMessage: 'Failure in execute_request for getVariableNamesAndTypesFromKernel',
telemetryName: Telemetry.PythonVariableFetchingCodeFailure
}
)
: [];
{
traceErrors: true,
traceErrorsMessage: 'Failure in execute_request for getVariableNamesAndTypesFromKernel',
telemetryName: Telemetry.PythonVariableFetchingCodeFailure
}
);

```


[src/kernels/variables/pythonVariableRequester.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/variables/pythonVariableRequester.ts)
```typescript
{
traceErrors: true,
traceErrorsMessage: 'Failure in execute_request for getFullVariable',
telemetryName: Telemetry.PythonVariableFetchingCodeFailure
}
)
: [];
{
traceErrors: true,
traceErrorsMessage: 'Failure in execute_request for getFullVariable',
telemetryName: Telemetry.PythonVariableFetchingCodeFailure
}
);

```

</details>
Expand Down Expand Up @@ -3851,7 +3851,7 @@ No properties for event

[src/interactive-window/editor-integration/codewatcher.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/interactive-window/editor-integration/codewatcher.ts)
```typescript
});
.then(noop, noop);
}

@captureTelemetry(Telemetry.SelectCell)
Expand Down Expand Up @@ -4154,13 +4154,13 @@ No properties for event

[src/platform/errors/errorHandler.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/platform/errors/errorHandler.ts)
```typescript
ConfigurationTarget.Workspace
);
)
.catch(noop);
} else if (value === closeOption) {
sendTelemetryEvent(Telemetry.SelfCertsMessageClose);
}
});
return KernelInterpreterDependencyResponse.failed;
})
.then(noop, noop);
```


Expand Down Expand Up @@ -4222,9 +4222,9 @@ No properties for event
.then((value) => {
if (value === enableOption) {
sendTelemetryEvent(Telemetry.SelfCertsMessageEnabled);
void this.configuration.updateSetting(
'allowUnauthorizedRemoteConnection',
true,
this.configuration
.updateSetting(
'allowUnauthorizedRemoteConnection',
```


Expand Down Expand Up @@ -6978,9 +6978,9 @@ No properties for event
if (!this.perceivedJupyterStartupTelemetryCaptured) {
this.perceivedJupyterStartupTelemetryCaptured = true;
sendTelemetryEvent(Telemetry.PerceivedJupyterStartupNotebook, stopWatch.elapsedTime);
executionPromise.finally(() =>
sendTelemetryEvent(Telemetry.StartExecuteNotebookCellPerceivedCold, stopWatch.elapsedTime)
);
executionPromise
.finally(() =>
sendTelemetryEvent(Telemetry.StartExecuteNotebookCellPerceivedCold, stopWatch.elapsedTime)
```


Expand Down Expand Up @@ -8313,13 +8313,13 @@ No properties for event

[src/kernels/kernel.base.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/kernel.base.ts)
```typescript
this.perceivedJupyterStartupTelemetryCaptured = true;
sendTelemetryEvent(Telemetry.PerceivedJupyterStartupNotebook, stopWatch.elapsedTime);
executionPromise.finally(() =>
sendTelemetryEvent(Telemetry.StartExecuteNotebookCellPerceivedCold, stopWatch.elapsedTime)
);
executionPromise
.finally(() =>
sendTelemetryEvent(Telemetry.StartExecuteNotebookCellPerceivedCold, stopWatch.elapsedTime)
)
.catch(noop);
}
}
```

</details>
Expand Down Expand Up @@ -9228,7 +9228,7 @@ No properties for event
} catch (e) {
sendTelemetryEvent(EventName.OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_ERROR, undefined, undefined, e);
traceError(e);
void this.errorHandler.handleError(e);
this.errorHandler.handleError(e).then(noop, noop);
}
```

Expand Down
3 changes: 2 additions & 1 deletion src/interactive-window/interactiveWindowCommandListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { generateCellsFromDocument } from './editor-integration/cellFactory';
import { IInteractiveWindowProvider } from './types';
import { getDisplayPath, getFilePath } from '../platform/common/platform/fs-paths';
import { chainWithPendingUpdates } from '../kernels/execution/notebookUpdater';
import { openAndShowNotebook } from '../platform/common/utils/notebooks';
import { noop } from '../platform/common/utils/misc';

@injectable()
Expand Down Expand Up @@ -242,7 +243,7 @@ export class InteractiveWindowCommandListener implements IDataScienceCommandList
openQuestion1
);
if (selection === openQuestion1) {
await this.ipynbProvider.open(uri);
await openAndShowNotebook(uri);
}
}
}
Expand Down
7 changes: 1 addition & 6 deletions src/kernels/jupyter/commands/commandRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ import { IExtensionSingleActivationService } from '../../../platform/activation/
import { IWorkspaceService } from '../../../platform/common/application/types';
import { IDisposable } from '../../../platform/common/types';
import { JupyterCommandLineSelectorCommand } from './commandLineSelector';
import { JupyterServerSelectorCommand } from './serverSelector';

@injectable()
export class CommandRegistry implements IExtensionSingleActivationService {
private readonly disposables: IDisposable[] = [];
constructor(
@inject(JupyterServerSelectorCommand) private readonly serverSelectedCommand: JupyterServerSelectorCommand,
@inject(JupyterCommandLineSelectorCommand)
private readonly commandLineCommand: JupyterCommandLineSelectorCommand,
@inject(IWorkspaceService) private readonly workspace: IWorkspaceService
) {
this.disposables.push(this.serverSelectedCommand);
}
) {}
public async activate() {
this.registerCommandsIfTrusted();
}
Expand All @@ -32,6 +28,5 @@ export class CommandRegistry implements IExtensionSingleActivationService {
return;
}
this.commandLineCommand.register();
this.serverSelectedCommand.register();
}
}
5 changes: 2 additions & 3 deletions src/kernels/jupyter/import-export/jupyterExporter.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as path from '../../../platform/vscode-path/path';
import { Uri } from 'vscode';
import { createCodeCell } from '../../../interactive-window/editor-integration/cellFactory';
import { CellMatcher } from '../../../interactive-window/editor-integration/cellMatcher';
import { INotebookEditorProvider } from '../../../notebooks/types';
import { IWorkspaceService, IApplicationShell } from '../../../platform/common/application/types';
import { traceError } from '../../../platform/logging';
import { IPlatformService } from '../../../platform/common/platform/types';
Expand All @@ -21,6 +20,7 @@ import { IDataScienceErrorHandler } from '../../../platform/errors/types';
import { concatMultilineString } from '../../../webviews/webview-side/common';
import { defaultNotebookFormat, CodeSnippets } from '../../../webviews/webview-side/common/constants';
import { INotebookExporter, IJupyterExecution } from '../types';
import { openAndShowNotebook } from '../../../platform/common/utils/notebooks';
import { noop } from '../../../platform/common/utils/misc';

@injectable()
Expand All @@ -32,7 +32,6 @@ export class JupyterExporter implements INotebookExporter {
@inject(IFileSystemNode) private fileSystem: IFileSystemNode,
@inject(IPlatformService) private readonly platform: IPlatformService,
@inject(IApplicationShell) private readonly applicationShell: IApplicationShell,
@inject(INotebookEditorProvider) protected ipynbProvider: INotebookEditorProvider,
@inject(IDataScienceErrorHandler) protected errorHandler: IDataScienceErrorHandler
) {}

Expand Down Expand Up @@ -62,7 +61,7 @@ export class JupyterExporter implements INotebookExporter {
.then(async (str: string | undefined) => {
try {
if (str === openQuestion1) {
await this.ipynbProvider.open(Uri.file(file));
await openAndShowNotebook(Uri.file(file));
}
} catch (e) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
10 changes: 0 additions & 10 deletions src/kernels/jupyter/serviceRegistry.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { IRemoteKernelFinder } from '../raw/types';
import { INotebookProvider } from '../types';
import { JupyterCommandLineSelectorCommand } from './commands/commandLineSelector';
import { CommandRegistry } from './commands/commandRegistry';
import { JupyterServerSelectorCommand } from './commands/serverSelector';
import { JupyterExporter } from './import-export/jupyterExporter.node';
import { JupyterImporter } from './import-export/jupyterImporter.node';
import { JupyterCommandFactory } from './interpreter/jupyterCommand.node';
Expand Down Expand Up @@ -40,7 +39,6 @@ import { ServerConnectionType } from './launcher/serverConnectionType';
import { ServerPreload } from './launcher/serverPreload.node';
import { JupyterServerUriStorage } from './launcher/serverUriStorage';
import { LiveRemoteKernelConnectionUsageTracker } from './liveRemoteKernelConnectionTracker';
import { RemoteKernelConnectionHandler } from './remoteKernelConnectionHandler';
import { RemoteKernelFinder } from './remoteKernelFinder';
import { JupyterServerSelector } from './serverSelector';
import { BackingFileCreator } from './session/backingFileCreator.node';
Expand Down Expand Up @@ -144,10 +142,6 @@ export function registerTypes(serviceManager: IServiceManager, _isDevMode: boole
JupyterCommandLineSelectorCommand,
JupyterCommandLineSelectorCommand
);
serviceManager.addSingleton<JupyterServerSelectorCommand>(
JupyterServerSelectorCommand,
JupyterServerSelectorCommand
);
serviceManager.addSingleton<IJupyterRequestCreator>(IJupyterRequestCreator, JupyterRequestCreator);
serviceManager.addSingleton<IJupyterRequestAgentCreator>(IJupyterRequestAgentCreator, RequestAgentCreator);
serviceManager.addSingleton<ServerConnectionType>(ServerConnectionType, ServerConnectionType);
Expand All @@ -158,10 +152,6 @@ export function registerTypes(serviceManager: IServiceManager, _isDevMode: boole
LiveRemoteKernelConnectionUsageTracker
);
serviceManager.addBinding(ILiveRemoteKernelConnectionUsageTracker, IExtensionSyncActivationService);
serviceManager.addSingleton<IExtensionSyncActivationService>(
IExtensionSyncActivationService,
RemoteKernelConnectionHandler
);
serviceManager.addSingleton<IJupyterRemoteCachedKernelValidator>(
IJupyterRemoteCachedKernelValidator,
JupyterRemoteCachedKernelValidator
Expand Down
Loading

0 comments on commit 28cb722

Please sign in to comment.