forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for a tensorboard experiment (#22215)
- Loading branch information
1 parent
1310bd6
commit f438262
Showing
16 changed files
with
380 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,67 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { extensions } from 'vscode'; | ||
import { Disposable, EventEmitter, commands, extensions, l10n, window } from 'vscode'; | ||
import { inject, injectable } from 'inversify'; | ||
import { IDisposable, IDisposableRegistry, IExperimentService } from '../common/types'; | ||
import { RecommendTensobardExtension } from '../common/experiments/groups'; | ||
import { TENSORBOARD_EXTENSION_ID } from '../common/constants'; | ||
|
||
export function useNewTensorboardExtension(): boolean { | ||
return !!extensions.getExtension('ms-toolsai.tensorboard'); | ||
@injectable() | ||
export class TensorboardExperiment { | ||
private readonly _onDidChange = new EventEmitter<void>(); | ||
|
||
public readonly onDidChange = this._onDidChange.event; | ||
|
||
private readonly toDisposeWhenTensobardIsInstalled: IDisposable[] = []; | ||
|
||
public static get isTensorboardExtensionInstalled(): boolean { | ||
return !!extensions.getExtension(TENSORBOARD_EXTENSION_ID); | ||
} | ||
|
||
private readonly isExperimentEnabled: boolean; | ||
|
||
constructor( | ||
@inject(IDisposableRegistry) disposables: IDisposableRegistry, | ||
@inject(IExperimentService) experiments: IExperimentService, | ||
) { | ||
this.isExperimentEnabled = experiments.inExperimentSync(RecommendTensobardExtension.experiment); | ||
disposables.push(this._onDidChange); | ||
extensions.onDidChange( | ||
() => | ||
TensorboardExperiment.isTensorboardExtensionInstalled | ||
? Disposable.from(...this.toDisposeWhenTensobardIsInstalled).dispose() | ||
: undefined, | ||
this, | ||
disposables, | ||
); | ||
} | ||
|
||
public recommendAndUseNewExtension(): 'continueWithPythonExtension' | 'usingTensorboardExtension' { | ||
if (!this.isExperimentEnabled) { | ||
return 'continueWithPythonExtension'; | ||
} | ||
if (TensorboardExperiment.isTensorboardExtensionInstalled) { | ||
return 'usingTensorboardExtension'; | ||
} | ||
const install = l10n.t('Install Tensorboard Extension'); | ||
window | ||
.showInformationMessage( | ||
l10n.t( | ||
'Install the TensorBoard extension to use the this functionality. Once installed, select the command `Launch Tensorboard`.', | ||
), | ||
{ modal: true }, | ||
install, | ||
) | ||
.then((result): void => { | ||
if (result === install) { | ||
void commands.executeCommand('workbench.extensions.installExtension', TENSORBOARD_EXTENSION_ID); | ||
} | ||
}); | ||
return 'usingTensorboardExtension'; | ||
} | ||
|
||
public disposeOnInstallingTensorboard(disposabe: IDisposable): void { | ||
this.toDisposeWhenTensobardIsInstalled.push(disposabe); | ||
} | ||
} |
Oops, something went wrong.
f438262
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
USPS 9270390226081312379488, Arrived Shipping Partner Facility, USPS Awaiting Item 11/22/2023 6:08am BIRMINGHAM AL 35210 Reply STOP to cancel
f438262
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http://www.sorbs.net/lookup.shtml
f438262
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
USPS 9270390226081312379488, Delivered, In/At Mailbox 11/25/2023 4:06pm JASPER AL 35503 Reply STOP to cancel
f438262
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
USPS 92001903281679016460900029, Shipping Label Created, USPS Awaiting Item 11/23/2023 6:09am HUNTSVILLE AL 35801 Reply STOP to cancel
f438262
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<#> 26793 is your Facebook code
Laz+nxCarLW
f438262
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q