Skip to content

Commit ea39336

Browse files
(bug fix): Skipping sagemaker extension activation for non sagemaker environments (#189)
Co-authored-by: Sri Aakash Mandavilli <srmanda@amazon.com>
1 parent f3d3595 commit ea39336

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

patches/sagemaker/sagemaker-extension.diff

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Index: code-editor-src/extensions/sagemaker-extension/src/extension.ts
88
===================================================================
99
--- /dev/null
1010
+++ code-editor-src/extensions/sagemaker-extension/src/extension.ts
11-
@@ -0,0 +1,172 @@
11+
@@ -0,0 +1,178 @@
1212
+import * as vscode from 'vscode';
1313
+import * as fs from 'fs';
1414
+import { SessionWarning } from "./sessionWarning";
@@ -166,7 +166,13 @@ Index: code-editor-src/extensions/sagemaker-extension/src/extension.ts
166166
+
167167
+export function activate(context: vscode.ExtensionContext) {
168168
+
169-
+ // TODO: log activation of extension
169+
+ // this extension will only activate within a sagemaker app
170+
+ const isSageMakerApp = !!process.env?.SAGEMAKER_APP_TYPE_LOWERCASE;
171+
+ if (!isSageMakerApp) {
172+
+ console.log('Skipping activation of Sagemaker Extension...');
173+
+ return;
174+
+ }
175+
+
170176
+ console.log('Activating Sagemaker Extension...');
171177
+
172178
+ // execute the get cookie command and save the data to cookies

patches/sagemaker/sagemaker-extensions-sync.diff

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Index: code-editor-src/extensions/sagemaker-extensions-sync/src/extension.ts
147147
===================================================================
148148
--- /dev/null
149149
+++ code-editor-src/extensions/sagemaker-extensions-sync/src/extension.ts
150-
@@ -0,0 +1,100 @@
150+
@@ -0,0 +1,103 @@
151151
+import * as process from "process";
152152
+import * as vscode from 'vscode';
153153
+
@@ -169,9 +169,12 @@ Index: code-editor-src/extensions/sagemaker-extensions-sync/src/extension.ts
169169
+ // this extension will only activate within a sagemaker app
170170
+ const isSageMakerApp = !!process.env?.SAGEMAKER_APP_TYPE_LOWERCASE;
171171
+ if (!isSageMakerApp) {
172+
+ console.log('Skipping activation of Sagemaker Extension Sync...');
172173
+ return;
173174
+ }
174175
+
176+
+ console.log('Activating Sagemaker Extension Sync...');
177+
+
175178
+ // get installed extensions. this could be different from pvExtensions b/c vscode sometimes doesn't delete the assets
176179
+ // for an old extension when uninstalling or changing versions
177180
+ const installedExtensions = new Set(await getInstalledExtensions());

0 commit comments

Comments
 (0)