Skip to content

Commit de988ff

Browse files
authored
Remove dead tensorboard code (microsoft#24641)
Fixes microsoft#23093
1 parent 25ecab8 commit de988ff

30 files changed

+16
-2384
lines changed

package.json

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -332,18 +332,6 @@
332332
"command": "python.execInREPL",
333333
"title": "%python.command.python.execInREPL.title%"
334334
},
335-
{
336-
"category": "Python",
337-
"command": "python.launchTensorBoard",
338-
"title": "%python.command.python.launchTensorBoard.title%"
339-
},
340-
{
341-
"category": "Python",
342-
"command": "python.refreshTensorBoard",
343-
"enablement": "python.hasActiveTensorBoardSession",
344-
"icon": "$(refresh)",
345-
"title": "%python.command.python.refreshTensorBoard.title%"
346-
},
347335
{
348336
"category": "Python",
349337
"command": "python.reportIssue",
@@ -461,8 +449,7 @@
461449
"pythonTerminalEnvVarActivation",
462450
"pythonDiscoveryUsingWorkers",
463451
"pythonTestAdapter",
464-
"pythonREPLSmartSend",
465-
"pythonRecommendTensorboardExt"
452+
"pythonREPLSmartSend"
466453
],
467454
"enumDescriptions": [
468455
"%python.experiments.All.description%",
@@ -471,8 +458,7 @@
471458
"%python.experiments.pythonTerminalEnvVarActivation.description%",
472459
"%python.experiments.pythonDiscoveryUsingWorkers.description%",
473460
"%python.experiments.pythonTestAdapter.description%",
474-
"%python.experiments.pythonREPLSmartSend.description%",
475-
"%python.experiments.pythonRecommendTensorboardExt.description%"
461+
"%python.experiments.pythonREPLSmartSend.description%"
476462
]
477463
},
478464
"scope": "window",
@@ -604,14 +590,6 @@
604590
"scope": "machine-overridable",
605591
"type": "string"
606592
},
607-
"python.tensorBoard.logDirectory": {
608-
"default": "",
609-
"description": "%python.tensorBoard.logDirectory.description%",
610-
"scope": "resource",
611-
"type": "string",
612-
"markdownDeprecationMessage": "%python.tensorBoard.logDirectory.markdownDeprecationMessage%",
613-
"deprecationMessage": "%python.tensorBoard.logDirectory.deprecationMessage%"
614-
},
615593
"python.terminal.activateEnvInCurrentTerminal": {
616594
"default": false,
617595
"description": "%python.terminal.activateEnvInCurrentTerminal.description%",

src/client/common/application/commands.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import { CancellationToken, Position, TextDocument, Uri } from 'vscode';
77
import { Commands as LSCommands } from '../../activation/commands';
8-
import { TensorBoardEntrypoint, TensorBoardEntrypointTrigger } from '../../tensorBoard/constants';
98
import { Channel, Commands, CommandSource } from '../constants';
109
import { CreateEnvironmentOptions } from '../../pythonEnvironments/creation/proposed.createEnvApis';
1110

@@ -41,7 +40,6 @@ interface ICommandNameWithoutArgumentTypeMapping {
4140
[Commands.ClearStorage]: [];
4241
[Commands.CreateNewFile]: [];
4342
[Commands.ReportIssue]: [];
44-
[Commands.RefreshTensorBoard]: [];
4543
[LSCommands.RestartLS]: [];
4644
}
4745

@@ -100,7 +98,6 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu
10098
[Commands.Debug_In_Terminal]: [Uri];
10199
[Commands.Tests_Configure]: [undefined, undefined | CommandSource, undefined | Uri];
102100
[Commands.Tests_CopilotSetup]: [undefined | Uri];
103-
[Commands.LaunchTensorBoard]: [TensorBoardEntrypoint, TensorBoardEntrypointTrigger];
104101
['workbench.view.testing.focus']: [];
105102
['cursorMove']: [
106103
{

src/client/common/configSettings.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
IInterpreterSettings,
3131
IPythonSettings,
3232
IREPLSettings,
33-
ITensorBoardSettings,
3433
ITerminalSettings,
3534
Resource,
3635
} from './types';
@@ -107,8 +106,6 @@ export class PythonSettings implements IPythonSettings {
107106

108107
public autoComplete!: IAutoCompleteSettings;
109108

110-
public tensorBoard: ITensorBoardSettings | undefined;
111-
112109
public testing!: ITestingSettings;
113110

114111
public terminal!: ITerminalSettings;
@@ -386,14 +383,6 @@ export class PythonSettings implements IPythonSettings {
386383
optInto: [],
387384
optOutFrom: [],
388385
};
389-
390-
const tensorBoardSettings = systemVariables.resolveAny(
391-
pythonSettings.get<ITensorBoardSettings>('tensorBoard'),
392-
)!;
393-
this.tensorBoard = tensorBoardSettings || { logDirectory: '' };
394-
if (this.tensorBoard.logDirectory) {
395-
this.tensorBoard.logDirectory = getAbsolutePath(this.tensorBoard.logDirectory, workspaceRoot);
396-
}
397386
}
398387

399388
// eslint-disable-next-line class-methods-use-this

src/client/common/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ export namespace Commands {
5555
export const InstallPython = 'python.installPython';
5656
export const InstallPythonOnLinux = 'python.installPythonOnLinux';
5757
export const InstallPythonOnMac = 'python.installPythonOnMac';
58-
export const LaunchTensorBoard = 'python.launchTensorBoard';
5958
export const PickLocalProcess = 'python.pickLocalProcess';
60-
export const RefreshTensorBoard = 'python.refreshTensorBoard';
6159
export const ReportIssue = 'python.reportIssue';
6260
export const Set_Interpreter = 'python.setInterpreter';
6361
export const Set_ShebangInterpreter = 'python.setShebangInterpreter';

src/client/common/experiments/groups.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,3 @@ export enum DiscoveryUsingWorkers {
1919
export enum EnableTestAdapterRewrite {
2020
experiment = 'pythonTestAdapter',
2121
}
22-
23-
// Experiment to recommend installing the tensorboard extension.
24-
export enum RecommendTensobardExtension {
25-
experiment = 'pythonRecommendTensorboardExt',
26-
}

src/client/common/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,10 @@ export interface IPythonSettings {
177177
readonly languageServer: LanguageServerType;
178178
readonly languageServerIsDefault: boolean;
179179
readonly defaultInterpreterPath: string;
180-
readonly tensorBoard: ITensorBoardSettings | undefined;
181180
readonly REPL: IREPLSettings;
182181
register(): void;
183182
}
184183

185-
export interface ITensorBoardSettings {
186-
logDirectory: string | undefined;
187-
}
188-
189184
export interface IInterpreterSettings {
190185
infoVisibility: 'never' | 'onPythonRelated' | 'always';
191186
}

src/client/common/utils/localize.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ export namespace TensorBoard {
138138
export const upgradePrompt = l10n.t(
139139
'Integrated TensorBoard support is only available for TensorBoard >= 2.4.1. Would you like to upgrade your copy of TensorBoard?',
140140
);
141-
export const launchNativeTensorBoardSessionCodeLens = l10n.t('▶ Launch TensorBoard Session');
142-
export const launchNativeTensorBoardSessionCodeAction = l10n.t('Launch TensorBoard session');
143141
export const missingSourceFile = l10n.t(
144142
'The Python extension could not locate the requested source file on disk. Please manually specify the file.',
145143
);

src/client/telemetry/constants.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,11 @@ export enum EventName {
9090
JEDI_LANGUAGE_SERVER_READY = 'JEDI_LANGUAGE_SERVER.READY',
9191
JEDI_LANGUAGE_SERVER_REQUEST = 'JEDI_LANGUAGE_SERVER.REQUEST',
9292

93-
TENSORBOARD_SESSION_LAUNCH = 'TENSORBOARD.SESSION_LAUNCH',
94-
TENSORBOARD_SESSION_DURATION = 'TENSORBOARD.SESSION_DURATION',
95-
TENSORBOARD_SESSION_DAEMON_STARTUP_DURATION = 'TENSORBOARD.SESSION_DAEMON_STARTUP_DURATION',
96-
TENSORBOARD_LAUNCH_PROMPT_SELECTION = 'TENSORBOARD.LAUNCH_PROMPT_SELECTION',
97-
TENSORBOARD_SESSION_E2E_STARTUP_DURATION = 'TENSORBOARD.SESSION_E2E_STARTUP_DURATION',
98-
TENSORBOARD_ENTRYPOINT_SHOWN = 'TENSORBOARD.ENTRYPOINT_SHOWN',
9993
TENSORBOARD_INSTALL_PROMPT_SHOWN = 'TENSORBOARD.INSTALL_PROMPT_SHOWN',
10094
TENSORBOARD_INSTALL_PROMPT_SELECTION = 'TENSORBOARD.INSTALL_PROMPT_SELECTION',
10195
TENSORBOARD_DETECTED_IN_INTEGRATED_TERMINAL = 'TENSORBOARD_DETECTED_IN_INTEGRATED_TERMINAL',
10296
TENSORBOARD_PACKAGE_INSTALL_RESULT = 'TENSORBOARD.PACKAGE_INSTALL_RESULT',
10397
TENSORBOARD_TORCH_PROFILER_IMPORT = 'TENSORBOARD.TORCH_PROFILER_IMPORT',
104-
TENSORBOARD_JUMP_TO_SOURCE_REQUEST = 'TENSORBOARD_JUMP_TO_SOURCE_REQUEST',
105-
TENSORBOARD_JUMP_TO_SOURCE_FILE_NOT_FOUND = 'TENSORBOARD_JUMP_TO_SOURCE_FILE_NOT_FOUND',
10698

10799
ENVIRONMENT_CREATING = 'ENVIRONMENT.CREATING',
108100
ENVIRONMENT_CREATED = 'ENVIRONMENT.CREATED',

src/client/telemetry/index.ts

Lines changed: 1 addition & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ import { isPromise } from '../common/utils/async';
1111
import { StopWatch } from '../common/utils/stopWatch';
1212
import { ConsoleType, TriggerType } from '../debugger/types';
1313
import { EnvironmentType, PythonEnvironment } from '../pythonEnvironments/info';
14-
import {
15-
TensorBoardEntrypoint,
16-
TensorBoardEntrypointTrigger,
17-
TensorBoardPromptSelection,
18-
TensorBoardSessionStartResult,
19-
} from '../tensorBoard/constants';
14+
import { TensorBoardPromptSelection } from '../tensorBoard/constants';
2015
import { EventName } from './constants';
2116
import type { TestTool } from './types';
2217

@@ -2577,101 +2572,6 @@ export interface IEventNamePropertyMapping {
25772572
};
25782573

25792574
// TensorBoard integration events
2580-
/**
2581-
* Telemetry event sent after the user has clicked on an option in the prompt we display
2582-
* asking them if they want to launch an integrated TensorBoard session.
2583-
* `selection` is one of 'yes', 'no', or 'do not ask again'.
2584-
*/
2585-
/* __GDPR__
2586-
"tensorboard.launch_prompt_selection" : { "owner": "donjayamanne" }
2587-
*/
2588-
2589-
[EventName.TENSORBOARD_LAUNCH_PROMPT_SELECTION]: {
2590-
selection: TensorBoardPromptSelection;
2591-
};
2592-
/**
2593-
* Telemetry event sent after the python.launchTensorBoard command has been executed.
2594-
* The `entrypoint` property indicates whether the command was executed directly by the
2595-
* user from the command palette or from a codelens or the user clicking 'yes'
2596-
* on the launch prompt we display.
2597-
* The `trigger` property indicates whether the entrypoint was triggered by the user
2598-
* importing tensorboard, using tensorboard in a notebook, detected tfevent files in
2599-
* the workspace. For the palette entrypoint, the trigger is also 'palette'.
2600-
*/
2601-
/* __GDPR__
2602-
"tensorboard.session_launch" : {
2603-
"entrypoint" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
2604-
"trigger": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" }
2605-
}
2606-
*/
2607-
[EventName.TENSORBOARD_SESSION_LAUNCH]: {
2608-
entrypoint: TensorBoardEntrypoint;
2609-
trigger: TensorBoardEntrypointTrigger;
2610-
};
2611-
/**
2612-
* Telemetry event sent after we have attempted to create a tensorboard program instance
2613-
* by spawning a daemon to run the tensorboard_launcher.py script. The event is sent with
2614-
* `duration` which should never exceed 60_000ms. Depending on the value of `result`, `duration` means:
2615-
* 1. 'success' --> the total amount of time taken for the execObservable daemon to report successful TB session launch
2616-
* 2. 'canceled' --> the total amount of time that the user waited for the daemon to start before canceling launch
2617-
* 3. 'error' --> 60_000ms, i.e. we timed out waiting for the daemon to launch
2618-
* In the first two cases, `duration` should not be more than 60_000ms.
2619-
*/
2620-
/* __GDPR__
2621-
"tensorboard.session_daemon_startup_duration" : {
2622-
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
2623-
"result" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" }
2624-
}
2625-
*/
2626-
[EventName.TENSORBOARD_SESSION_DAEMON_STARTUP_DURATION]: {
2627-
result: TensorBoardSessionStartResult;
2628-
};
2629-
/**
2630-
* Telemetry event sent after the webview framing the TensorBoard website has been successfully shown.
2631-
* This event is sent with `duration` which represents the total time to create a TensorBoardSession.
2632-
* Note that this event is only sent if an integrated TensorBoard session is successfully created in full.
2633-
* This includes checking whether the tensorboard package is installed and installing it if it's not already
2634-
* installed, requesting the user to select a log directory, starting the tensorboard
2635-
* program instance in a daemon, and showing the TensorBoard UI in a webpanel, in that order.
2636-
*/
2637-
/* __GDPR__
2638-
"tensorboard.session_e2e_startup_duration" : {
2639-
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" }
2640-
}
2641-
*/
2642-
[EventName.TENSORBOARD_SESSION_E2E_STARTUP_DURATION]: never | undefined;
2643-
/**
2644-
* Telemetry event sent after the user has closed a TensorBoard webview panel. This event is
2645-
* sent with `duration` specifying the total duration of time that the TensorBoard session
2646-
* ran for before the user terminated the session.
2647-
*/
2648-
/* __GDPR__
2649-
"tensorboard.session_duration" : {
2650-
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" }
2651-
}
2652-
*/
2653-
[EventName.TENSORBOARD_SESSION_DURATION]: never | undefined;
2654-
/**
2655-
* Telemetry event sent when an entrypoint is displayed to the user. This event is sent once
2656-
* per entrypoint per session to minimize redundant events since codelenses
2657-
* can be displayed multiple times per file.
2658-
* The `entrypoint` property indicates whether the command was executed directly by the
2659-
* user from the command palette or from a codelens or the user clicking 'yes'
2660-
* on the launch prompt we display.
2661-
* The `trigger` property indicates whether the entrypoint was triggered by the user
2662-
* importing tensorboard, using tensorboard in a notebook, detected tfevent files in
2663-
* the workspace. For the palette entrypoint, the trigger is also 'palette'.
2664-
*/
2665-
/* __GDPR__
2666-
"tensorboard.entrypoint_shown" : {
2667-
"entrypoint" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
2668-
"trigger": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" }
2669-
}
2670-
*/
2671-
[EventName.TENSORBOARD_ENTRYPOINT_SHOWN]: {
2672-
entrypoint: TensorBoardEntrypoint;
2673-
trigger: TensorBoardEntrypointTrigger;
2674-
};
26752575
/**
26762576
* Telemetry event sent when the user is prompted to install Python packages that are
26772577
* dependencies for launching an integrated TensorBoard session.
@@ -2732,25 +2632,6 @@ export interface IEventNamePropertyMapping {
27322632
"tensorboard.torch_profiler_import" : { "owner": "donjayamanne" }
27332633
*/
27342634
[EventName.TENSORBOARD_TORCH_PROFILER_IMPORT]: never | undefined;
2735-
/**
2736-
* Telemetry event sent when the extension host receives a message from the
2737-
* TensorBoard webview containing a valid jump to source payload from the
2738-
* PyTorch profiler TensorBoard plugin.
2739-
*/
2740-
/* __GDPR__
2741-
"tensorboard_jump_to_source_request" : { "owner": "donjayamanne" }
2742-
*/
2743-
[EventName.TENSORBOARD_JUMP_TO_SOURCE_REQUEST]: never | undefined;
2744-
/**
2745-
* Telemetry event sent when the extension host receives a message from the
2746-
* TensorBoard webview containing a valid jump to source payload from the
2747-
* PyTorch profiler TensorBoard plugin, but the source file does not exist
2748-
* on the machine currently running TensorBoard.
2749-
*/
2750-
/* __GDPR__
2751-
"tensorboard_jump_to_source_file_not_found" : { "owner": "donjayamanne" }
2752-
*/
2753-
[EventName.TENSORBOARD_JUMP_TO_SOURCE_FILE_NOT_FOUND]: never | undefined;
27542635
[EventName.TENSORBOARD_DETECTED_IN_INTEGRATED_TERMINAL]: never | undefined;
27552636
/**
27562637
* Telemetry event sent before creating an environment.

src/client/tensorBoard/helpers.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
import { noop } from '../common/utils/misc';
5-
64
// While it is uncommon for users to `import tensorboard`, TensorBoard is frequently
75
// included as a submodule of other packages, e.g. torch.utils.tensorboard.
86
// This is a modified version of the regex from src/client/telemetry/importTracker.ts
@@ -11,28 +9,3 @@ import { noop } from '../common/utils/misc';
119

1210
// RegEx to match `import torch.profiler` or `from torch import profiler`
1311
export const TorchProfilerImportRegEx = /^\s*(?:import (?:(\w+, )*torch\.profiler(, \w+)*))|(?:from torch import (?:(\w+, )*profiler(, \w+)*))/;
14-
// RegEx to match `from torch.utils import tensorboard`, `import torch.utils.tensorboard`, `import tensorboardX`, `import tensorboard`
15-
const TensorBoardImportRegEx = /^\s*(?:from torch\.utils\.tensorboard import \w+)|(?:from torch\.utils import (?:(\w+, )*tensorboard(, \w+)*))|(?:from tensorboardX import \w+)|(?:import (\w+, )*((torch\.utils\.tensorboard)|(tensorboardX)|(tensorboard))(, \w+)*)/;
16-
17-
export function containsTensorBoardImport(lines: (string | undefined)[]): boolean {
18-
try {
19-
for (const s of lines) {
20-
if (s && (TensorBoardImportRegEx.test(s) || TorchProfilerImportRegEx.test(s))) {
21-
return true;
22-
}
23-
}
24-
} catch {
25-
// Don't care about failures.
26-
noop();
27-
}
28-
return false;
29-
}
30-
31-
export function containsNotebookExtension(lines: (string | undefined)[]): boolean {
32-
for (const s of lines) {
33-
if (s?.startsWith('%tensorboard') || s?.startsWith('%load_ext tensorboard')) {
34-
return true;
35-
}
36-
}
37-
return false;
38-
}

0 commit comments

Comments
 (0)