Repository navigation
ci: improve execution times for install-slices - #580
Conversation
|
This is great, and actually it is a massive gain on time! I'm curious about what would be the result of this (parallelism) vs concurrency. In theory, concurrency works better for I/O operations so I think In any case, this is massive improvement :) |
👍 something that can be experimented later. |
zhijie-yang
left a comment
There was a problem hiding this comment.
Thanks for this PR, and here are some comments from my side.
|
in the future, can you make a branch named something other than 'main' to PR from? (ideally |
|
EDIT:
EDIT 2: turns out all was working correctly, just the way i've set up #607 it was installing all the slices as opposed to just the delta. i'll leave the comment as a chain of thought, but not applicable anymore. 👍 #!/usr/bin/bash
set -e
if [ "$1" = "--run" ]; then
docker run \
-it --rm \
-v.:/mnt \
--cpus 4 \
--cpuset-cpus 0-3 \
ubuntu:25.04 bash \
/mnt/test_install_slices.sh
exit 0
fi
export DEBIAN_FRONTEND=noninteractive
export TZ=Etc/UTC
cd /mnt
apt update
apt install -yq $(cat .github/scripts/install-slices/deb-requirements.txt)
apt install -yq python3-pip
pip install -r .github/scripts/install-slices/requirements.txt --break-system-packages
apt install -yq golang
go install "github.com/canonical/chisel/cmd/chisel@latest"
ln -s "$(go env GOPATH)/bin/chisel" /usr/bin/chisel
ARCH=$(uname -m)
[ "$ARCH" = "x86_64" ] && ARCH="amd64"
[ "$ARCH" = "aarch64" ] && ARCH="arm64"
# Trim to the first 50 SDFs for testing purposes
SDFS=$(find slices -type f -name "*.yaml")
SDFS=$(echo "$SDFS" | head -n 50)
date +%s > /mnt/start_time.txt
python3 .github/scripts/install-slices/install_slices.py \
--arch "${ARCH}" \
--release ./ \
--ensure-existence \
--ignore-missing \
--workers 20 \
${SDFS[@]}
date +%s > /mnt/end_time.txt
DELTA=$(($(cat /mnt/end_time.txt) - $(cat /mnt/start_time.txt)))
echo "NEW: $DELTA seconds" |
|
so, as an aside, i've been thinking what takes so much time in this CI anyway, and i've managed to speed it up by another 70%, down to about 210s on the test case above, and it never went above 50% CPU usage on any of the cores while previously being nearly saturated (aka, not CPU bound anymore). we run the validation inside of the chisel on each and every run we do, but we're always using the same release, so we really need to validate it only once. hence the trick is to install chisel like this: 😅 rather than doing this ☝️ in the ci though, i would say that this is a strong supporting argument/use-case for a PR to chisel with some kind |
There was a problem hiding this comment.
minor suggestions, but code-wise its ok. it works great locally and but i cannot approve before understanding why it failed with #607 builds (maybe its my poor setup). i'd like to see a fixed #607 with demonstrated speedup, or another test branch (now that i think about it, it can literally just be without any slice changes, just with CI change) which shows it will work in the CI.
EDIT: worked it out and fixed #607. we get approx x3 speedup with 4 workers which is what i'd expect based on local experiments. minor suggestions still applicable though.
zhijie-yang
left a comment
There was a problem hiding this comment.
Looks good to me. Just one suggestion: Sort the import in install_slices.py with isort, as the CI here likes things sorted ;)
Proposed changes
This PR replaces #564.
What's in it?
Related issues/PRs
#564
Checklist
Additional Context
Here are the tests and results:
We can use the latter to compare the improvement of the execution times with existing workflows. For example:
a similar pattern is verified on all other matrix cells of this job, if compared with existing runs of https://github.com/canonical/chisel-releases/actions/workflows/install-slices.yaml. Even when a specif arch/archive is slow, this new workflow still finished execution much faster.