A package for managing Heroku dynos with autoscaling capabilities
Project description
Heroku Manager
A Python package for managing Heroku dynos with autoscaling capabilities.
Features
- Automatic scaling of Heroku dynos based on memory usage and load
- Monitoring of dyno health and performance
- Automatic restart of unresponsive dynos
- Integration with Django for caching and configuration
Installation
pip install heroku-manager
Usage
from heroku_manager import HerokuManager
# Get the autoscaler instance
autoscaler = HerokuManager.get_autoscaler()
# Start continuous autoscaling
autoscaler.start_continuous_autoscale()
# Manual scaling operations
if autoscaler.requires_upscale:
autoscaler.upscale_formation_to_next_level()
elif autoscaler.allow_downscale:
autoscaler.downscale_formation_to_original_size()
# Stop autoscaling
autoscaler.stop_continuous_autoscale()
Configuration
The package requires the following environment variables:
HEROKU_API_KEY: Your Heroku API keyHEROKU_APP_NAME: The name of your Heroku appDYNO: The name of the current dyno (automatically set by Heroku)
Django Settings
When used with Django, the following settings are available:
DYNO_CONTINUOS_AUTOSCALE_ENABLED: Enable continuous autoscalingDYNO_AUTOSCALE_INTERVAL: Interval between autoscale checks (in seconds)DYNO_TIME_BETWEEN_SCALES: Minimum time between scaling operations (in seconds)DYNO_MIN_UPSCALE_DURATION: Minimum duration to keep a dyno upscaled (in seconds)DYNO_DOWNSCALE_CHECK_INTERVAL: Interval for checking if a dyno can be downscaled (in seconds)DYNO_ZOMBIE_THRESHOLD: Time threshold for considering a dyno as unresponsive (in seconds)DYNO_LOG_THREADS_USED: Whether to log the number of threads usedDYNO_LOGS_CACHE_DURATION: Duration to cache dyno logs (in seconds)DYNO_ERRORS_TIMEOUT_DURATION: Duration to cache error information (in seconds)DYNO_GENERAL_CACHE_DURATION: General cache duration (in seconds)DYNO_TIME_BETWEEN_RESTARTS: Minimum time between dyno restarts (in seconds)DYNO_AUTOSCALE_ENABLED_FOR_BEATWORKER: Whether to enable autoscaling for beat workersUPSCALE_PERCENTAGE_HIGH_MEM_USE: Memory usage percentage threshold for upscalingDOWNSCALE_PERCENTAGE_HIGH_MEM_USE: Memory usage percentage threshold for downscalingHIGH_MEM_USE_MB: High memory usage threshold in MB
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
heroku_manager-0.1.1.tar.gz
(11.6 kB
view details)
File details
Details for the file heroku_manager-0.1.1.tar.gz.
File metadata
- Download URL: heroku_manager-0.1.1.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af56dac851ecd46c5eab3761e70e0a08c00d4dbe04f40e2e723c96a28b5db62a
|
|
| MD5 |
12cdde041498218b2a23bed26ecc76c0
|
|
| BLAKE2b-256 |
533d3da2ba941d76c1b7d762e07c074e83248a19127abbf61c8d68d7fbcc307b
|