Skip to content

Commit 4f30cb1

Browse files
committed
Enhance build scripts and documentation for MediaPipe GPU Wheel
- Updated `build-multiple.sh` to allow continued builds for other Python versions even if one fails, and added reporting for failed builds. - Improved `build.sh` to ensure log files are created and output is properly logged. - Enhanced `stop-builds.sh` to include comprehensive Docker cleanup, removing unused images and build cache. - Updated `README.md` to clarify the functionality of `stop-builds.sh` with additional details on Docker cleanup processes. - Added a note on production readiness issues in `PRODUCTION_READINESS_ISSUES.md` to emphasize the need for addressing memory leaks and GPU context issues.
1 parent f46be1f commit 4f30cb1

5 files changed

Lines changed: 37 additions & 7 deletions

File tree

docs/PRODUCTION_READINESS_ISSUES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,4 @@ While the wheel demonstrates excellent basic GPU functionality and performance m
216216
**Production Readiness**: ❌ NOT READY
217217
**Recommended Use**: Development and testing only
218218
**Priority**: Fix memory leaks and GPU context issues before production deployment
219+

scripts/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ This directory contains all executable scripts for building, testing, and publis
6363
./scripts/check-build-status.sh
6464
```
6565

66-
- **`stop-builds.sh`** - Stop all running build processes
66+
- **`stop-builds.sh`** - Stop all running build processes and clean Docker cache
6767
```bash
6868
./scripts/stop-builds.sh
6969
```
70+
Stops build processes and performs comprehensive Docker cleanup including unused images and build cache
7071

7172
## Usage
7273

scripts/build-multiple.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,42 @@ echo "Log file: $MASTER_LOG"
1313
echo ""
1414

1515
# Build for each Python version
16+
FAILED_BUILDS=""
1617
for PYTHON_VERSION in 3.9 3.10 3.11 3.12 3.13 3.14; do
1718
echo ""
1819
echo "=========================================="
1920
echo "Building for Python $PYTHON_VERSION"
2021
echo "=========================================="
21-
22+
2223
PYTHON_VERSION=$PYTHON_VERSION MEDIAPIPE_VERSION=$MEDIAPIPE_VERSION ./scripts/build.sh
23-
24+
2425
if [ $? -ne 0 ]; then
2526
echo "❌ Build failed for Python $PYTHON_VERSION"
26-
exit 1
27+
FAILED_BUILDS="$FAILED_BUILDS $PYTHON_VERSION"
28+
# Continue with other versions instead of exiting
29+
continue
2730
fi
28-
31+
2932
echo "✓ Build completed for Python $PYTHON_VERSION"
3033
done
3134

3235
echo ""
3336
echo "=========================================="
34-
echo "All builds complete!"
37+
echo "All builds attempted!"
3538
echo "=========================================="
3639
echo ""
3740
echo "Built wheels:"
3841
ls -lh wheels/
3942

43+
if [ -n "$FAILED_BUILDS" ]; then
44+
echo ""
45+
echo "❌ Failed builds:$FAILED_BUILDS"
46+
echo "You can retry individual failed builds with:"
47+
for version in $FAILED_BUILDS; do
48+
echo " PYTHON_VERSION=$version ./scripts/build.sh"
49+
done
50+
fi
51+
4052
echo ""
4153
echo "Next steps:"
4254
echo " 1. Test: ./scripts/test-all-wheels.sh"

scripts/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ mkdir -p "$LOGS_DIR"
2828
LOG_FILE="$LOGS_DIR/build-${MEDIAPIPE_VERSION}-py${PYTHON_VERSION//./}.log"
2929
# Redirect output to both console and log file
3030
exec > >(tee "$LOG_FILE") 2>&1
31+
# Ensure log file exists
32+
touch "$LOG_FILE"
3133

3234
echo "=========================================="
3335
echo "MediaPipe GPU Wheel Builder"
@@ -87,7 +89,7 @@ DOCKER_BUILDKIT=1 docker build \
8789
--build-arg PYTHON_BIN="$PYTHON_BIN" \
8890
--tag mediapipe-gpu:${MEDIAPIPE_VERSION}-py${PYTHON_VERSION//./} \
8991
--progress=plain \
90-
. 2>&1 | tee -a "$LOG_FILE"
92+
.
9193

9294
if [[ $? -ne 0 ]]; then
9395
echo -e "${YELLOW}Build failed!${NC}"

scripts/stop-builds.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ pkill -f "docker build.*mediapipe" 2>/dev/null && echo "✓ Stopped docker build
1212
# Remove any containers
1313
docker ps -a | grep -E "mp_gpu|mediapipe" | awk '{print $1}' | xargs -r docker rm -f 2>/dev/null && echo "✓ Removed containers" || echo " No containers to remove"
1414

15+
# Clean up unused Docker images
16+
echo "Cleaning up Docker images..."
17+
docker images --filter "dangling=true" -q | xargs -r docker rmi 2>/dev/null && echo "✓ Removed dangling images" || echo " No dangling images to remove"
18+
19+
# Remove unused images (keeping recent ones)
20+
docker image prune -f && echo "✓ Removed unused images" || echo " No unused images to remove"
21+
22+
# Clean up build cache
23+
docker builder prune -f && echo "✓ Cleaned build cache" || echo " No build cache to clean"
24+
25+
# System-wide Docker cleanup (optional - removes more aggressively)
26+
# Uncomment the following line for comprehensive cleanup (removes stopped containers, unused networks, etc.)
27+
# docker system prune -f && echo "✓ Performed system-wide cleanup" || echo " No system cleanup needed"
28+
1529
# Verify nothing is running
1630
sleep 2
1731
if ps aux | grep -E "[b]uild.sh|[d]ocker build.*mediapipe" | grep -v grep > /dev/null; then

0 commit comments

Comments
 (0)