YunoHost / package_check

Shell script which check package actions: install, remove, upgrade, backup, restore…
GNU General Public License v3.0
21 stars 26 forks source link

Add cache for pip packages #25

Closed Jibec closed 1 year ago

Jibec commented 7 years ago

Every run of package test is done on a fresh Debian, with many missing packages.

It looks like pip has a default repository for caching purpose, would it be possible to create a folder in the host so package downloads faster?

https://pip.pypa.io/en/stable/reference/pip_install/#caching

Jibec commented 6 years ago

Solved by adding this to /var/lib/lxc/pchecker_lxc/config

lxc.mount.entry = /var/cache/pip/cache/ var/cache/pip/cache/ none bind,create=dir 0.0

and editing snapshot:

echo -e "\e[1m> Add PIP cache\e[0m"
sudo cp $script_dir/pip.conf /var/lib/lxcsnaps/$LXC_NAME/snap0/rootfs/etc/pip.conf
sudo mkdir -p /var/lib/lxc/$LXC_NAME/rootfs/var/cache/pip/cache/

Here is the content of pip.conf:

[global]
cache_dir = /var/cache/pip/cache

For the following tests (only one test):

Result without any cache: Global working time for all tests: 4 minutes, 40 seconds. Global network usage for all tests: 116MiB (rx: 9,9MiB, tx: 106MiB).

Result with APT cache: Global working time for all tests: 4 minutes, 25 seconds. Global network usage for all tests: 78MiB (rx: 9,3MiB, tx: 69MiB).

Result with APT and PIP cache: Global working time for all tests: 3 minutes, 46 seconds. Global network usage for all tests: 25MiB (rx: 8,2MiB, tx: 17MiB).

.

.

Global test results: Global working time for all tests: 34 minutes, 49 seconds. Global network usage for all tests: 441MiB (rx: 63MiB, tx: 379MiB).

vs 55 minutes and 1,6 Gio.

alexAubin commented 1 year ago

Closing as wontfix