Skip to content

Commit

Permalink
Remove dead tensorboard code (#24641)
Browse files Browse the repository at this point in the history
Fixes #23093
  • Loading branch information
DonJayamanne authored Dec 19, 2024
1 parent 25ecab8 commit de988ff
Show file tree
Hide file tree
Showing 30 changed files with 16 additions and 2,384 deletions.
26 changes: 2 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,18 +332,6 @@
"command": "python.execInREPL",
"title": "%python.command.python.execInREPL.title%"
},
{
"category": "Python",
"command": "python.launchTensorBoard",
"title": "%python.command.python.launchTensorBoard.title%"
},
{
"category": "Python",
"command": "python.refreshTensorBoard",
"enablement": "python.hasActiveTensorBoardSession",
"icon": "$(refresh)",
"title": "%python.command.python.refreshTensorBoard.title%"
},
{
"category": "Python",
"command": "python.reportIssue",
Expand Down Expand Up @@ -461,8 +449,7 @@
"pythonTerminalEnvVarActivation",
"pythonDiscoveryUsingWorkers",
"pythonTestAdapter",
"pythonREPLSmartSend",
"pythonRecommendTensorboardExt"
"pythonREPLSmartSend"
],
"enumDescriptions": [
"%python.experiments.All.description%",
Expand All @@ -471,8 +458,7 @@
"%python.experiments.pythonTerminalEnvVarActivation.description%",
"%python.experiments.pythonDiscoveryUsingWorkers.description%",
"%python.experiments.pythonTestAdapter.description%",
"%python.experiments.pythonREPLSmartSend.description%",
"%python.experiments.pythonRecommendTensorboardExt.description%"
"%python.experiments.pythonREPLSmartSend.description%"
]
},
"scope": "window",
Expand Down Expand Up @@ -604,14 +590,6 @@
"scope": "machine-overridable",
"type": "string"
},
"python.tensorBoard.logDirectory": {
"default": "",
"description": "%python.tensorBoard.logDirectory.description%",
"scope": "resource",
"type": "string",
"markdownDeprecationMessage": "%python.tensorBoard.logDirectory.markdownDeprecationMessage%",
"deprecationMessage": "%python.tensorBoard.logDirectory.deprecationMessage%"
},
"python.terminal.activateEnvInCurrentTerminal": {
"default": false,
"description": "%python.terminal.activateEnvInCurrentTerminal.description%",
Expand Down
3 changes: 0 additions & 3 deletions src/client/common/application/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

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

Expand Down Expand Up @@ -41,7 +40,6 @@ interface ICommandNameWithoutArgumentTypeMapping {
[Commands.ClearStorage]: [];
[Commands.CreateNewFile]: [];
[Commands.ReportIssue]: [];
[Commands.RefreshTensorBoard]: [];
[LSCommands.RestartLS]: [];
}

Expand Down Expand Up @@ -100,7 +98,6 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu
[Commands.Debug_In_Terminal]: [Uri];
[Commands.Tests_Configure]: [undefined, undefined | CommandSource, undefined | Uri];
[Commands.Tests_CopilotSetup]: [undefined | Uri];
[Commands.LaunchTensorBoard]: [TensorBoardEntrypoint, TensorBoardEntrypointTrigger];
['workbench.view.testing.focus']: [];
['cursorMove']: [
{
Expand Down
11 changes: 0 additions & 11 deletions src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
IInterpreterSettings,
IPythonSettings,
IREPLSettings,
ITensorBoardSettings,
ITerminalSettings,
Resource,
} from './types';
Expand Down Expand Up @@ -107,8 +106,6 @@ export class PythonSettings implements IPythonSettings {

public autoComplete!: IAutoCompleteSettings;

public tensorBoard: ITensorBoardSettings | undefined;

public testing!: ITestingSettings;

public terminal!: ITerminalSettings;
Expand Down Expand Up @@ -386,14 +383,6 @@ export class PythonSettings implements IPythonSettings {
optInto: [],
optOutFrom: [],
};

const tensorBoardSettings = systemVariables.resolveAny(
pythonSettings.get<ITensorBoardSettings>('tensorBoard'),
)!;
this.tensorBoard = tensorBoardSettings || { logDirectory: '' };
if (this.tensorBoard.logDirectory) {
this.tensorBoard.logDirectory = getAbsolutePath(this.tensorBoard.logDirectory, workspaceRoot);
}
}

// eslint-disable-next-line class-methods-use-this
Expand Down
2 changes: 0 additions & 2 deletions src/client/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ export namespace Commands {
export const InstallPython = 'python.installPython';
export const InstallPythonOnLinux = 'python.installPythonOnLinux';
export const InstallPythonOnMac = 'python.installPythonOnMac';
export const LaunchTensorBoard = 'python.launchTensorBoard';
export const PickLocalProcess = 'python.pickLocalProcess';
export const RefreshTensorBoard = 'python.refreshTensorBoard';
export const ReportIssue = 'python.reportIssue';
export const Set_Interpreter = 'python.setInterpreter';
export const Set_ShebangInterpreter = 'python.setShebangInterpreter';
Expand Down
5 changes: 0 additions & 5 deletions src/client/common/experiments/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,3 @@ export enum DiscoveryUsingWorkers {
export enum EnableTestAdapterRewrite {
experiment = 'pythonTestAdapter',
}

// Experiment to recommend installing the tensorboard extension.
export enum RecommendTensobardExtension {
experiment = 'pythonRecommendTensorboardExt',
}
5 changes: 0 additions & 5 deletions src/client/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,10 @@ export interface IPythonSettings {
readonly languageServer: LanguageServerType;
readonly languageServerIsDefault: boolean;
readonly defaultInterpreterPath: string;
readonly tensorBoard: ITensorBoardSettings | undefined;
readonly REPL: IREPLSettings;
register(): void;
}

export interface ITensorBoardSettings {
logDirectory: string | undefined;
}

export interface IInterpreterSettings {
infoVisibility: 'never' | 'onPythonRelated' | 'always';
}
Expand Down
2 changes: 0 additions & 2 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ export namespace TensorBoard {
export const upgradePrompt = l10n.t(
'Integrated TensorBoard support is only available for TensorBoard >= 2.4.1. Would you like to upgrade your copy of TensorBoard?',
);
export const launchNativeTensorBoardSessionCodeLens = l10n.t('▶ Launch TensorBoard Session');
export const launchNativeTensorBoardSessionCodeAction = l10n.t('Launch TensorBoard session');
export const missingSourceFile = l10n.t(
'The Python extension could not locate the requested source file on disk. Please manually specify the file.',
);
Expand Down
8 changes: 0 additions & 8 deletions src/client/telemetry/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,11 @@ export enum EventName {
JEDI_LANGUAGE_SERVER_READY = 'JEDI_LANGUAGE_SERVER.READY',
JEDI_LANGUAGE_SERVER_REQUEST = 'JEDI_LANGUAGE_SERVER.REQUEST',

TENSORBOARD_SESSION_LAUNCH = 'TENSORBOARD.SESSION_LAUNCH',
TENSORBOARD_SESSION_DURATION = 'TENSORBOARD.SESSION_DURATION',
TENSORBOARD_SESSION_DAEMON_STARTUP_DURATION = 'TENSORBOARD.SESSION_DAEMON_STARTUP_DURATION',
TENSORBOARD_LAUNCH_PROMPT_SELECTION = 'TENSORBOARD.LAUNCH_PROMPT_SELECTION',
TENSORBOARD_SESSION_E2E_STARTUP_DURATION = 'TENSORBOARD.SESSION_E2E_STARTUP_DURATION',
TENSORBOARD_ENTRYPOINT_SHOWN = 'TENSORBOARD.ENTRYPOINT_SHOWN',
TENSORBOARD_INSTALL_PROMPT_SHOWN = 'TENSORBOARD.INSTALL_PROMPT_SHOWN',
TENSORBOARD_INSTALL_PROMPT_SELECTION = 'TENSORBOARD.INSTALL_PROMPT_SELECTION',
TENSORBOARD_DETECTED_IN_INTEGRATED_TERMINAL = 'TENSORBOARD_DETECTED_IN_INTEGRATED_TERMINAL',
TENSORBOARD_PACKAGE_INSTALL_RESULT = 'TENSORBOARD.PACKAGE_INSTALL_RESULT',
TENSORBOARD_TORCH_PROFILER_IMPORT = 'TENSORBOARD.TORCH_PROFILER_IMPORT',
TENSORBOARD_JUMP_TO_SOURCE_REQUEST = 'TENSORBOARD_JUMP_TO_SOURCE_REQUEST',
TENSORBOARD_JUMP_TO_SOURCE_FILE_NOT_FOUND = 'TENSORBOARD_JUMP_TO_SOURCE_FILE_NOT_FOUND',

ENVIRONMENT_CREATING = 'ENVIRONMENT.CREATING',
ENVIRONMENT_CREATED = 'ENVIRONMENT.CREATED',
Expand Down
121 changes: 1 addition & 120 deletions src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ import { isPromise } from '../common/utils/async';
import { StopWatch } from '../common/utils/stopWatch';
import { ConsoleType, TriggerType } from '../debugger/types';
import { EnvironmentType, PythonEnvironment } from '../pythonEnvironments/info';
import {
TensorBoardEntrypoint,
TensorBoardEntrypointTrigger,
TensorBoardPromptSelection,
TensorBoardSessionStartResult,
} from '../tensorBoard/constants';
import { TensorBoardPromptSelection } from '../tensorBoard/constants';
import { EventName } from './constants';
import type { TestTool } from './types';

Expand Down Expand Up @@ -2577,101 +2572,6 @@ export interface IEventNamePropertyMapping {
};

// TensorBoard integration events
/**
* Telemetry event sent after the user has clicked on an option in the prompt we display
* asking them if they want to launch an integrated TensorBoard session.
* `selection` is one of 'yes', 'no', or 'do not ask again'.
*/
/* __GDPR__
"tensorboard.launch_prompt_selection" : { "owner": "donjayamanne" }
*/

[EventName.TENSORBOARD_LAUNCH_PROMPT_SELECTION]: {
selection: TensorBoardPromptSelection;
};
/**
* Telemetry event sent after the python.launchTensorBoard command has been executed.
* The `entrypoint` property indicates whether the command was executed directly by the
* user from the command palette or from a codelens or the user clicking 'yes'
* on the launch prompt we display.
* The `trigger` property indicates whether the entrypoint was triggered by the user
* importing tensorboard, using tensorboard in a notebook, detected tfevent files in
* the workspace. For the palette entrypoint, the trigger is also 'palette'.
*/
/* __GDPR__
"tensorboard.session_launch" : {
"entrypoint" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
"trigger": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" }
}
*/
[EventName.TENSORBOARD_SESSION_LAUNCH]: {
entrypoint: TensorBoardEntrypoint;
trigger: TensorBoardEntrypointTrigger;
};
/**
* Telemetry event sent after we have attempted to create a tensorboard program instance
* by spawning a daemon to run the tensorboard_launcher.py script. The event is sent with
* `duration` which should never exceed 60_000ms. Depending on the value of `result`, `duration` means:
* 1. 'success' --> the total amount of time taken for the execObservable daemon to report successful TB session launch
* 2. 'canceled' --> the total amount of time that the user waited for the daemon to start before canceling launch
* 3. 'error' --> 60_000ms, i.e. we timed out waiting for the daemon to launch
* In the first two cases, `duration` should not be more than 60_000ms.
*/
/* __GDPR__
"tensorboard.session_daemon_startup_duration" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
"result" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" }
}
*/
[EventName.TENSORBOARD_SESSION_DAEMON_STARTUP_DURATION]: {
result: TensorBoardSessionStartResult;
};
/**
* Telemetry event sent after the webview framing the TensorBoard website has been successfully shown.
* This event is sent with `duration` which represents the total time to create a TensorBoardSession.
* Note that this event is only sent if an integrated TensorBoard session is successfully created in full.
* This includes checking whether the tensorboard package is installed and installing it if it's not already
* installed, requesting the user to select a log directory, starting the tensorboard
* program instance in a daemon, and showing the TensorBoard UI in a webpanel, in that order.
*/
/* __GDPR__
"tensorboard.session_e2e_startup_duration" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" }
}
*/
[EventName.TENSORBOARD_SESSION_E2E_STARTUP_DURATION]: never | undefined;
/**
* Telemetry event sent after the user has closed a TensorBoard webview panel. This event is
* sent with `duration` specifying the total duration of time that the TensorBoard session
* ran for before the user terminated the session.
*/
/* __GDPR__
"tensorboard.session_duration" : {
"duration" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" }
}
*/
[EventName.TENSORBOARD_SESSION_DURATION]: never | undefined;
/**
* Telemetry event sent when an entrypoint is displayed to the user. This event is sent once
* per entrypoint per session to minimize redundant events since codelenses
* can be displayed multiple times per file.
* The `entrypoint` property indicates whether the command was executed directly by the
* user from the command palette or from a codelens or the user clicking 'yes'
* on the launch prompt we display.
* The `trigger` property indicates whether the entrypoint was triggered by the user
* importing tensorboard, using tensorboard in a notebook, detected tfevent files in
* the workspace. For the palette entrypoint, the trigger is also 'palette'.
*/
/* __GDPR__
"tensorboard.entrypoint_shown" : {
"entrypoint" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" },
"trigger": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "donjayamanne" }
}
*/
[EventName.TENSORBOARD_ENTRYPOINT_SHOWN]: {
entrypoint: TensorBoardEntrypoint;
trigger: TensorBoardEntrypointTrigger;
};
/**
* Telemetry event sent when the user is prompted to install Python packages that are
* dependencies for launching an integrated TensorBoard session.
Expand Down Expand Up @@ -2732,25 +2632,6 @@ export interface IEventNamePropertyMapping {
"tensorboard.torch_profiler_import" : { "owner": "donjayamanne" }
*/
[EventName.TENSORBOARD_TORCH_PROFILER_IMPORT]: never | undefined;
/**
* Telemetry event sent when the extension host receives a message from the
* TensorBoard webview containing a valid jump to source payload from the
* PyTorch profiler TensorBoard plugin.
*/
/* __GDPR__
"tensorboard_jump_to_source_request" : { "owner": "donjayamanne" }
*/
[EventName.TENSORBOARD_JUMP_TO_SOURCE_REQUEST]: never | undefined;
/**
* Telemetry event sent when the extension host receives a message from the
* TensorBoard webview containing a valid jump to source payload from the
* PyTorch profiler TensorBoard plugin, but the source file does not exist
* on the machine currently running TensorBoard.
*/
/* __GDPR__
"tensorboard_jump_to_source_file_not_found" : { "owner": "donjayamanne" }
*/
[EventName.TENSORBOARD_JUMP_TO_SOURCE_FILE_NOT_FOUND]: never | undefined;
[EventName.TENSORBOARD_DETECTED_IN_INTEGRATED_TERMINAL]: never | undefined;
/**
* Telemetry event sent before creating an environment.
Expand Down
27 changes: 0 additions & 27 deletions src/client/tensorBoard/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { noop } from '../common/utils/misc';

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

// RegEx to match `import torch.profiler` or `from torch import profiler`
export const TorchProfilerImportRegEx = /^\s*(?:import (?:(\w+, )*torch\.profiler(, \w+)*))|(?:from torch import (?:(\w+, )*profiler(, \w+)*))/;
// RegEx to match `from torch.utils import tensorboard`, `import torch.utils.tensorboard`, `import tensorboardX`, `import tensorboard`
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+)*)/;

export function containsTensorBoardImport(lines: (string | undefined)[]): boolean {
try {
for (const s of lines) {
if (s && (TensorBoardImportRegEx.test(s) || TorchProfilerImportRegEx.test(s))) {
return true;
}
}
} catch {
// Don't care about failures.
noop();
}
return false;
}

export function containsNotebookExtension(lines: (string | undefined)[]): boolean {
for (const s of lines) {
if (s?.startsWith('%tensorboard') || s?.startsWith('%load_ext tensorboard')) {
return true;
}
}
return false;
}
Loading

0 comments on commit de988ff

Please sign in to comment.