You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-66Lines changed: 14 additions & 66 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,28 @@
1
-
# Sagemaker-Studio-Autoshutdown-Extension
1
+
# SageMaker-Studio-Autoshutdown-Extension
2
2
3
3
This Jupyter extension automatically shuts down KernelGateway Apps, Kernels and Image Terminals in SageMaker Studio when they are idle for a stipulated period of time. You will be able to configure an idle time limit of your preference.
4
4
5
-
> The JupyterLab version (UI version) of this extension will be deprecated by Sep 30, 2022. Please update your Studio domains to use the recommended Server-Side Extension to automatically shutting down idle Studio apps.
6
-
7
-
Image below showcases SageMaker Studio architecture. It is critical to understand how pricing works and which components will incur cost. Instance that hosts JupyterServer app and System Terminals is free. Customers will only pay for instances with at least one KernelGateway App that is "In Service" state.
5
+
Image below showcases the SageMaker Studio architecture. It is critical to understand how pricing works and which components will incur cost. Instance that hosts JupyterServer app and System Terminals is free. Customers will only pay for instances with at least one KernelGateway App that is "In Service" state. See [Dive deep into Amazon SageMaker Studio Notebooks architecture](https://aws.amazon.com/blogs/machine-learning/dive-deep-into-amazon-sagemaker-studio-notebook-architecture/) to learn more about Studio architecture.
8
6
9
7
<imgsrc="Studio_arch.jpg">
10
8
11
9
## Requirements
12
10
13
-
* Please ensure your JupyterLab version is >= v1.2.18 ( and < 2.0 for the UI extension). You can check the version by opening a terminal window in SageMaker Studio (File > New -> Terminal) and running the following command: `jupyter lab --version`
11
+
* Please ensure your JupyterLab version is >= v1.2.18. You can check the version by opening a terminal window in SageMaker Studio (File > New -> Terminal) and running the following command: `jupyter lab --version`
14
12
15
13
## Installation Instructions
16
14
17
-
There are **two options** for installing the Studio Autoshutdown Extension.
This option comes with a server-side extension only. Installation does not require Internet connection as all the dependencies are stored in the install tarball and can be done via VPCOnly mode.
15
+
You can either install the extension manually, or automate the install through SageMaker Studio Lifecycle Configurations. Installation does not require Internet connection as all the dependencies are stored in the install tarball and can be done via Studio VPCOnly mode.
21
16
22
-
### Option 1.1: Install using Lifecycle configurations
17
+
### Option #1 - Install using Lifecycle configurations (Recommended)
23
18
24
19
You can create and attach a Lifecycle configuration script to the default JupyterServer app for your users. The LCC script is available [here](https://github.com/aws-samples/sagemaker-studio-lifecycle-config-examples/tree/main/scripts/install-autoshutdown-server-extension). For instructions to create and attach LCCs, and setting defaults, see [Use Lifecycle Configurations with Amazon SageMaker Studio](https://docs.aws.amazon.com/sagemaker/latest/dg/studio-lcc.html). For detailed setup instructions, see [Customize Amazon SageMaker Studio using Lifecycle Configurations](https://aws.amazon.com/blogs/machine-learning/customize-amazon-sagemaker-studio-using-lifecycle-configurations/). Once the LCC is set as a default at the domain level, all users inherit the extension by default.
25
20
26
-
If you have existing user profiles in your domain, they will have to restart their "default" JupyterServer app to inherit the LCC configuration.
21
+
> :warning:
22
+
>- If you are switching Studio to JupyterLab3, and you have previously installed the plugin through LCC, you need to update the LCC to work with JupyterLab3. Pull the script from Github [here](https://github.com/aws-samples/sagemaker-studio-lifecycle-config-examples/tree/main/scripts/install-autoshutdown-server-extension) and recreate the LCC.
23
+
>- If you have existing user profiles in your domain, they will have to restart their "default" JupyterServer app to inherit the LCC configuration.
27
24
28
-
### Option 1.2: Install the extension manually
25
+
### Option #2 - Install the extension manually
29
26
30
27
You can also install the extension from the JupyterServer terminal if you are administering the extension manually or would like to test. Here are the steps:
31
28
@@ -43,34 +40,7 @@ You can also install the extension from the JupyterServer terminal if you are ad
43
40
44
41
Kernel sessions update idle state to JupyterServer and will be deleted after the user set idle time limit is reached. Image Terminals do not report the idle state to JupyterServer. As such, we delete Image Terminals when there are no kernel sessions (open notebooks) on the instance and the idle timeout has elapsed. If you wish to keep the image terminals, you can set `keep_terminals` to True in the LCC script [here](https://github.com/aws-samples/sagemaker-studio-lifecycle-config-examples/blob/main/scripts/install-autoshutdown-server-extension/on-jupyter-server-start.sh#L33). Note that you will be charged for the KernelGateway app unless you manually shut down the image terminal and the corresponding KernelGateway app.
45
42
46
-
## Option 2: JupyterLab UI and Server-Side Extension
47
-
48
-
> ⚠️ **The UI extension only works with JupyterLab 1.0. See [JupyterLab versioning](https://docs.aws.amazon.com/sagemaker/latest/dg/studio-jl.html) for JupyterLab versions in Studio.**
49
-
50
-
This option provides UI in JupyterLab for users to set up an idle time limit. Use this option if you have fewer users and can administer manually. This option requires Internet access as the dependencies have to be pulled down. You can automate the installation by including the following script in JupyterServer LCC - [Link](https://github.com/aws-samples/sagemaker-studio-lifecycle-config-examples/blob/main/scripts/install-autoshutdown-extension/on-jupyter-server-start.sh). If you would like to install manually, follow instructions below:
51
-
52
-
1. Open a System Terminal session in your Sagemaker Studio's Jupyter Server. (You can do this by clicking File -> New -> Terminal)
53
-
54
-
2. Download/Clone the current repository by running:
3. Change directory to sagemaker-studio-auto-shutdown-extension:
59
-
```bash
60
-
cd sagemaker-studio-auto-shutdown-extension
61
-
```
62
-
4. Run the following script. This step will take about 3 minutes.
63
-
64
-
```bash
65
-
./install_tarball.sh
66
-
```
67
-
5. Refresh your IDE to see the extension on the sidebar as shown in the screen shot below:
68
-
69
-
<imgsrc="studio.png">
70
-
71
-
72
-
73
-
### Monitoring the installation across all users
43
+
## Monitoring the installation across all users
74
44
75
45
*If you have used Lifecycle configurations to set the extension as a default at the domain level, you do not need to monitor the installation across users.*
76
46
@@ -85,42 +55,20 @@ Note: 120 minutes is the recommended idle time. If the idle time is set to a low
85
55
86
56
## Limitations
87
57
88
-
1. If you are not using a default LCC script as recommended, you will need to reinstall this extension and configure the idle time limit, each time you delete your user's JupyterServer app and recreate it.
58
+
1. If you are not using a **default** LCC script as recommended, you will need to reinstall this extension and configure the idle time limit, each time you delete your user's JupyterServer app and recreate it.
89
59
90
60
## Troubleshooting
91
61
92
-
#1 Ensure you're using the latest version of the extension (`sagemaker_studio_autoshutdown-0.1.5.tar.gz`). If you are on one of the older versions, update your LCC script and restart JupyterServer app.
93
-
94
-
#2 Delete JupyterServer and recreate it. You can do this by selecting the User and going into User Details screen in SageMaker Studio console. It is a two step process: 1/ delete JupyterServer app. 2/ Click on "Open Studio", which will recreate JupterServer with the latest version.
95
-
96
-
#3 If you are seeing the frontend extension but it is not working, check
97
-
that the server extension is enabled:
98
-
99
-
```bash
100
-
jupyter serverextension list
101
-
```
102
-
103
-
#4 If the server extension is installed and enabled but you are not seeing
104
-
the frontend, check the frontend is installed:
105
-
106
-
```bash
107
-
jupyter labextension list
108
-
```
62
+
1. Ensure you're using the latest version of the extension (`sagemaker_studio_autoshutdown-0.1.5.tar.gz`). If you are on one of the older versions, update your LCC script and restart JupyterServer app.
109
63
110
-
If it is not installed, try:
64
+
2. Delete JupyterServer and recreate it. You can do this by selecting the User and going into User Details screen in SageMaker Studio console. It is a two step process: 1/ delete JupyterServer app. 2/ Click on "Open Studio", which will recreate JupterServer with the latest version.
111
65
112
-
```bash
113
-
bash install_server_extension.sh
114
-
bash install_frontend_extension.sh
115
-
116
-
```
117
-
#5 Ensure you are testing for shutting down KernelGateway Apps, Kernels and Image Terminals. System Terminal will not be shutdown as it does not incur cost.
66
+
3. Ensure you are testing for shutting down KernelGateway Apps, Kernels and Image Terminals. System Terminal will not be shutdown as it does not incur cost.
0 commit comments