-
Notifications
You must be signed in to change notification settings - Fork 739
fix(smus): unble to refresh status on newly created App bug #8258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,11 @@ import { getIcon, IconPath } from '../../shared/icons' | |
| import { generateSpaceStatus, updateIdleFile, startMonitoringTerminalActivity, ActivityCheckInterval } from './utils' | ||
| import { UserActivity } from '../../shared/extensionUtilities' | ||
| import { getLogger } from '../../shared/logger/logger' | ||
| import { ToolkitError } from '../../shared/errors' | ||
| import { SpaceStatus, RemoteAccess } from './constants' | ||
|
|
||
| const logger = getLogger('sagemaker') | ||
|
|
||
| export class SagemakerSpace { | ||
| public label: string = '' | ||
| public contextValue: string = '' | ||
|
|
@@ -34,6 +37,10 @@ export class SagemakerSpace { | |
| } | ||
|
|
||
| public updateSpace(spaceApp: SagemakerSpaceApp) { | ||
| // Edge case when this.spaceApp.App is null, returned by ListApp API for a Space that is not connected to for over 24 hours | ||
| if (!this.spaceApp.App) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a comment to clarify when this will happen, finding it hard to understand. I know not from this change but spaceApp.App just feels very confusing, if there is scope to rename to better variables, we should.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, do you have any suggestions to replace "spaceApp", basically spaceApp is a space that have a App as one of the variables attached to it. we would also need to change the name for the SagemakerSpaceApp type:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about type: "SagemakerSpaceDetails", variable just: "space" or "spaceDetails"?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noticed that SagemakerSpace is the class name, so the current naming can be more confusing, like:
a lot of spaces and apps what about: |
||
| this.spaceApp.App = spaceApp.App | ||
| } | ||
|
Comment on lines
+41
to
+43
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Under what circumstances will this apply, and what problem is this addressing?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this resolve the edge case when this.spaceApp.App is |
||
| this.setSpaceStatus(spaceApp.Status ?? '', spaceApp.App?.Status ?? '') | ||
| // Only update RemoteAccess property to minimize impact due to minor structural differences between variables | ||
| if (this.spaceApp.SpaceSettingsSummary && spaceApp.SpaceSettingsSummary?.RemoteAccess) { | ||
|
|
@@ -107,13 +114,19 @@ export class SagemakerSpace { | |
| DomainId: this.spaceApp.DomainId, | ||
| SpaceName: this.spaceApp.SpaceName, | ||
| }) | ||
|
|
||
| const app = await this.client.describeApp({ | ||
| DomainId: this.spaceApp.DomainId, | ||
| AppName: this.spaceApp.App?.AppName, | ||
| AppType: this.spaceApp?.SpaceSettingsSummary?.AppType, | ||
| SpaceName: this.spaceApp.SpaceName, | ||
| }) | ||
| // get app using ListApps API, with given DomainId and SpaceName | ||
| const app = | ||
| this.spaceApp.DomainId && this.spaceApp.SpaceName | ||
| ? await this.client.listAppForSpace(this.spaceApp.DomainId, this.spaceApp.SpaceName) | ||
| : undefined | ||
| if (!app) { | ||
| logger.error( | ||
| `updateSpaceAppStatus: unable to get app, [DomainId: ${this.spaceApp.DomainId}], [SpaceName: ${this.spaceApp.SpaceName}]` | ||
| ) | ||
| throw new ToolkitError( | ||
| `Cannot update app status without [DomainId: ${this.spaceApp.DomainId} and SpaceName: ${this.spaceApp.SpaceName}]` | ||
| ) | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. else? Are there other possible cases?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are no other cases, gonna add error handling for |
||
|
|
||
| // AWS DescribeSpace API returns full details with property names like 'SpaceSettings' | ||
| // but our internal SagemakerSpaceApp type expects 'SpaceSettingsSummary' (from ListSpaces API) | ||
|
|
@@ -195,7 +208,6 @@ export class SagemakerSpace { | |
| * Sets up user activity monitoring for SageMaker spaces | ||
| */ | ||
| export async function setupUserActivityMonitoring(extensionContext: vscode.ExtensionContext): Promise<void> { | ||
| const logger = getLogger() | ||
| logger.info('setupUserActivityMonitoring: Starting user activity monitoring setup') | ||
|
|
||
| const tmpDirectory = '/tmp/' | ||
|
|
||
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.
When all is this invoked and why does it help in this case?