|
| 1 | +--- |
| 2 | +name: modal-runtime-deploy-e2e |
| 3 | +description: Upgrade shared Modal runtime dependencies in kernelbot and verify them end to end. Use when changing torch/CUDA or other shared Modal image dependencies, deploying the Modal app, and validating with both Modal integration tests and real popcorn leaderboard submissions. |
| 4 | +--- |
| 5 | + |
| 6 | +# Modal Runtime Deploy and E2E |
| 7 | + |
| 8 | +Use this when changing shared Modal dependencies in `kernelbot`, especially torch/CUDA, and when you need to prove the live leaderboard is actually using the new runtime. |
| 9 | + |
| 10 | +## Scope |
| 11 | + |
| 12 | +- Shared Modal image: `src/runners/modal_runner.py` |
| 13 | +- GPU-bound Modal functions: `src/runners/modal_runner_archs.py` |
| 14 | +- Live app name: `discord-bot-runner` |
| 15 | +- Popcorn e2e path: generate invite if needed, join closed leaderboard, submit with `popcorn-cli` |
| 16 | + |
| 17 | +## Workflow |
| 18 | + |
| 19 | +1. Make the smallest dependency change in `src/runners/modal_runner.py`. |
| 20 | +2. If changing torch/CUDA, inspect all later `.uv_pip_install(...)` blocks for conflicting CUDA/NCCL packages. |
| 21 | +3. Deploy to Modal `pytest` first. |
| 22 | +4. Run the narrow Modal integration test: |
| 23 | + |
| 24 | +```bash |
| 25 | +cd /Users/mark/Dev/kernelbot |
| 26 | +env MODAL_TOKEN_ID=... MODAL_TOKEN_SECRET=... \ |
| 27 | + uv run --extra dev python -m pytest -s tests/test_modal.py -k 'test_modal_launcher_python_script and T4' |
| 28 | +``` |
| 29 | + |
| 30 | +5. If that passes, deploy to Modal `main`: |
| 31 | + |
| 32 | +```bash |
| 33 | +cd /Users/mark/Dev/kernelbot/src/runners |
| 34 | +env MODAL_TOKEN_ID=... MODAL_TOKEN_SECRET=... \ |
| 35 | + /Users/mark/Dev/kernelbot/.venv/bin/modal deploy --env main modal_runner_archs.py |
| 36 | +``` |
| 37 | + |
| 38 | +6. Run a real `popcorn` submission in `test` mode against the target leaderboard. |
| 39 | +7. Confirm the returned report shows the expected `Torch:` version. |
| 40 | +8. Only then run `--mode leaderboard` if the user asked for a ranked submission. |
| 41 | + |
| 42 | +## Closed Leaderboards |
| 43 | + |
| 44 | +Generate an invite with admin token: |
| 45 | + |
| 46 | +```bash |
| 47 | +cd /Users/mark/Dev/popcorn-cli |
| 48 | +env POPCORN_API_URL=... POPCORN_ADMIN_TOKEN=... \ |
| 49 | + cargo run --quiet -- admin generate-invites --leaderboards <leaderboard> --count 1 |
| 50 | +``` |
| 51 | + |
| 52 | +Join with the existing CLI identity in `~/.popcorn.yaml`: |
| 53 | + |
| 54 | +```bash |
| 55 | +cd /Users/mark/Dev/popcorn-cli |
| 56 | +env POPCORN_API_URL=... \ |
| 57 | + cargo run --quiet -- join '<invite_code>' |
| 58 | +``` |
| 59 | + |
| 60 | +## Real E2E Submit |
| 61 | + |
| 62 | +```bash |
| 63 | +cd /Users/mark/Dev/popcorn-cli |
| 64 | +env POPCORN_API_URL=... \ |
| 65 | + cargo run --quiet -- submit --no-tui --leaderboard <leaderboard> --gpu A100 --mode test <submission.py> |
| 66 | +``` |
| 67 | + |
| 68 | +Ranked submit: |
| 69 | + |
| 70 | +```bash |
| 71 | +cd /Users/mark/Dev/popcorn-cli |
| 72 | +env POPCORN_API_URL=... \ |
| 73 | + cargo run --quiet -- submit --no-tui --leaderboard <leaderboard> --gpu A100 --mode leaderboard <submission.py> |
| 74 | +``` |
| 75 | + |
| 76 | +Check recent runs: |
| 77 | + |
| 78 | +```bash |
| 79 | +cd /Users/mark/Dev/popcorn-cli |
| 80 | +env POPCORN_API_URL=... \ |
| 81 | + cargo run --quiet -- submissions list --leaderboard <leaderboard> --limit 5 |
| 82 | +``` |
| 83 | + |
| 84 | +## Failure Mode To Remember |
| 85 | + |
| 86 | +If a Modal run fails with: |
| 87 | + |
| 88 | +```text |
| 89 | +libtorch_cuda.so: undefined symbol: ncclDevCommCreate |
| 90 | +``` |
| 91 | + |
| 92 | +then a later package install likely replaced torch's expected CUDA/NCCL dependency set. The practical fix is to install `torch` last so its dependency versions win. |
0 commit comments