Skip to content

Commit c754300

Browse files
committed
Fix singleton window bug
1 parent c39a8f0 commit c754300

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

packages/core/src/awsService/sagemaker/commands.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ export async function deeplinkConnect(
132132

133133
try {
134134
let connectionType = 'sm_dl'
135-
if (domain === '') {
135+
if (domain === '' && eksClusterArn) {
136+
const { accountId, region, clusterName } = parseEKSClusterArn(eksClusterArn)
136137
connectionType = 'sm_hp'
138+
session = `${workspaceName}_${namespace}_${clusterName}_${region}_${accountId}`
137139
}
138140
const remoteEnv = await prepareDevEnvConnection(
139141
connectionIdentifier,
@@ -179,6 +181,17 @@ export async function deeplinkConnect(
179181
}
180182
}
181183

184+
function parseEKSClusterArn(eksClusterArn: string): { accountId: string; region: string; clusterName: string } {
185+
const parts = eksClusterArn.split(':')
186+
if (parts.length !== 6) {
187+
throw new Error(`Invalid EKS cluster ARN: ${eksClusterArn}`)
188+
}
189+
const accountId = parts[4]
190+
const region = parts[3]
191+
const clusterName = parts[5].split('/')[1]
192+
return { accountId, region, clusterName }
193+
}
194+
182195
export async function stopSpace(
183196
node: SagemakerSpaceNode | SagemakerUnifiedStudioSpaceNode,
184197
ctx: vscode.ExtensionContext,

packages/core/src/awsService/sagemaker/model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export async function prepareDevEnvConnection(
186186

187187
const hyperPodEnv: NodeJS.ProcessEnv = {
188188
AWS_REGION: region,
189-
SESSION_ID: session || '',
189+
SESSION_ID: hostname || '',
190190
STREAM_URL: decodedWsUrl,
191191
TOKEN: decodedToken,
192192
AWS_SSM_CLI: ssm,

0 commit comments

Comments
 (0)