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.0.tar.gz
(11.5 kB
view details)
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 heroku_manager-0.1.0.tar.gz.
File metadata
- Download URL: heroku_manager-0.1.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b2985ead3f94b351f86af38aa987e570b5ad9e738f95d0e6507413cf1eacac8
|
|
| MD5 |
8c39937cd2b534e09cfc61af3c2361dc
|
|
| BLAKE2b-256 |
c6dc7f26e517b1696351ffeccaccbe800959db03dde5ade48ad69eeca843b1f0
|
File details
Details for the file heroku_manager-0.1.0-py3-none-any.whl.
File metadata
- Download URL: heroku_manager-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9393e5f167dabdd3ac5f284a60e91aa85a73188ac7a95a4b0af99f33d9bebd23
|
|
| MD5 |
3b8c8cccc5c42dd1e0b0e29a4919e22f
|
|
| BLAKE2b-256 |
6cb4cd9f0e164ed903c11a31dd66fcc256c80d9c915adbcef5539d9e25cfb0e3
|