Python widget for on-demand GPU/CPU compute using RunPod and Ray
Project description
RayRun
A Jupyter notebook widget for on-demand GPU/CPU compute using RunPod and Ray.
Overview
RayRun provides a simple way to spin up cloud GPU/CPU instances directly from your Jupyter notebook, run distributed computations with Ray, and automatically shut down when idle to minimize costs.
Features
- One-click compute: Start GPU/CPU instances from within your notebook
- Pre-configured environment: PyTorch, data science tools, and Ray pre-installed
- Auto-shutdown: Automatically stops when idle to save money
- Ray integration: Direct connection to Ray cluster for distributed computing
- Cost-effective: Uses RunPod's community cloud by default
Installation
pip install rayrun
Quick Start
1. Set up your RunPod API key
export RUNPOD_API_KEY="your-api-key-here"
Or create a .env file in your project directory:
RUNPOD_API_KEY=your-api-key-here
2. Use in Jupyter
from rayrun import RayRun
# Create the widget
compute = RayRun(idle_timeout_minutes=30)
compute
3. Start compute
Click the "Start Compute" button in the widget. The widget will:
- Create a RunPod instance with Ray pre-installed
- Wait for the instance to be ready
- Display connection information (IP, Ray URL, Dashboard URL)
4. Connect to Ray
# Now you can use Ray!
import ray
ray.init("<url here>")
@ray.remote
def my_function(x):
return x * x
# Run distributed computation
futures = [my_function.remote(i) for i in range(10)]
results = ray.get(futures)
print(results)
5. Stop compute
Click "Stop Compute" in the widget, or the instance will automatically shut down after the idle timeout (default: 30 minutes).
Pre-installed Packages
The Docker image includes:
- Ray: Distributed computing framework
- PyTorch: torch, torchaudio, torchvision
- Data Science: polars, numpy, scipy, scikit-learn
- Visualization: matplotlib, altair
- System: ffmpeg
Future Work
The following features are currently outside the scope of this project:
- Custom Docker Images: Support for user-specified Docker images with custom dependencies
- TLS/SSL for Ray Connections: Encrypted Ray client connections via TLS
- Cost Tracking UI: Real-time cost display and accumulated spend in the widget
- Automatic Retry Logic: Retry on transient failures during pod creation or Ray connection
- Partial Failure Recovery: Handling cases where VM is up but Ray fails to start
- Pre-shutdown Warnings: Notification before automatic idle shutdown occurs
- VM Logs Display: Expandable section in widget to view container logs
- Resource Usage Monitoring: Display CPU/GPU/memory utilization in widget
- Estimated Cost Display: Show projected hourly/daily costs in widget
- Restart Button: Quick restart functionality without full stop/start cycle
- Multi-GPU Support: Configuration for pods with multiple GPUs
- Custom Data Center Selection: Fine-grained control over pod location
- Network Volume Management: Create and attach persistent network volumes
- Spot Instance Fallback: Automatic fallback to on-demand if spot unavailable
License
MIT License - see LICENSE file for details.
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
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 rayrun-0.1.0.tar.gz.
File metadata
- Download URL: rayrun-0.1.0.tar.gz
- Upload date:
- Size: 151.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6c6568644c78c2d6aa0f08ceb26ce1d76e150d6a1708c1363149db96b6e9d22
|
|
| MD5 |
49b6d85d2428e1eccaf95713479dc844
|
|
| BLAKE2b-256 |
147a004e262bfba336f208e423db7f794d142699edcc1182a564ae2d0af1d73b
|
Provenance
The following attestation bundles were made for rayrun-0.1.0.tar.gz:
Publisher:
publish_package.yml on rambip/rayrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rayrun-0.1.0.tar.gz -
Subject digest:
d6c6568644c78c2d6aa0f08ceb26ce1d76e150d6a1708c1363149db96b6e9d22 - Sigstore transparency entry: 969819452
- Sigstore integration time:
-
Permalink:
rambip/rayrun@b75227da56c4a1027537cf789380a6e3eb8ddfbd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/rambip
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_package.yml@b75227da56c4a1027537cf789380a6e3eb8ddfbd -
Trigger Event:
push
-
Statement type:
File details
Details for the file rayrun-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rayrun-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34b5f08d4d2bc68ff1849aaa5eb73193ee8a094dce76728006d542b7474667de
|
|
| MD5 |
6016e31a382763fb91c61c2c13a86bac
|
|
| BLAKE2b-256 |
9f77849aad452b8bf6d42851633a45888f0154aa4a135b0d57720377e3483c76
|
Provenance
The following attestation bundles were made for rayrun-0.1.0-py3-none-any.whl:
Publisher:
publish_package.yml on rambip/rayrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rayrun-0.1.0-py3-none-any.whl -
Subject digest:
34b5f08d4d2bc68ff1849aaa5eb73193ee8a094dce76728006d542b7474667de - Sigstore transparency entry: 969819496
- Sigstore integration time:
-
Permalink:
rambip/rayrun@b75227da56c4a1027537cf789380a6e3eb8ddfbd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/rambip
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_package.yml@b75227da56c4a1027537cf789380a6e3eb8ddfbd -
Trigger Event:
push
-
Statement type: