Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Tests

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pandas # needed by some tests

- name: Run environment check
run: python -m test.test_checkenv

- name: Run environment test
run: python -m test.test_env

- name: Run workload generator sanity tests
run: python -m test.test_sanity_workloadgen

- name: Run workload generator determinism tests
run: python -m test.test_determinism_workloadgen

- name: Run price history tests
run: python -m test.test_price_history

- name: Run price cycling tests
run: python -m test.test_prices_cycling

- name: Run environment sanity tests (quick invariants)
run: python -m test.test_sanity_env --steps 200

- name: Run environment sanity tests (full)
run: python -m test.test_sanity_env --check-gym --check-determinism --steps 300

- name: Run environment sanity tests (with external data)
run: python -m test.test_sanity_env --prices data/prices_2023.csv --hourly-jobs data/allusers-gpu-30.log --steps 300

- name: Run duration sampler test
run: python -m test.test_sampler_duration --print-stats --test-samples 10

- name: Run hourly sampler test
run: python -m test.test_sampler_hourly --file-path data/allusers-gpu-30.log --test-day

- name: Run jobs sampler test
run: python -m test.test_sampler_jobs --file-path data/allusers-gpu-30.log

- name: Run jobs aggregated sampler test
run: python -m test.test_sampler_jobs_aggregated --file-path data/allusers-gpu-30.log
40 changes: 33 additions & 7 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ powersched/
│ ├── weights.py # Reward weights
│ └── plot.py # Visualization
├── test/ # Test files (all start with test_)
│ ├── run_all.py # Run all tests
│ ├── test_checkenv.py # Environment validation
│ ├── test_env.py # Quick environment test
│ ├── test_sanity_env.py # Environment sanity checks (invariants, determinism)
│ ├── test_sampler_*.py # Sampler tests
│ └── test_*.py # Other unit tests
├── .github/workflows/ # CI/CD
│ └── tests.yml # GitHub Actions test workflow
├── train.py # Main training script
├── train_iter.py # Sequential training
├── data/ # Sample data
Expand Down Expand Up @@ -89,18 +93,40 @@ This runs the trained model for the specified number of months and generates:
python ./train_iter.py
```

**Run Tests:**
**Run All Tests:**
```bash
python -m test.test_sampler_duration --print-stats --plot
python -m test.test_sampler_jobs --file-path data/jobs.log
python -m test.test_sampler_jobs_aggregated --file-path data/jobs.log
python -m test.test_sampler_hourly --file-path data-internal/allusers-main-30.log --test-day
python test/run_all.py
```

**Run Individual Tests:**
```bash
# Environment tests
python -m test.test_checkenv
python -m test.test_env

# Environment sanity tests (three modes)
python -m test.test_sanity_env --steps 200 # Quick invariants
python -m test.test_sanity_env --check-gym --check-determinism --steps 300 # Full checks
python -m test.test_sanity_env --prices data/prices_2023.csv --hourly-jobs data/allusers-gpu-30.log --steps 300 # With external data

# Workload generator tests
python -m test.test_sanity_workloadgen
python -m test.test_determinism_workloadgen

# Price tests
python -m test.test_price_history
python -m test.test_prices_cycling
python -m test.test_determinism_workloadgen
python -m test.test_sanity_workloadgen

# Sampler tests
python -m test.test_sampler_duration --print-stats --test-samples 10
python -m test.test_sampler_hourly --file-path data/allusers-gpu-30.log --test-day
python -m test.test_sampler_jobs --file-path data/allusers-gpu-30.log
python -m test.test_sampler_jobs_aggregated --file-path data/allusers-gpu-30.log
```

**GitHub Actions:**
Tests run automatically on push/PR to master/main via `.github/workflows/tests.yml`.

Comment thread
rbx marked this conversation as resolved.
## Key Training Parameters

The system uses weighted reward components:
Expand Down
Loading