You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit abc4ee1
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
-251Lines changed: 0 additions & 251 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,30 +69,6 @@ rp flash dev main.py # live dev session: edit, re-run, logs stream back
69
69
rp flash deploy # deploy production endpoints
70
70
```
71
71
72
-
Functions keep their Python identity: `chat.remote(...)` runs in the cloud, `await chat.remote.aio(...)` is the async form, `chat.local(...)` runs in-process. See [`examples/apps`](examples/apps) for runnable examples and [docs.runpod.io](https://docs.runpod.io) for the full guide.
73
-
74
-
Queue `.remote()` calls request a synchronous result and poll the same job if the server's wait window expires. Fast results need no client-side polling. Dev sessions use a short sync window to keep worker logs responsive. Use `.spawn()` for an asynchronous job handle. A transport failure before receiving a job ID raises an error without resubmitting the work.
datacenter-local storage. Apps resolve names and choose a datacenter compatible
80
-
with every resource sharing the volume. `GlobalVolume(name_or_id, create=True)`
81
-
references global storage without a datacenter constraint. Both inherit from
82
-
the abstract `Volume` base, resolve by name or ID, and create missing storage
83
-
when provisioning remote compute. Set `create=False` to require existing storage.
84
-
Global-volume lookup and creation use GraphQL; network volumes use REST.
85
-
86
-
Declare attachments with `mounts={"/path": volume}`. Tasks support one network
87
-
and one global volume at distinct, non-overlapping paths. Queue and API resources
88
-
support one volume at `/runpod-volume`; global storage requires a GPU endpoint.
89
-
90
-
Inside worker code, `volume.path` returns the configured mount path. The runtime
91
-
binds declared references and resolved IDs before importing user code. Access
92
-
raises if the volume is unmounted or has multiple bindings. Evaluate `.path`
93
-
inside remote functions, not during local module discovery. Calling `.local()`
94
-
does not mount remote storage on the client machine.
95
-
96
72
## Contributing
97
73
98
74
Pull requests and issues are welcome — see the [contributing guide](CONTRIBUTING.md) to get started.
@@ -145,233 +121,6 @@ You can also test your worker locally before deploying it to Runpod. This is use
145
121
python my_worker.py --rp_serve_api
146
122
```
147
123
148
-
### Worker Fitness Checks
149
-
150
-
Fitness checks allow you to validate your worker environment at startup before processing jobs. If any check fails, the worker exits immediately, allowing your orchestrator to restart it.
151
-
152
-
```python
153
-
# my_worker.py
154
-
155
-
import runpod
156
-
import torch
157
-
158
-
# Register fitness checks using the decorator
159
-
@runpod.serverless.register_fitness_check
160
-
defcheck_gpu_available():
161
-
"""Verify GPU is available."""
162
-
ifnot torch.cuda.is_available():
163
-
raiseRuntimeError("GPU not available")
164
-
165
-
@runpod.serverless.register_fitness_check
166
-
defcheck_disk_space():
167
-
"""Verify sufficient disk space."""
168
-
import shutil
169
-
stat = shutil.disk_usage("/")
170
-
free_gb = stat.free / (1024**3)
171
-
if free_gb <10:
172
-
raiseRuntimeError(f"Insufficient disk space: {free_gb:.2f}GB free")
173
-
174
-
defhandler(job):
175
-
job_input = job["input"]
176
-
# Your handler code here
177
-
return {"output": "success"}
178
-
179
-
# Fitness checks run before handler initialization (production only)
180
-
runpod.serverless.start({"handler": handler})
181
-
```
182
-
183
-
**Key Features:**
184
-
- Supports both synchronous and asynchronous check functions
185
-
- Hardware checks run at the first Serverless `import runpod`; processes it launches inherit the result via `RUNPOD_EARLY_FITNESS_CHECKS_DONE` and skip the pass
186
-
- Local tests and non-worker imports remain exempt; network readiness and custom checks run at worker start
187
-
- Successful early checks are reused at worker start unless their configuration changes
188
-
- Runs before handler initialization and job processing begins
189
-
- Any check failure exits with code 1 (worker marked unhealthy)
190
-
191
-
See [Worker Fitness Checks](https://github.com/runpod/runpod-python/blob/main/docs/serverless/worker_fitness_checks.md) documentation for more examples and best practices.
192
-
193
-
### Network-Volume Warm Cache
194
-
195
-
When a network volume is attached, `VolumeCache` warms local directories (such as a model cache) across cold starts — hydrating them on startup and syncing new files back on exit — so a repeated multi-GB model download becomes a one-time cost per endpoint. It is stdlib-only and best-effort.
196
-
197
-
```python
198
-
from runpod.serverless import VolumeCache
199
-
200
-
with VolumeCache(dirs=["/root/.cache/huggingface"]):
201
-
model = load_model()
202
-
```
203
-
204
-
See [Network-Volume Warm Cache](https://github.com/runpod/runpod-python/blob/main/docs/serverless/volume_cache.md) documentation for configuration and details.
205
-
206
-
## 📚 | REST API v2 Wrapper
207
-
208
-
Use the API wrapper to manage Runpod resources through REST API v2.
0 commit comments