TinyIPA: Precompile python code for faster load
This patch adds code into the tinyipa build process and IPA itself to allow the required python code to be PYTHONOPTIMIZE precompiled into pyo files, this speeds up IPA startup time in a nested virt by 50%. Change-Id: Ib60c420719ea52a602c1752b572d3b217c2cefc7
This commit is contained in:
parent
7274e2ee81
commit
f58f7b9a07
@ -17,5 +17,9 @@ if ! type "ironic-python-agent" > /dev/null ; then
|
|||||||
python /tmp/get-pip.py --no-wheel --no-index --find-links=file:///tmp/wheelhouse ironic_python_agent
|
python /tmp/get-pip.py --no-wheel --no-index --find-links=file:///tmp/wheelhouse ironic_python_agent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export PYTHONOPTIMIZE=1
|
||||||
|
|
||||||
# Run IPA
|
# Run IPA
|
||||||
|
echo "Starting Ironic Python Agent:"
|
||||||
|
date
|
||||||
ironic-python-agent
|
ironic-python-agent
|
||||||
|
@ -87,6 +87,14 @@ sudo cp "$WORKDIR/build_files/bootlocal.sh" "$FINALDIR/opt/."
|
|||||||
|
|
||||||
# Disable ZSwap
|
# Disable ZSwap
|
||||||
sudo sed -i '/# Main/a NOZSWAP=1' "$FINALDIR/etc/init.d/tc-config"
|
sudo sed -i '/# Main/a NOZSWAP=1' "$FINALDIR/etc/init.d/tc-config"
|
||||||
|
# sudo cp $WORKDIR/build_files/tc-config $FINALDIR/etc/init.d/tc-config
|
||||||
|
|
||||||
|
# Precompile all python
|
||||||
|
set +e
|
||||||
|
$CHROOT_CMD /bin/bash -c "python -OO -m compileall /usr/local/lib/python2.7"
|
||||||
|
set -e
|
||||||
|
find $FINALDIR/usr/local/lib/python2.7 -name "*.py" -not -path "*ironic_python_agent/api/config.py" | sudo xargs rm
|
||||||
|
find $FINALDIR/usr/local/lib/python2.7 -name "*.pyc" | sudo xargs rm
|
||||||
|
|
||||||
# Allow an extension to be added to the generated files by specifying
|
# Allow an extension to be added to the generated files by specifying
|
||||||
# $BRANCH_PATH e.g. export BRANCH_PATH=master results in tinyipa-master.gz etc
|
# $BRANCH_PATH e.g. export BRANCH_PATH=master results in tinyipa-master.gz etc
|
||||||
|
@ -34,6 +34,7 @@ def get_pecan_config():
|
|||||||
:returns: pecan configuration object.
|
:returns: pecan configuration object.
|
||||||
"""
|
"""
|
||||||
filename = config.__file__.replace('.pyc', '.py')
|
filename = config.__file__.replace('.pyc', '.py')
|
||||||
|
filename = filename.replace('.pyo', '.py')
|
||||||
return pecan.configuration.conf_from_file(filename)
|
return pecan.configuration.conf_from_file(filename)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user