forked from aws/sagemaker-distribution
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Add sagemaker-code-editor package (aws#185)
Co-authored-by: Clayton Parnell <[email protected]>
- Loading branch information
1 parent
f3563d9
commit 56be466
Showing
13 changed files
with
130 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
__pycache__ | ||
.idea | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
conda-forge::sagemaker-code-editor[version='>=1.0.0'] | ||
conda-forge::amazon_sagemaker_sql_editor[version='>=0.1.0,<2'] | ||
conda-forge::amazon-sagemaker-sql-magic[version='>=0.1.0,<2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
conda-forge::sagemaker-code-editor[version='>=1.0.0'] | ||
conda-forge::amazon_sagemaker_sql_editor[version='>=0.1.0,<2'] | ||
conda-forge::amazon-sagemaker-sql-magic[version='>=0.1.0,<2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
template/v1/dirs/etc/code-editor/code_editor_machine_settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"python.terminal.activateEnvironment": false, | ||
"python.defaultInterpreterPath": "/opt/conda/bin/python" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
https://open-vsx.org/api/ms-toolsai/jupyter/2023.9.100/file/ms-toolsai.jupyter-2023.9.100.vsix | ||
https://open-vsx.org/api/ms-python/python/2023.20.0/file/ms-python.python-2023.20.0.vsix | ||
https://open-vsx.org/api/amazonwebservices/aws-toolkit-vscode/1.99.0/file/amazonwebservices.aws-toolkit-vscode-1.99.0.vsix |
11 changes: 11 additions & 0 deletions
11
template/v1/dirs/etc/supervisor/conf.d/supervisord-code-editor.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[include] | ||
files = supervisord-common.conf | ||
|
||
[program:codeeditorserver] | ||
directory=%(ENV_HOME)s | ||
command=start-code-editor | ||
autostart=true | ||
autorestart=true | ||
stdout_logfile=/dev/fd/1 ; Redirect web server logs to stdout | ||
stdout_logfile_maxbytes = 0 ; Fix: https://github.com/Supervisor/supervisor/issues/935 | ||
stderr_logfile_maxbytes = 0 ; Fix: https://github.com/Supervisor/supervisor/issues/935 |
18 changes: 18 additions & 0 deletions
18
template/v1/dirs/etc/supervisor/conf.d/supervisord-common.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
pidfile=/var/run/supervisord/supervisord.pid | ||
logfile=%(ENV_STUDIO_LOGGING_DIR)s/%(ENV_SAGEMAKER_APP_TYPE_LOWERCASE)s/supervisord/supervisord.log | ||
logfile_maxbytes=5MB | ||
logfile_backups=10 | ||
redirect_stderr=true | ||
|
||
[unix_http_server] | ||
file=/var/run/supervisord/supervisor.sock | ||
chmod=0700 | ||
|
||
[supervisorctl] | ||
serverurl=unix:///var/run/supervisord/supervisor.sock | ||
|
||
[rpcinterface:supervisor] | ||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface |
11 changes: 11 additions & 0 deletions
11
template/v1/dirs/etc/supervisor/conf.d/supervisord-jupyter-lab.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[include] | ||
files = supervisord-common.conf | ||
|
||
[program:jupyterlabserver] | ||
directory=%(ENV_HOME)s | ||
command=start-jupyter-server | ||
stopasgroup=true | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Generate and execute the shell code to modifies shell variables to include | ||
# micromamba commands (e.g. using `micromamba activate` to activate environments) | ||
eval "$(micromamba shell hook --shell=bash)" | ||
|
||
# Activate conda environment 'base', where supervisord is installed | ||
micromamba activate base | ||
|
||
# Set up SAGEMAKER_APP_TYPE_LOWERCASE based on SAGEMAKER_APP_TYPE | ||
export SAGEMAKER_APP_TYPE_LOWERCASE=$(echo $SAGEMAKER_APP_TYPE | tr '[:upper:]' '[:lower:]') | ||
|
||
mkdir -p $STUDIO_LOGGING_DIR/$SAGEMAKER_APP_TYPE_LOWERCASE/supervisord | ||
exec supervisord -c /etc/supervisor/conf.d/supervisord-code-editor.conf -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
eval "$(micromamba shell hook --shell=bash)" | ||
|
||
# Activate conda environment 'base', which is the default environment for sagemaker-distribution | ||
micromamba activate base | ||
|
||
# Start code-editor server | ||
if [ -n "$SAGEMAKER_APP_TYPE_LOWERCASE" ]; then | ||
# SAGEMAKER_APP_TYPE is set, indicating the server is running within a SageMaker | ||
# app. Configure the base url to be `/<app-type-in-lower-case>/default`. | ||
sagemaker-code-editor --host 0.0.0.0 --port 8888 \ | ||
--without-connection-token \ | ||
--base-path "/$SAGEMAKER_APP_TYPE_LOWERCASE/default" \ | ||
--server-data-dir /opt/amazon/sagemaker/sagemaker-code-editor-server-data \ | ||
--extensions-dir /opt/amazon/sagemaker/sagemaker-code-editor-server-data/extensions \ | ||
--user-data-dir /opt/amazon/sagemaker/sagemaker-code-editor-user-data | ||
else | ||
sagemaker-code-editor --host 0.0.0.0 --port 8888 \ | ||
--without-connection-token \ | ||
--server-data-dir /opt/amazon/sagemaker/sagemaker-code-editor-server-data \ | ||
--extension-dir /opt/amazon/sagemaker/sagemaker-code-editor-server-data/extensions \ | ||
--user-data-dir /opt/amazon/sagemaker/sagemaker-code-editor-user-data | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ARG COSMOS_IMAGE | ||
FROM $COSMOS_IMAGE | ||
|
||
ARG MAMBA_DOCKERFILE_ACTIVATE=1 | ||
|
||
CMD ["sagemaker-code-editor", "--version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters