A Kubernetes-native scheduler that optimizes job execution based on carbon intensity forecasts from WattTime API. This scheduler helps reduce the carbon footprint of your workloads by scheduling them during periods of lower carbon intensity.
- Carbon-aware job scheduling based on WattTime API forecasts
- Support for multiple cloud regions and time windows
- Calculation of carbon savings compared to worst-case, naive, and median scheduling options
- Kubernetes-native deployment via Helm chart
- Kubernetes cluster (v1.19+)
- Helm v3+
- WattTime API credentials
You can install the carbon-aware scheduler via Helm:
# Add the carbon-aware Helm repository
helm repo add carbon-aware https://carbon-aware.github.io/charts
# Update your Helm repositories
helm repo update
# Install the scheduler chart (replace <namespace> with your target namespace)
helm install ca-scheduler -n <namespace> carbon-aware/schedulerTo install the chart from a local clone of this repository:
# Clone the repository
git clone https://github.com/carbon-aware/scheduler.git
cd scheduler
# Install the chart
helm install ca-scheduler -n <namespace> ./helm/schedulerEnsure you've included WattTime credentials in a secret in your namespace. Create a secret with your WattTime credentials:
kubectl create secret generic watttime-credentials \
--from-literal=username=your-username \
--from-literal=password=your-password \
-n <namespace>Refer to the values.yaml file in the chart for additional configuration options.
-
Clone the repository:
git clone https://github.com/carbon-aware/scheduler.git cd scheduler -
Run the setup script to set up your development environment:
# Make the script executable chmod +x scripts/setup-dev.sh # Run the setup script ./scripts/setup-dev.sh
This script will:
- Check for uv installation
- Create and activate a Python virtual environment
- Install project dependencies using uv sync
- Set up pre-commit hooks
-
Start a kind cluster:
ctlptl create cluster kind --name kind-ca-scheduler
-
Start Tilt:
tilt up
-
Access the scheduler API at: http://localhost:8080
python -m pytestdocker build -t carbon-aware/scheduler:dev ./schedulerThe region mapping is generated by the scripts/codegen_regions.py script. This script fetches the region data from the ElectricityMaps GitHub repository and generates the region mapping file.
To run the script the following from the scheduler directory:
python -m scripts.codegen_regionsContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.