High-throughput parallel file system cleaner
Project description
BeeperPurge 🧹
High-throughput parallel file system cleaner designed for efficiently eliminating millions of old files as close to simultaneously as possible.
Features
- 🚀 Parallel processing with multi-threading
- 🎯 Precision targeting of files by age
- 🔍 Dry-run mode for operation verification
- 📝 Kubernetes-friendly JSON logging
- 🔒 Safe handling of sensitive file systems
- ⚙️ Configurable age thresholds
- 🐳 Production-ready container with security best practices
Installation and Running
Running as a Kubernetes Cron Job (Recommended)
To automate regular cleanups using beeper-purge in Kubernetes, you can configure a Kubernetes CronJob that runs at a specified interval. This example mounts an existing PersistentVolumeClaim (PVC) to the cron job container.
Create a CronJob Manifest: Replace /data with your target path in the volume and adjust schedule and other parameters as needed.
apiVersion: batch/v1
kind: CronJob
metadata:
name: beeper-purge-cron
spec:
schedule: "0 0 * * *" # Run daily at midnight
jobTemplate:
spec:
template:
spec:
containers:
- name: beeper-purge
image: ghcr.io/RiveryIO/beeper-purge:latest
args:
- "/data"
- "--max-age-hours"
- "36"
volumeMounts:
- name: data-volume
mountPath: /data
restartPolicy: OnFailure
volumes:
- name: data-volume
persistentVolumeClaim:
claimName: your-existing-pvc-name # Replace with your PVC name
Using Docker
docker pull ghcr.io/RiveryIO/beeper-purge:latest
# Always verify targets first with dry run
docker run -v /path/to/clean:/data ghcr.io/RiveryIO/beeper-purge:latest \
/data --dry-run --max-age-hours 36
# Execute purge operation
docker run -v /path/to/clean:/data ghcr.io/RiveryIO/beeper-purge:latest \
/data --max-age-hours 36
Using pip
pip install beeper-purge
Usage
# Show help
beeperpurge --help
# Reconnaissance (dry run)
beeperpurge /path/to/clean --dry-run --max-age-hours 36
# Execute purge
beeperpurge /path/to/clean --max-age-hours 36 --workers 16
# Show version
beeperpurge --version
Operational Metrics
$ beeperpurge /data --dry-run
{
"timestamp": "2024-11-02T10:15:30,123",
"level": "INFO",
"message": "Starting purge operation",
"extra_fields": {
"root_path": "/data",
"dry_run": true,
"max_workers": 16
}
}
...
{
"timestamp": "2024-11-02T10:15:35,456",
"level": "INFO",
"message": "Operation completed",
"extra_fields": {
"files_processed": 1000000,
"files_targeted": 150000,
"duration_seconds": 5.33,
"elimination_rate": 187617
}
}
Safety Protocols
- 🛡️ Dry-run mode for target verification
- 🔗 No symlink following
- 🚨 Comprehensive error handling
- 👤 Non-root container execution
- ✅ Extensive test coverage
Performance Specifications
Scalability
- Efficiently handles millions of files
- Memory usage scales linearly with worker count
- I/O optimized operations
Recommended Configurations
- Standard systems: 8-16 workers
- High-performance systems: 16-32 workers
- Adjust based on:
- Available CPU cores
- I/O capabilities
- File system response times
Development
Setup
# Clone repository
git clone https://github.com/RiveryIO/BeeperPurge.git
cd beeperpurge
# Create virtual environment
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
# Install development dependencies
pip install -e ".[dev]"
Testing
# Full test suite
pytest
# Coverage analysis
pytest --cov=beeper_purge
# Specific test execution
pytest tests/test_cleaner.py
Container Build
docker build -t beeper-purge .
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feat/enhancement). Valid branch prefixes are feat,fix,chore. - Commit your changes (
git commit -m 'Add enhancement') - Push to the branch (
git push origin feat/enhancement) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file beeperpurge-1.0.18.tar.gz.
File metadata
- Download URL: beeperpurge-1.0.18.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8737b46c4eb7f14a30b87f92ebbaa20f060a1765bbcb3b5630d5c405afc76bee
|
|
| MD5 |
c16866ef4040f089b3a0ffc90d5a083b
|
|
| BLAKE2b-256 |
c0b56830d0be99a9605a08e244e177c541dc9f245157596461a17e45f5929fe0
|
File details
Details for the file beeperpurge-1.0.18-py3-none-any.whl.
File metadata
- Download URL: beeperpurge-1.0.18-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b411b99696900558b1543cf45546c111fb808a38e967259593694fca97931c69
|
|
| MD5 |
2695a043df81fe250ed4df84ca4fa69d
|
|
| BLAKE2b-256 |
f41fcc4f8c5273c5146e7c1fa84ccdb2c6cc60631cdd132488f49c9f0cf761ae
|