Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
fix: Sagemaker compatability fix with AL2 (#1079)
Browse files Browse the repository at this point in the history

Co-authored-by: Marianna Ghirardelli <ghirard@amazon.com>
Co-authored-by: Tim Nguyen <thingut@amazon.com>
  • Loading branch information
3 people authored Dec 8, 2022
1 parent 80a1999 commit dea1c89
Show file tree
Hide file tree
Showing 25 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ Resources:
- Enabled
LifecycleConfigName: !GetAtt BasicNotebookInstanceLifecycleConfig.NotebookInstanceLifecycleConfigName
KmsKeyId: !Ref EncryptionKeyArn
PlatformIdentifier: 'notebook-al2-v1'

BasicNotebookInstanceLifecycleConfig:
Type: 'AWS::SageMaker::NotebookInstanceLifecycleConfig'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ append_role_to_credentials() {

# Use STS regional endpoint instead of global one. This allows external studies to connect with local interface endpoint
# if it exists. Refer https://docs.aws.amazon.com/sdkref/latest/guide/setting-global-sts_regional_endpoints.html
region=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone/ | sed 's/.$//'`
token=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
region=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone/ -H "X-aws-ec2-metadata-token: $token" | sed 's/.$//'`
export AWS_STS_REGIONAL_ENDPOINTS=regional
export AWS_DEFAULT_REGION=$region
export AWS_SDK_LOAD_CONFIG=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ ln -s "${FILES_DIR}/bin/mount_s3.sh" "/usr/local/bin/mount_s3.sh"
printf "%s" "$S3_MOUNTS" > "/usr/local/etc/s3-mounts.json"
echo "Finish mounting S3"

OS_VERSION=`cat /etc/os-release | grep VERSION= | sed 's/VERSION="//' | sed 's/"//'`

# Apply updates to environments based on environment type
case "$(env_type)" in
"emr") # Update config and restart Jupyter
Expand All @@ -154,12 +156,29 @@ case "$(env_type)" in
sudo -u hadoop PATH=$PATH:/usr/local/bin /opt/hail-on-AWS-spot-instances/src/jupyter_run.sh
;;
"sagemaker") # Update config and restart Jupyter
echo "Installing fuse"
cd "${FILES_DIR}/offline-packages/sagemaker/fuse-2.9.4"
sudo yum --disablerepo=* localinstall -y *.rpm
echo "Finish installing fuse"
if [ $OS_VERSION = '2' ]
then
echo "Installing fuse for AL2"
cd "${FILES_DIR}/offline-packages/sagemaker/fuse-2.9.4_AL2"
sudo yum --disablerepo=* localinstall -y *.rpm
echo "Finish installing fuse"
echo "Installing boto3 for AL2"
cd "${FILES_DIR}/offline-packages/sagemaker/boto3"
sudo yum --disablerepo=* localinstall -y python2-boto3-1.4.4-1.amzn2.noarch.rpm
echo "Finish installing boto3"
else
echo "Installing fuse for AL1"
cd "${FILES_DIR}/offline-packages/sagemaker/fuse-2.9.4"
sudo yum --disablerepo=* localinstall -y *.rpm
echo "Finish installing fuse"
fi
update_jupyter_config "/home/ec2-user/.jupyter/jupyter_notebook_config.py"
initctl restart jupyter-server --no-wait
if [ $OS_VERSION = '2' ]
then
systemctl restart jupyter-server
else
initctl restart jupyter-server --no-wait
fi
;;
"ec2-linux") # Add mount script to bash profile
echo "Installing fuse"
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit dea1c89

Please sign in to comment.