Skip to content

Commit 94c1069

Browse files
committed
Add SMUS patches to Code Editor
**Description** Similar to how we apply smus patches in entrypoint-sagemaker-ui-jupyter-server, we should do the same for entrypoint-sagemaker-ui-code-editor. All these patches need to be applied. This will fix the issues in CE 1. EMR computes didn't return the right session table.
1 parent ed303e2 commit 94c1069

File tree

10 files changed

+94
-10
lines changed

10 files changed

+94
-10
lines changed

template/v2/dirs/etc/patches/apply_patches.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eux
44

55
# Check if parameter is provided
66
if [ $# -ne 1 ]; then
7-
echo "Usage: $0 [smus|studio-ai]"
7+
echo "Usage: $0 [smus|smus-code-editor]"
88
exit 1
99
fi
1010

@@ -14,11 +14,11 @@ case "$1" in
1414
bash "/etc/patches/smus-script/replace-job-with-schedule.sh"
1515
PATCH_DIR="/etc/patches/smus"
1616
;;
17-
"studio-ai")
18-
PATCH_DIR="/etc/patches/studio-ai"
17+
"smus-code-editor")
18+
PATCH_DIR="/etc/patches/smus-code-editor"
1919
;;
2020
*)
21-
echo "Error: Parameter must be either 'smus' or 'studio-ai'"
21+
echo "Error: Parameter must be either 'smus' or 'smus-code-editor'"
2222
exit 1
2323
;;
2424
esac
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- /opt/conda/lib/python3.11/site-packages/sparkmagic/livyclientlib/command.py
2+
+++ /opt/conda/lib/python3.11/site-packages/sparkmagic/livyclientlib/command.py
3+
@@ -54,6 +54,7 @@
4+
try:
5+
session.wait_for_idle()
6+
data = {"code": self.code}
7+
+ data["kind"] = session.kind
8+
response = session.http_client.post_statement(session.id, data)
9+
statement_id = response["id"]
10+
output = self._get_statement_output(session, statement_id)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--- /opt/conda/lib/python3.11/site-packages/sparkmagic/utils/utils.py
2+
+++ /opt/conda/lib/python3.11/site-packages/sparkmagic/utils/utils.py
3+
@@ -94,15 +94,7 @@
4+
5+
6+
def get_sessions_info_html(info_sessions, current_session_id):
7+
- html = (
8+
- """<table>
9+
-<tr><th>ID</th><th>YARN Application ID</th><th>Kind</th><th>State</th><th>Spark UI</th><th>Driver log</th><th>User</th><th>Current session?</th></tr>"""
10+
- + "".join(
11+
- [session.get_row_html(current_session_id) for session in info_sessions]
12+
- )
13+
- + "</table>"
14+
- )
15+
-
16+
+ html = ""
17+
return html
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- /opt/conda/lib/python3.11/site-packages/botocore/data/endpoints.json
2+
+++ /opt/conda/lib/python3.11/site-packages/botocore/data/endpoints.json
3+
@@ -5404,6 +5404,9 @@
4+
"ap-northeast-3" : {
5+
"hostname" : "datazone.ap-northeast-3.api.aws"
6+
},
7+
+ "ap-south-1" : {
8+
+ "hostname" : "datazone.ap-south-1.api.aws"
9+
+ },
10+
"ap-south-2" : {
11+
"hostname" : "datazone.ap-south-2.api.aws"
12+
},

template/v2/dirs/usr/local/bin/entrypoint-sagemaker-ui-code-editor

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ set -e
66
# micromamba commands (e.g. using `micromamba activate` to activate environments)
77
eval "$(micromamba shell hook --shell=bash)"
88

9+
# apply patches for SMUS
10+
/etc/patches/apply_patches.sh smus-code-editor && sudo rm -rf /etc/patches
11+
912
# Activate conda environment 'base', where supervisord is installed
1013
micromamba activate base
1114

1215
export SAGEMAKER_APP_TYPE_LOWERCASE=$(echo $SAGEMAKER_APP_TYPE | tr '[:upper:]' '[:lower:]')
1316
export SERVICE_NAME='SageMakerUnifiedStudio'
1417

1518
mkdir -p $STUDIO_LOGGING_DIR/$SAGEMAKER_APP_TYPE_LOWERCASE/supervisord
16-
exec supervisord -c /etc/supervisor/conf.d/supervisord-sagemaker-ui-code-editor.conf -n
19+
exec supervisord -c /etc/supervisor/conf.d/supervisord-sagemaker-ui-code-editor.conf -n

template/v3/dirs/etc/patches/apply_patches.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eux
44

55
# Check if parameter is provided
66
if [ $# -ne 1 ]; then
7-
echo "Usage: $0 [smus|studio-ai]"
7+
echo "Usage: $0 [smus|smus-code-editor]"
88
exit 1
99
fi
1010

@@ -14,11 +14,11 @@ case "$1" in
1414
bash "/etc/patches/smus-script/replace-job-with-schedule.sh"
1515
PATCH_DIR="/etc/patches/smus"
1616
;;
17-
"studio-ai")
18-
PATCH_DIR="/etc/patches/studio-ai"
17+
"smus-code-editor")
18+
PATCH_DIR="/etc/patches/smus-code-editor"
1919
;;
2020
*)
21-
echo "Error: Parameter must be either 'smus' or 'studio-ai'"
21+
echo "Error: Parameter must be either 'smus' or 'smus-code-editor'"
2222
exit 1
2323
;;
2424
esac
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- /opt/conda/lib/python3.11/site-packages/sparkmagic/livyclientlib/command.py
2+
+++ /opt/conda/lib/python3.11/site-packages/sparkmagic/livyclientlib/command.py
3+
@@ -54,6 +54,7 @@
4+
try:
5+
session.wait_for_idle()
6+
data = {"code": self.code}
7+
+ data["kind"] = session.kind
8+
response = session.http_client.post_statement(session.id, data)
9+
statement_id = response["id"]
10+
output = self._get_statement_output(session, statement_id)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--- /opt/conda/lib/python3.11/site-packages/sparkmagic/utils/utils.py
2+
+++ /opt/conda/lib/python3.11/site-packages/sparkmagic/utils/utils.py
3+
@@ -94,15 +94,7 @@
4+
5+
6+
def get_sessions_info_html(info_sessions, current_session_id):
7+
- html = (
8+
- """<table>
9+
-<tr><th>ID</th><th>YARN Application ID</th><th>Kind</th><th>State</th><th>Spark UI</th><th>Driver log</th><th>User</th><th>Current session?</th></tr>"""
10+
- + "".join(
11+
- [session.get_row_html(current_session_id) for session in info_sessions]
12+
- )
13+
- + "</table>"
14+
- )
15+
-
16+
+ html = ""
17+
return html
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- /opt/conda/lib/python3.11/site-packages/botocore/data/endpoints.json
2+
+++ /opt/conda/lib/python3.11/site-packages/botocore/data/endpoints.json
3+
@@ -5404,6 +5404,9 @@
4+
"ap-northeast-3" : {
5+
"hostname" : "datazone.ap-northeast-3.api.aws"
6+
},
7+
+ "ap-south-1" : {
8+
+ "hostname" : "datazone.ap-south-1.api.aws"
9+
+ },
10+
"ap-south-2" : {
11+
"hostname" : "datazone.ap-south-2.api.aws"
12+
},

template/v3/dirs/usr/local/bin/entrypoint-sagemaker-ui-code-editor

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ set -e
66
# micromamba commands (e.g. using `micromamba activate` to activate environments)
77
eval "$(micromamba shell hook --shell=bash)"
88

9+
# apply patches for SMUS
10+
/etc/patches/apply_patches.sh smus-code-editor && sudo rm -rf /etc/patches
11+
912
# Activate conda environment 'base', where supervisord is installed
1013
micromamba activate base
1114

1215
export SAGEMAKER_APP_TYPE_LOWERCASE=$(echo $SAGEMAKER_APP_TYPE | tr '[:upper:]' '[:lower:]')
1316
export SERVICE_NAME='SageMakerUnifiedStudio'
1417

1518
mkdir -p $STUDIO_LOGGING_DIR/$SAGEMAKER_APP_TYPE_LOWERCASE/supervisord
16-
exec supervisord -c /etc/supervisor/conf.d/supervisord-sagemaker-ui-code-editor.conf -n
19+
exec supervisord -c /etc/supervisor/conf.d/supervisord-sagemaker-ui-code-editor.conf -n

0 commit comments

Comments
 (0)