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
docs: update default ExitMode to DELETE_AFTER_JOBS (#170)
- Default on_exit changed from DELETE to DELETE_AFTER_JOBS
- Document new wait_timeout parameter
- Move Exit Modes section under KubeRay since it only applies there
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/geneva/jobs/contexts.mdx
+32-1Lines changed: 32 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,6 +97,37 @@ See the API docs for all the parameters [`GenevaCluster.create_kuberay()`](https
97
97
98
98
</CodeGroup>
99
99
100
+
#### Exit Modes
101
+
102
+
By default, the KubeRay cluster waits for all running jobs to complete before deleting. You can customize this behavior with the `on_exit` parameter:
103
+
104
+
```python Python icon="python"
105
+
from geneva.runners.ray.raycluster import ExitMode
106
+
107
+
with db.context(cluster=cluster_name, manifest=manifest_name, on_exit=ExitMode.DELETE_AFTER_JOBS):
108
+
fut1 = tbl.backfill_async("embedding_a")
109
+
fut2 = tbl.backfill_async("embedding_b")
110
+
# No need to call .result() — the context waits for both jobs
111
+
# Both jobs completed; cluster deleted
112
+
```
113
+
114
+
| Exit Mode | Behavior |
115
+
|-----------|----------|
116
+
|`ExitMode.DELETE_AFTER_JOBS` (default) | Wait for all async jobs to complete, then delete. Ideal for batch scripts using `backfill_async()`. |
117
+
|`ExitMode.DELETE`| Always delete the cluster immediately on exit, without waiting for running jobs. |
118
+
|`ExitMode.DELETE_ON_SUCCESS`| Delete on success; retain if an exception occurred. Useful for debugging. |
119
+
|`ExitMode.RETAIN`| Never delete the cluster. Useful for notebooks and interactive sessions. |
120
+
121
+
<Tip>
122
+
`DELETE_AFTER_JOBS` is the default — the cluster stays alive until all running jobs have finished, then cleans itself up automatically. You can set a `wait_timeout` (in seconds) to cap how long the cluster waits before deleting:
123
+
124
+
```python Python icon="python"
125
+
with db.context(cluster=cluster_name, on_exit=ExitMode.DELETE_AFTER_JOBS, wait_timeout=300):
126
+
fut = tbl.backfill_async("embedding")
127
+
# Waits up to 5 minutes for jobs, then deletes regardless
128
+
```
129
+
</Tip>
130
+
100
131
### External Ray cluster
101
132
If you already have a Ray cluster, Geneva can execute jobs against it too. You do so by defining a Geneva cluster with [`GenevaCluster.create_external()`](https://lancedb.github.io/geneva/api/cluster/#geneva.cluster.mgr.GenevaCluster.create_external) which has the address of the cluster. Here's an example:
102
133
@@ -266,7 +297,7 @@ with db.context(cluster=cluster_name, manifest=manifest_name):
266
297
```
267
298
</CodeGroup>
268
299
269
-
In a notebook environment, you can manually enter and exit the context manager in multiple steps like so:
300
+
In a notebook environment, you can manually enter and exit the context manager in multiple steps like so:
0 commit comments