Skip to content

Commit cf1f9b4

Browse files
authored
remove expensive filewatcher for tensorboard (microsoft#18102)
* remove the expensive file search for tensorboard prompt
1 parent ab2ef48 commit cf1f9b4

2 files changed

Lines changed: 0 additions & 54 deletions

File tree

src/client/tensorBoard/tensorBoardFileWatcher.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { IExtensionSingleActivationService } from '../activation/types';
77
import { IWorkspaceService } from '../common/application/types';
88
import { NativeTensorBoard } from '../common/experiments/groups';
99
import { IDisposableRegistry, IExperimentService } from '../common/types';
10-
import { traceError } from '../logging';
1110
import { TensorBoardEntrypointTrigger } from './constants';
1211
import { TensorBoardPrompt } from './tensorBoardPrompt';
1312

@@ -40,10 +39,6 @@ export class TensorBoardFileWatcher implements IExtensionSingleActivationService
4039
return;
4140
}
4241

43-
// Look for pre-existing tfevent files, as the file watchers will only pick up files
44-
// created or changed after they have been registered and hooked up. Just one will do.
45-
await this.promptIfWorkspaceHasPreexistingFiles();
46-
4742
// If the user creates or changes tfevent files, listen for those too
4843
for (const folder of folders) {
4944
this.createFileSystemWatcher(folder);
@@ -55,22 +50,6 @@ export class TensorBoardFileWatcher implements IExtensionSingleActivationService
5550
);
5651
}
5752

58-
private async promptIfWorkspaceHasPreexistingFiles() {
59-
try {
60-
for (const pattern of this.globPatterns) {
61-
const matches = await this.workspaceService.findFiles(pattern, undefined, 1);
62-
if (matches.length > 0) {
63-
await this.tensorBoardPrompt.showNativeTensorBoardPrompt(TensorBoardEntrypointTrigger.tfeventfiles);
64-
return;
65-
}
66-
}
67-
} catch (e) {
68-
traceError(
69-
`Failed to prompt to launch TensorBoard session based on preexisting tfevent files in workspace: ${e}`,
70-
);
71-
}
72-
}
73-
7453
private async updateFileSystemWatchers(event: WorkspaceFoldersChangeEvent) {
7554
for (const added of event.added) {
7655
this.createFileSystemWatcher(added);

src/test/tensorBoard/tensorBoardFileWatcher.test.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -52,39 +52,6 @@ suite('TensorBoard file system watcher', async () => {
5252
}
5353
});
5454

55-
test('Preexisting tfeventfile in workspace root results in prompt being shown', async () => {
56-
await createFiles(currentDirectory);
57-
await configureStubsAndActivate();
58-
assert.ok(showNativeTensorBoardPrompt.called);
59-
});
60-
61-
test('Preexisting tfeventfile one directory down results in prompt being shown', async () => {
62-
const dir1 = path.join(currentDirectory, '1');
63-
await createFiles(dir1);
64-
await configureStubsAndActivate();
65-
assert.ok(showNativeTensorBoardPrompt.called);
66-
});
67-
68-
test('Preexisting tfeventfile two directories down results in prompt being called', async () => {
69-
const dir2 = path.join(currentDirectory, '1', '2');
70-
await createFiles(dir2);
71-
await configureStubsAndActivate();
72-
assert.ok(showNativeTensorBoardPrompt.called);
73-
});
74-
75-
test('Preexisting tfeventfile three directories down does not result in prompt being called', async () => {
76-
const dir3 = path.join(currentDirectory, '1', '2', '3');
77-
await createFiles(dir3);
78-
await configureStubsAndActivate();
79-
assert.ok(showNativeTensorBoardPrompt.notCalled);
80-
});
81-
82-
test('Creating tfeventfile in workspace root results in prompt being shown', async () => {
83-
await configureStubsAndActivate();
84-
await createFiles(currentDirectory);
85-
await waitForCondition(async () => showNativeTensorBoardPrompt.called, 5000, 'Prompt not shown');
86-
});
87-
8855
test('Creating tfeventfile one directory down results in prompt being shown', async () => {
8956
const dir1 = path.join(currentDirectory, '1');
9057
await configureStubsAndActivate();

0 commit comments

Comments
 (0)