Skip to content

Commit

Permalink
Better pruning of docker images for gen_rtl.sh (#1051)
Browse files Browse the repository at this point in the history
* better docker pruning in gen_rtl
  • Loading branch information
steveri committed Feb 29, 2024
1 parent d02c156 commit 81c6b52
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .buildkite/pipelines/pmg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ env:

steps:

- label: 'setup'
commands:
- echo "git pull latest to prevent later collisions"
- echo "(each init step will try to do its own git pull latest...)"
- echo "(assumes all steps use the same host)"
- docker pull stanfordaha/garnet:latest
- wait



#####################################################################################
# Two quick RTL checks. Set soft fail so RTL failure does not fail integration tests.

Expand Down
18 changes: 10 additions & 8 deletions mflowgen/common/rtl/gen_rtl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ if [ "$use_container" == True ]; then
mkdir -p aha; cd aha
########################################################################

# Prune docker images...
echo '--- gen_rtl docker prune BEGIN' `date +%H:%M`
docker image prune -f -a --filter "until=6h" --filter=label='description=garnet' || true

echo ""; echo "After pruning:"; echo ""
docker images; echo ""
docker ps ; echo ""

# Choose a docker image; can set via "rtl_docker_image" parameter
default_image="stanfordaha/garnet:latest"

Expand Down Expand Up @@ -145,6 +137,16 @@ if [ "$use_container" == True ]; then
# MAKE SURE the docker container gets killed when this script dies.
trap "docker kill $container_name" EXIT

# Delete all dangling images created more than 6 hours ago.
# Notice that we prune images *after* starting container (pruner
# will refuse to kill image w/ active container)

echo '--- gen_rtl docker prune BEGIN' `date +%H:%M`
printf "\nBefore pruning:\n\n"; docker images; echo ""; docker ps; echo ""
docker image prune -f -a --filter "until=6h" --filter=label='description=garnet' || true
printf "\nAfter pruning:\n\n"; docker images; echo ""; docker ps; echo ""
echo '--- Continuing...'

if [ "$use_local_garnet" == True ]; then
docker exec $container_name /bin/bash -c "rm -rf /aha/garnet"
# Clone local garnet repo to prevent copying untracked files
Expand Down

0 comments on commit 81c6b52

Please sign in to comment.