Benoit Chesneau 17ac6a5254 examples: add celery_alternative example using dirty arbiters
Demonstrates replacing Celery with Gunicorn's dirty arbiters for
background task processing. Includes:

- 4 task workers: Email, Image, Data, Scheduled
- Stateful workers with persistent connections/caches
- Streaming progress for long-running tasks
- Per-app worker allocation
- Flask API with 15+ endpoints
- Docker deployment (single container vs Celery's 4+)
- Unit tests (19 tests) and integration tests
- Migration guide from Celery
2026-02-01 16:51:48 +01:00

36 lines
1015 B
Bash
Executable File

#!/bin/bash
# Run tests for Celery Replacement example
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
GUNICORN_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
# Add gunicorn to Python path
export PYTHONPATH="$GUNICORN_ROOT:$PYTHONPATH"
cd "$SCRIPT_DIR"
echo "=========================================="
echo "Running Unit Tests"
echo "=========================================="
python -m pytest tests/test_tasks.py -v --tb=short
echo ""
echo "=========================================="
echo "Unit tests passed!"
echo "=========================================="
# Check if integration tests should run
if [ "$1" == "--integration" ] || [ "$1" == "-i" ]; then
APP_URL="${APP_URL:-http://localhost:8000}"
echo ""
echo "=========================================="
echo "Running Integration Tests against $APP_URL"
echo "=========================================="
python -m pytest tests/test_integration.py -v --tb=short
fi
echo ""
echo "All tests completed successfully!"