Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 35 additions & 25 deletions patches/sagemaker/sagemaker-extension-smus-support.diff
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Index: code-editor-src/extensions/sagemaker-extension/src/constant.ts
Index: third-party-src/extensions/sagemaker-extension/src/constant.ts
===================================================================
--- code-editor-src.orig/extensions/sagemaker-extension/src/constant.ts
+++ code-editor-src/extensions/sagemaker-extension/src/constant.ts
--- third-party-src.orig/extensions/sagemaker-extension/src/constant.ts
+++ third-party-src/extensions/sagemaker-extension/src/constant.ts
@@ -27,6 +27,10 @@ export const FIVE_MINUTES_INTERVAL_MILLI

export const SAGEMAKER_METADATA_PATH = '/opt/ml/metadata/resource-metadata.json';
Expand All @@ -25,14 +25,10 @@ Index: code-editor-src/extensions/sagemaker-extension/src/constant.ts
};
export function isSSOMode(cookie: SagemakerCookie) {
return (cookie.authMode === AUTH_MODE.SSO)
@@ -69,4 +78,35 @@ export function getExpiryTime(cookie: Sa
} else {
return -1;
@@ -71,6 +80,37 @@ export function getExpiryTime(cookie: Sa
}
-}
\ No newline at end of file
+}
+
}

+/**
+ * Constructs the SMUS portal URL using domain, region, and project information
+ * Returns null if not in SMUS environment or if required fields are missing
Expand Down Expand Up @@ -63,10 +59,21 @@ Index: code-editor-src/extensions/sagemaker-extension/src/constant.ts
+
+ return `https://${DataZoneDomainId}.sagemaker.${DataZoneDomainRegion}.on.aws/projects/${DataZoneProjectId}/overview`;
+}
Index: code-editor-src/extensions/sagemaker-extension/src/extension.ts
+
// Capacity Block notification constants - configurable via environment variables
// Default values (in milliseconds)
const DEFAULT_THIRTY_MINUTES_MILLIS = 30 * 60 * 1000;
@@ -111,4 +151,4 @@ export interface CapacityBlockMetadata {

export interface SagemakerResourceInternalMetadata {
CapacityBlock?: CapacityBlockMetadata;
-}
\ No newline at end of file
+}
Index: third-party-src/extensions/sagemaker-extension/src/extension.ts
===================================================================
--- code-editor-src.orig/extensions/sagemaker-extension/src/extension.ts
+++ code-editor-src/extensions/sagemaker-extension/src/extension.ts
--- third-party-src.orig/extensions/sagemaker-extension/src/extension.ts
+++ third-party-src/extensions/sagemaker-extension/src/extension.ts
@@ -11,7 +11,8 @@ import {
WARNING_BUTTON_SAVE_AND_RENEW_SESSION,
SagemakerCookie,
Expand All @@ -75,11 +82,11 @@ Index: code-editor-src/extensions/sagemaker-extension/src/extension.ts
+ getExpiryTime,
+ getSmusVscodePortalUrl
} from "./constant";
import * as console from "console";
import { NotificationManager } from './notificationManager';
import { createCapacityBlockNotificationConfig } from './capacityBlockWarning';
@@ -26,6 +27,24 @@ let notificationManager: NotificationMan


@@ -19,6 +20,24 @@ import * as console from "console";
const PARSE_SAGEMAKER_COOKIE_COMMAND = 'sagemaker.parseCookies';
const ENABLE_AUTO_UPDATE_COMMAND = 'workbench.extensions.action.enableAutoUpdate';

+// Global redirect URL for SMUS environment
+let smusRedirectUrl: string | null = null;
Expand All @@ -102,7 +109,7 @@ Index: code-editor-src/extensions/sagemaker-extension/src/extension.ts
function showWarningDialog() {
vscode.commands.executeCommand(PARSE_SAGEMAKER_COOKIE_COMMAND).then(response => {

@@ -59,11 +78,12 @@ function showWarningDialog() {
@@ -66,11 +85,12 @@ function showWarningDialog() {
}

function signInError(sagemakerCookie: SagemakerCookie) {
Expand All @@ -116,7 +123,7 @@ Index: code-editor-src/extensions/sagemaker-extension/src/extension.ts
}
});
}
@@ -94,32 +114,21 @@ function saveWorkspace() {
@@ -101,32 +121,21 @@ function saveWorkspace() {
});
}
function renewSession(sagemakerCookie: SagemakerCookie) {
Expand Down Expand Up @@ -158,7 +165,7 @@ Index: code-editor-src/extensions/sagemaker-extension/src/extension.ts
}

// Render warning message regarding auto upgrade disabled
@@ -158,6 +167,9 @@ export function activate(context: vscode
@@ -177,6 +186,9 @@ export function activate(context: vscode
// TODO: log activation of extension
console.log('Activating Sagemaker Extension...');

Expand All @@ -168,15 +175,18 @@ Index: code-editor-src/extensions/sagemaker-extension/src/extension.ts
// execute the get cookie command and save the data to cookies
vscode.commands.executeCommand(PARSE_SAGEMAKER_COOKIE_COMMAND).then(r => {

@@ -170,3 +182,11 @@ export function activate(context: vscode
// render warning message regarding auto upgrade disabled
renderExtensionAutoUpgradeDisabledNotification();
@@ -194,6 +206,14 @@ export function activate(context: vscode
}
+
+/**
/**
+ * Returns the appropriate redirect URL based on the environment
+ * Uses SMUS URL if available, falls back to original redirect URL
+ */
+function getRedirectUrl(sagemakerCookie: SagemakerCookie): string {
+ return smusRedirectUrl || sagemakerCookie.redirectURL;
+}
+
+/**
* Called when extension is deactivated
*/
export function deactivate(): void {
Loading