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 62f28e1
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+34-1Lines changed: 34 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,7 +153,7 @@ RayOrch deliberately keeps the public model small:
153
153
| Object | Responsibility |
154
154
| --- | --- |
155
155
| UDF | Ordinary Python class or function that processes a batch |
156
-
|`RayModule`| UDF construction, replicas, batch size, recovery, and Ray actor options |
156
+
|`RayModule`| UDF construction, replicas, batch size, recovery, Ray actor options, and automatic actor reuse when the same object is called more than once|
157
157
|`Pipeline`| Static topology connecting compute stages, plus the concise one-shot `pipeline.run(...)` entry point |
158
158
|`rayorch.F`| Explicit expansion, filtering, broadcast, and reduction |
159
159
|`Executor`| Persistent actor ownership and execution lifecycle |
@@ -196,6 +196,39 @@ Read it as: **write batched UDFs → connect them in a Pipeline → assign resou
196
196
197
197
Use `pipeline.run(...)` for one finite execution. It creates an `Executor`, returns the `RunResult`, and closes the temporary actor pools; use `Executor(pipeline)` when several calls should reuse the same actors and loaded models. The functional form `ro.run(pipeline, ...)` remains equivalent to `pipeline.run(...)`.
198
198
199
+
When several DAG stages use the same model stack, keep one `RayModule` object and select the operation through an ordinary keyword argument to `run()`:
200
+
201
+
```python
202
+
classModelStack:
203
+
def__init__(self, model_path):
204
+
self.model = load_model(model_path)
205
+
206
+
defrun(self, values, *, stage):
207
+
if stage =="layout":
208
+
returnself.model.layout(values)
209
+
if stage =="recognize":
210
+
returnself.model.recognize(values)
211
+
raiseValueError(stage)
212
+
213
+
214
+
classDocumentPipeline(ro.Pipeline):
215
+
def__init__(self, model_path):
216
+
# This one RayModule describes one initialized model stack.
# Each invocation is an independent DAG Call, while both Calls reuse
225
+
# the actors and model state owned by the same RayModule object.
226
+
layouts =self.model(pages, stage="layout")
227
+
returnself.model(layouts, stage="recognize")
228
+
```
229
+
230
+
Here `stage` is a compile-time constant, while `pages` and `layouts` are symbolic `Port` inputs whose lineage is tracked by RayOrch. The two Calls retain independent dependencies, READY queues, recovery, and metrics; actor sharing is inferred from Python object identity and introduces no additional public pool abstraction. Calls sharing one `RayModule` currently also share its `batch_size` and recovery policy.
Structural relationships are explicit rather than hidden in framework conventions. In the table below, `A:[a0, a1]` is one ordered group attached to parent A, while `A/a0` is one independently schedulable child that retains both parent A and ordinal 0.
0 commit comments