Skip to content

Commit d41c303

Browse files
#51 - Support of new SageMaker Studio experience
1 parent 728d0fd commit d41c303

File tree

15 files changed

+64
-112
lines changed

15 files changed

+64
-112
lines changed

.idea/aws.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/deployment.xml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/sagemaker-ssh-helper.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,8 @@ If you're using lifecycle configuration script, just start another image termina
867867

868868
## <a name="web-vnc"></a>Web VNC
869869

870+
> **Note**: The Web VNC section is created for the earlier version of SSH Helper and was not tested with the recent features of SageMaker Studio released in late 2024 and in 2025.
871+
870872
At times, you cannot install all the software on your local machine, also because this is the software processes data, and you cannot copy massive amount of the data to your local machine.
871873

872874
You might have thought about [AWS Jupyter Proxy](https://github.com/aws/aws-jupyter-proxy), but some web apps like Dask may not fully work through the proxy, so VNC is the recommended alternative.

kernel-lc-config.sh renamed to jupyterlab-lc-config.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22

3-
# A lifecycle configuration script for SageMaker Studio kernel gateway.
3+
# A lifecycle configuration script for SageMaker Studio JupyterLab apps.
44
# See SageMaker_SSH_IDE.ipynb for manual configuration and for explanation of commands.
5-
# See https://docs.aws.amazon.com/sagemaker/latest/dg/studio-lcc.html .
5+
# See https://docs.aws.amazon.com/sagemaker/latest/dg/studio-lifecycle-configurations.html .
66

77
# Replace with your JetBrains License Server host name
88
# OR keep it as is and put the value into ~/.sm-jb-license-server inside SageMaker Studio to override
@@ -17,27 +17,30 @@ VNC_PASSWORD="123456"
1717
LOCAL_USER_ID="AIDACKCEVSQ6C2EXAMPLE:terry@SSO"
1818

1919
set -e
20+
set -o pipefail
2021

2122
# If not root, execute as root via sudo
2223
if [ "$EUID" -ne 0 ]; then
2324
SUDO="sudo"
2425
$SUDO true
25-
echo 'kernel-lc-config.sh: INFO - Executing as root via sudo'
26+
echo 'jupyterlab-lc-config.sh: INFO - Executing as root via sudo'
2627
exec $SUDO -E HOME=/root "$0" "$@"
2728
exit 0
2829
fi
2930

3031
PYTHON_BIN=$(which python3 || which python)
3132

3233
if [ -f /opt/sagemaker-ssh-helper/.ssh-ide-configured ]; then
33-
echo 'kernel-lc-config.sh: INFO - SageMaker SSH Helper is already installed, remove /opt/sagemaker-ssh-helper/.ssh-ide-configured to reinstall'
34+
echo 'jupyterlab-lc-config.sh: INFO - SageMaker SSH Helper is already installed, remove /opt/sagemaker-ssh-helper/.ssh-ide-configured to reinstall'
3435
else
3536
$PYTHON_BIN -m pip uninstall -y -q awscli
3637
$PYTHON_BIN -m pip install -q sagemaker-ssh-helper
3738

38-
# Uncomment two lines below to update SageMaker SSH Helper to the latest dev version from the main branch
39-
#git clone https://github.com/aws-samples/sagemaker-ssh-helper.git /tmp/sagemaker-ssh-helper/ || echo 'Already cloned'
40-
#cd /tmp/sagemaker-ssh-helper/ && git pull --no-rebase && git clean -f && $PYTHON_BIN -m pip install . && cd -
39+
# Uncomment lines below to update SageMaker SSH Helper to the latest dev version from the main branch
40+
# dir="$(pwd)"
41+
# git clone https://github.com/aws-samples/sagemaker-ssh-helper.git /tmp/sm-ssh-src/ || echo 'Already cloned'
42+
# cd /tmp/sm-ssh-src/ && git pull --no-rebase && git clean -f && $PYTHON_BIN -m pip install .
43+
# cd "$dir"
4144
fi
4245

4346
# We assume that the kernels are is installed into the sys prefix, e.g. with ipykernel install --sys-prefix command

run_tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
set -e
44
set -o pipefail
55

6-
echo "Keywords expression for pytest (PYTEST_KEYWORDS): -k '$PYTEST_KEYWORDS'"
7-
echo "Extra args for pytest (PYTEST_EXTRA_ARGS): $PYTEST_EXTRA_ARGS"
8-
cat /etc/hosts
6+
echo "Keywords expression for pytest (-k PYTEST_KEYWORDS): ['$PYTEST_KEYWORDS']"
7+
echo "Extra args for pytest (PYTEST_EXTRA_ARGS): [$PYTEST_EXTRA_ARGS]"
8+
echo "Comparing code base with GitHub repo..."
99
bash ./compare_release_src.sh
1010

1111
# Creating venv

sagemaker_ssh_helper/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0.dev0
1+
2.3.0.dev1

sagemaker_ssh_helper/interactive_sagemaker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def list_ide_apps(self) -> List[SageMakerStudioApp]:
160160
app_name = app_dict['AppName']
161161
app_type = app_dict['AppType']
162162

163-
if not 'SpaceName' in app_dict and not app_type in ['JupyterLab']:
163+
if 'SpaceName' not in app_dict and app_type not in ['JupyterLab']:
164164
logging.info("Studio Classic is not supported anymore: skipping app %s of type %s" % (app_name, app_type))
165165
pass
166166
else:

sagemaker_ssh_helper/log.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def get_transform_metadata_url(self, transform_job_name):
198198
f"/transform-jobs/{transform_job_name}"
199199

200200
def get_ide_cloudwatch_url(self, domain, user, app_name):
201-
app_type = 'JupyterServer' if app_name == 'default' else 'KernelGateway'
201+
app_type = 'JupyterLab' # TODO: Code Editor support?
202202
if user:
203203
return f"https://{self.aws_console.get_console_domain()}/" \
204204
f"cloudwatch/home?region={self.region_name}#" \
@@ -210,9 +210,8 @@ def get_ide_cloudwatch_url(self, domain, user, app_name):
210210
f"$3FlogStreamNameFilter$3D{app_type}$252F{app_name}"
211211

212212
def get_ide_metadata_url(self, domain, user):
213-
return f"https://{self.aws_console.get_console_domain()}/" \
214-
f"sagemaker/home?region={self.region_name}#" \
215-
f"/studio/{domain}/user/{user}"
213+
# TODO: URL for China region
214+
return f"https://studio-{domain}.studio.{self.region_name}.sagemaker.aws/jupyterlab/{user}"
216215

217216
def count_sns_notifications(self, topic_name: str, period: timedelta):
218217
cloudwatch_resource = boto3.resource('cloudwatch', region_name=self.region_name)

0 commit comments

Comments
 (0)