Skip to content

Commit

Permalink
Improved remote logging for IDE lifecycle configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-khvostishkov committed May 12, 2024
1 parent 557ebad commit add4fe5
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions sagemaker_ssh_helper/sm-ssh-ide
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ if [[ "$1" == "configure" ]]; then
exit 0
fi

echo "sm-ssh-ide: Configuring services..."

OPTIONS=$2
mkdir -p /opt/sagemaker-ssh-helper/
echo "$OPTIONS" > /opt/sagemaker-ssh-helper/.sm-ssh-ide-options
Expand Down Expand Up @@ -75,7 +77,7 @@ EOF

touch /opt/sagemaker-ssh-helper/.ssh-ide-configured

echo "sm-ssh-ide: Configuration complete."
echo "sm-ssh-ide: Finished configuration. Done"

elif [[ "$1" == "get-user-profile-name" ]]; then
_assert_is_ssh_ide_inside_studio
Expand Down Expand Up @@ -156,6 +158,8 @@ elif [[ "$1" == "set-local-user-id" ]]; then
fi

elif [[ "$1" == "init-ssm" ]]; then
echo "sm-ssh-ide: Initializing SSM..."

LOCAL_USER_ID="$(cat ~/.sm-ssh-owner)"
echo "sm-ssh-ide: Will use local user ID: $LOCAL_USER_ID"

Expand Down Expand Up @@ -190,7 +194,11 @@ elif [[ "$1" == "init-ssm" ]]; then

sm-init-ssm

echo "sm-ssh-ide: SSM initialized. Done"

elif [[ "$1" == "start" ]]; then
echo "sm-ssh-ide: Starting services..."

OPTIONS=$(cat /opt/sagemaker-ssh-helper/.sm-ssh-ide-options || echo "")

if [[ -f /tmp/.ssh-ide-local-lock ]]; then
Expand Down Expand Up @@ -247,7 +255,7 @@ elif [[ "$1" == "start" ]]; then
echo "sm-ssh-ide: Skipping VNC and Jupyter start"
fi

echo "sm-ssh-ide: Started all services"
echo "sm-ssh-ide: Started all services. Done"

elif [[ "$1" == "ssm-agent" ]]; then

Expand Down Expand Up @@ -291,6 +299,8 @@ elif [[ "$1" == "env-diagnostics" ]]; then
find "$JUPYTER_PATH" -name 'kernel.json' -print0 | xargs -0 cat

elif [[ "$1" == "stop" ]]; then
echo "sm-ssh-ide: Stopping services..."

OPTIONS=$(cat /opt/sagemaker-ssh-helper/.sm-ssh-ide-options || echo "")

echo "sm-ssh-ide: Stopping SSM agent"
Expand Down Expand Up @@ -341,7 +351,7 @@ elif [[ "$1" == "stop" ]]; then
echo "sm-ssh-ide: Local lock is missing, was not not running on this instance?"
fi

echo "sm-ssh-ide: Stopped all services"
echo "sm-ssh-ide: Stopped all services. Done"

else

Expand Down

0 comments on commit add4fe5

Please sign in to comment.