Skip to content

Commit dc5ea9f

Browse files
authored
Fix issue of SparkMagic config file not accessible in workflow (#608)
1 parent 00edeb1 commit dc5ea9f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

template/v2/dirs/etc/sagemaker-ui/kernels/kernel_launchers/python3_kernel_launcher.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@
33
kernel_type=$2
44
connection_file=$4
55

6-
sparkmagicHomeDir=/home/sagemaker-user/.sparkmagic
7-
mkdir -p $sparkmagicHomeDir
8-
config_file_path=${sparkmagicHomeDir}/config.json
6+
if [ ! -e "/opt/ml/metadata/resource-metadata.json" ] && [ -z "$SPARKMAGIC_CONF_DIR" ]; then
7+
export SPARKMAGIC_CONF_DIR="$SM_EXECUTION_INPUT_PATH"
8+
fi
9+
10+
if [ -n "$SPARKMAGIC_CONF_DIR" ]; then
11+
mkdir -p $SPARKMAGIC_CONF_DIR
12+
config_file_path=${SPARKMAGIC_CONF_DIR}/config.json
13+
else
14+
sparkmagicHomeDir=${HOME}/.sparkmagic
15+
mkdir -p $sparkmagicHomeDir
16+
config_file_path=${sparkmagicHomeDir}/config.json
17+
fi
18+
919
if [ ! -f "$config_file_path" ]; then
1020
cat << EOT > "$config_file_path"
1121
{

0 commit comments

Comments
 (0)