-
Notifications
You must be signed in to change notification settings - Fork 730
fix(smus): Add status validation for space operations #8160
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 |
|---|---|---|
|
|
@@ -133,6 +133,16 @@ export async function stopSpace( | |
| ctx: vscode.ExtensionContext, | ||
| sageMakerClient?: SagemakerClient | ||
| ) { | ||
| await tryRefreshNode(node) | ||
| if (node.getStatus() === 'Stopped' || node.getStatus() === 'Stopping') { | ||
| void vscode.window.showWarningMessage(`Space ${node.spaceApp.SpaceName} is already in Stopped/Stopping state.`) | ||
| return | ||
| } else if (node.getStatus() === 'Starting') { | ||
| void vscode.window.showWarningMessage( | ||
| `Space ${node.spaceApp.SpaceName} is in Starting state. Wait until it is Running to attempt stop again.` | ||
| ) | ||
| return | ||
| } | ||
| const spaceName = node.spaceApp.SpaceName! | ||
| const confirmed = await showConfirmationMessage({ | ||
| prompt: `You are about to stop this space. Any active resource will also be stopped. Are you sure you want to stop the space?`, | ||
|
|
@@ -179,7 +189,7 @@ export async function openRemoteConnect( | |
| void vscode.window.showErrorMessage(ConnectFromRemoteWorkspaceMessage) | ||
| return | ||
| } | ||
|
|
||
| await tryRefreshNode(node) | ||
|
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. Just to confirm, this would also change the text on the Space node to reflect state after the API call right?
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. Yes, the text (Stopped/Running) on the space would also be updated. |
||
| if (node.getStatus() === 'Stopped') { | ||
| // In case of SMUS, we pass in a SM Client and for SM AI, it creates a new SM Client. | ||
| const client = sageMakerClient ? sageMakerClient : new SagemakerClient(node.regionCode) | ||
|
|
||
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.
Thanks a lot for making the fix! Appreciate it!