occlum/demos/python/python_glibc/python3.10-multiprocessing/run_python3.10_on_occlum.sh
2023-06-22 15:20:29 +08:00

29 lines
875 B
Bash
Executable File

#!/bin/bash
set -e
BLUE='\033[1;34m'
NC='\033[0m'
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
python_dir="$script_dir/occlum_instance/image/opt/python-occlum"
rm -rf occlum_instance && occlum new occlum_instance
cd occlum_instance && rm -rf image
copy_bom -f ../python3.10.yaml --root image --include-dir /opt/occlum/etc/template
if [ ! -d $python_dir ];then
echo "Error: cannot stat '$python_dir' directory"
exit 1
fi
new_json="$(jq '.resource_limits.user_space_size = "1000MB" |
.resource_limits.kernel_space_heap_size = "300MB" |
.env.default += ["PYTHONHOME=/opt/python-occlum", "PATH=/bin"]' Occlum.json)" && \
echo "${new_json}" > Occlum.json
occlum build
# Run the python demo
echo -e "${BLUE}occlum run /bin/python3.10 multiprocessing_demo.py${NC}"
occlum run /bin/python3.10 multiprocessing_demo.py