Modify python-glibc demo with copy_bom
This commit is contained in:
parent
3b5a1a3fc4
commit
d3b4b10d4a
@ -8,5 +8,5 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
# 2. Install python and dependencies to specified position
|
||||
[ -d Miniconda3-latest-Linux-x86_64.sh ] || wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
|
||||
[ -d miniconda ] || bash ./Miniconda3-latest-Linux-x86_64.sh -b -p $script_dir/miniconda
|
||||
$script_dir/miniconda/bin/conda create --prefix $script_dir/occlum_instance/image/opt/python-occlum -y python=3.7 numpy=1.18.1 pandas=0.24.2 scipy=1.3.1 Cython scikit-learn=0.21.1
|
||||
$script_dir/miniconda/bin/conda create --prefix $script_dir/python-occlum -y python=3.7 numpy=1.18.1 pandas=0.24.2 scipy=1.3.1 Cython scikit-learn=0.21.1
|
||||
|
||||
|
25
demos/python/python_glibc/python-glibc.yaml
Normal file
25
demos/python/python_glibc/python-glibc.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
includes:
|
||||
- base.yaml
|
||||
targets:
|
||||
- target: /bin
|
||||
createlinks:
|
||||
- src: /opt/python-occlum/bin/python3
|
||||
linkname: python3
|
||||
# python packages
|
||||
- target: /opt
|
||||
copy:
|
||||
- dirs:
|
||||
- ../python-occlum
|
||||
# explicit copy python3 to enable autodep for python3
|
||||
- target: /opt/python-occlum/bin
|
||||
copy:
|
||||
- files:
|
||||
- ../python-occlum/bin/python3
|
||||
# below are python code and data
|
||||
- target: /
|
||||
copy:
|
||||
- from: ..
|
||||
dirs:
|
||||
- dataset
|
||||
files:
|
||||
- demo.py
|
@ -7,27 +7,20 @@ 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"
|
||||
|
||||
cd occlum_instance && rm -rf image
|
||||
copy_bom -f ../python-glibc.yaml --root image --include-dir /opt/occlum/etc/template
|
||||
|
||||
if [ ! -d $python_dir ];then
|
||||
echo "Error: cannot stat '$python_dir' directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd occlum_instance
|
||||
# Copy files into Occlum Workspace and build
|
||||
if [ ! -L "image/bin/python3" ];then
|
||||
ln -s /opt/python-occlum/bin/python3 image/bin/python3
|
||||
cp -f /opt/occlum/glibc/lib/libdl.so.2 image/opt/occlum/glibc/lib/
|
||||
cp -f /opt/occlum/glibc/lib/libutil.so.1 image/opt/occlum/glibc/lib/
|
||||
cp -f /opt/occlum/glibc/lib/librt.so.1 image/opt/occlum/glibc/lib/
|
||||
cp -rf ../dataset image
|
||||
cp -f ../demo.py image
|
||||
new_json="$(jq '.resource_limits.user_space_size = "640MB" |
|
||||
new_json="$(jq '.resource_limits.user_space_size = "640MB" |
|
||||
.resource_limits.kernel_space_heap_size = "256MB" |
|
||||
.process.default_mmap_size = "512MB" |
|
||||
.env.default += ["PYTHONHOME=/opt/python-occlum"]' Occlum.json)" && \
|
||||
echo "${new_json}" > Occlum.json
|
||||
occlum build
|
||||
fi
|
||||
echo "${new_json}" > Occlum.json
|
||||
occlum build
|
||||
|
||||
# Run the python demo
|
||||
echo -e "${BLUE}occlum run /bin/python3 demo.py${NC}"
|
||||
|
Loading…
Reference in New Issue
Block a user