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
Copy file name to clipboardExpand all lines: README.md
+81-8Lines changed: 81 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ The following backends are implemented:
25
25
Documentation can be found below.
26
26
27
27
> [!NOTE]
28
-
> This project is in early development. Contributions are very welcome! See the [Development](#development) section below.
28
+
> This project is in early development. APIs are unstable and can change at any time. Contributions are very welcome! See the [Development](#development) section below.
29
29
30
30
# Installation
31
31
@@ -128,10 +128,83 @@ definitions = Definitions(
128
128
129
129
This backend requires a Kubernetes cluster with the `KubeRay Operator` installed.
130
130
131
-
Integrates with [Dagster+](https://dagster.io/plus) by injecting environment variables such as `DAGSTER_CLOUD_DEPLOYMENT_NAME` and tags such as `dagster/user` into default configuration values and `RayCluster` labels.
131
+
Integrates with [Dagster+](https://dagster.io/plus) by injecting environment variables such as `DAGSTER_CLOUD_DEPLOYMENT_NAME` and tags such as `dagster/user` into default configuration values and Kubernetes labels.
132
+
133
+
To run `ray` code in client mode (from the Dagster Python process directly), use the `KubeRayClient` resource (see the [KubeRayCluster](#KubeRayCluster) section).
134
+
To run `ray` code in job mode, use the `PipesRayJobClient` with Dagster Pipes (see the [Pipes](#pipes) section).
132
135
133
136
The public objects can be imported from `dagster_ray.kuberay` module.
134
137
138
+
### Pipes
139
+
140
+
`dagster-ray` provides the `PipesRayJobClient` which can be used to execute remote Ray jobs on Kubernetes and receive Dagster events and logs from them.
141
+
[RayJob](https://docs.ray.io/en/latest/cluster/kubernetes/getting-started/rayjob-quick-start.html) will manage the lifecycle of the underlying `RayCluster`, which will be cleaned up after the specified entrypoint exits.
142
+
143
+
Examples:
144
+
145
+
On the orchestration side, import the `PipesRayJobClient` and invoke it inside an `@op` or an `@asset`:
146
+
147
+
```python
148
+
from dagster import AssetExecutionContext, Definitions, asset
The logs and events emitted by the Ray job will be captured by the `PipesRayJobClient` and will become available in the Dagster event log. Standard output and standard error streams will be forwarded to the standard output of the Dagster process.
196
+
197
+
198
+
**Running locally**
199
+
200
+
When running locally, the `port_forward` option has to be set to `True` in the `PipesRayJobClient` resource in order to interact with the Ray job. For convenience, it can be set automatically with:
@@ -252,13 +325,13 @@ Running `pytest` will **automatically**:
252
325
- build an image with the local `dagster-ray` code
253
326
- start a `minikube` Kubernetes cluster
254
327
- load the built `dagster-ray` and loaded `kuberay-operator` images into the cluster
255
-
- install the `KubeRay Operator`in the cluster with `helm`
328
+
- install `KubeRay Operator`into the cluster with `helm`
256
329
- run the tests
257
330
258
331
Thus, no manual setup is required, just the presence of the tools listed above. This makes testing a breeze!
259
332
260
333
> [!NOTE]
261
-
> Specifying a comma-separated list of `KubeRay Operator` versions in the `KUBE_RAY_OPERATOR_VERSIONS` environment variable will spawn a new test for each version.
334
+
> Specifying a comma-separated list of `KubeRay Operator` versions in the `PYTEST_KUBERAY_VERSIONS` environment variable will spawn a new test for each version.
262
335
263
336
> [!NOTE]
264
337
> it may take a while to download `minikube` and `kuberay-operator` images and build the local `dagster-ray` image during the first tests invocation
0 commit comments