11#! /bin/bash
22set -e
33
4- EFS_MOUNT_POINT =" /opt/amazon/sagemaker"
5- EBS_MOUNT_POINT =" /home/sagemaker-user"
4+ CONTAINER_SAGEMAKER_METADATA_PATH =" /opt/amazon/sagemaker"
5+ EBS_MOUNT_PATH =" /home/sagemaker-user"
66
7- persistent_settings_folder =" ${EBS_MOUNT_POINT } /sagemaker-code-editor-server-data"
8- default_settings_folder =" ${EFS_MOUNT_POINT } /sagemaker-code-editor-server-data"
7+ persistent_ebs_server_data_folder =" ${EBS_MOUNT_PATH } /sagemaker-code-editor-server-data"
8+ container_server_data_folder =" ${CONTAINER_SAGEMAKER_METADATA_PATH } /sagemaker-ui -code-editor-server-data"
99
1010override_machine_settings () {
1111 # create a new settings file with preset defaults or merge the defaults into the existing settings file
1212 local settings_relative_path=" data/Machine"
1313 local settings_file_path_suffix=" ${settings_relative_path} /settings.json"
14- local persistent_machine_settings_file=" ${persistent_settings_folder } /${settings_file_path_suffix} "
15- local default_machine_settings_file=" ${default_settings_folder } /${settings_file_path_suffix} "
14+ local persistent_machine_settings_file=" ${persistent_ebs_server_data_folder } /${settings_file_path_suffix} "
15+ local default_machine_settings_file=" ${container_server_data_folder } /${settings_file_path_suffix} "
1616
1717 if [ ! -f " $persistent_machine_settings_file " ]; then
1818 # copy settings file to EBS if it doesn't exist in EBS
19- mkdir -p " ${persistent_settings_folder } /${settings_relative_path} "
19+ mkdir -p " ${persistent_ebs_server_data_folder } /${settings_relative_path} "
2020 cp " $default_machine_settings_file " " $persistent_machine_settings_file "
2121 echo " Created persistent settings file with default settings at $persistent_machine_settings_file "
2222 else
@@ -29,19 +29,19 @@ override_machine_settings() {
2929copy_user_settings () {
3030 local settings_relative_path=" data/User"
3131 local settings_file_path_suffix=" ${settings_relative_path} /settings.json"
32- local persistent_user_settings_file=" ${persistent_settings_folder } /${settings_file_path_suffix} "
33- local default_user_settings_file=" ${default_settings_folder } /${settings_file_path_suffix} "
32+ local persistent_user_settings_file=" ${persistent_ebs_server_data_folder } /${settings_file_path_suffix} "
33+ local default_user_settings_file=" ${container_server_data_folder } /${settings_file_path_suffix} "
3434 if [ ! -f " $persistent_user_settings_file " ]; then
3535 # copy user settings file to EBS if it doesn't exist in EBS
36- mkdir -p " ${persistent_settings_folder } /${settings_relative_path} "
36+ mkdir -p " ${persistent_ebs_server_data_folder } /${settings_relative_path} "
3737 cp " $default_user_settings_file " " $persistent_user_settings_file "
3838 echo " Created persistent settings file with default settings at $persistent_user_settings_file "
3939 fi
4040}
4141
4242install_prepackaged_extensions () {
43- local prepackaged_extensions_dir=" ${default_settings_folder } /extensions"
44- local persistent_extensions_dir=" ${persistent_settings_folder } /extensions"
43+ local prepackaged_extensions_dir=" ${container_server_data_folder } /extensions"
44+ local persistent_extensions_dir=" ${persistent_ebs_server_data_folder } /extensions"
4545
4646 # if extensions directory doesn't exist then this is the first time opening the app
4747 if [ ! -d " ${persistent_extensions_dir} " ]; then
@@ -95,8 +95,8 @@ if [ -n "$SAGEMAKER_APP_TYPE_LOWERCASE" ]; then
9595 sagemaker-code-editor --host 0.0.0.0 --port 8888 \
9696 --without-connection-token \
9797 --base-path " /$SAGEMAKER_APP_TYPE_LOWERCASE /default" \
98- --server-data-dir $persistent_settings_folder \
99- --extensions-dir ${persistent_settings_folder } /extensions \
98+ --server-data-dir $persistent_ebs_server_data_folder \
99+ --extensions-dir ${persistent_ebs_server_data_folder } /extensions \
100100 --user-data-dir /opt/amazon/sagemaker/sagemaker-code-editor-user-data
101101else
102102 sagemaker-code-editor --host 0.0.0.0 --port 8888 \
0 commit comments