Skip to content

Commit 88dc95b

Browse files
committed
docs: clarify
1 parent 457bd50 commit 88dc95b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/docs/core/flow_def.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,16 @@ You can pass the following arguments to `add_source()` to control the concurrenc
158158
* `max_inflight_rows`: the maximum number of concurrent inflight requests for the source operation.
159159
* `max_inflight_bytes`: the maximum number of concurrent inflight bytes for the source operation.
160160

161+
For example:
162+
163+
```py
164+
@cocoindex.flow_def(name="DemoFlow")
165+
def demo_flow(flow_builder: cocoindex.FlowBuilder, data_scope: cocoindex.DataScope):
166+
data_scope["documents"] = flow_builder.add_source(
167+
DemoSourceSpec(...), max_inflight_rows=10, max_inflight_bytes=100*1024*1024)
168+
......
169+
```
170+
161171
The default value can be specified by [`DefaultExecutionOptions`](/docs/core/settings#defaultexecutionoptions) or corresponding [environment variable](/docs/core/settings#list-of-environment-variables).
162172

163173
### Transform
@@ -210,7 +220,18 @@ You can pass the following arguments to `row()` to control the concurrency of th
210220

211221
* `max_inflight_rows`: the maximum number of concurrent inflight requests for the for-each operation.
212222
* `max_inflight_bytes`: the maximum number of concurrent inflight bytes for the for-each operation.
223+
We only take the number of bytes from this row before this for-each operation into account.
224+
225+
For example:
213226

227+
```python
228+
@cocoindex.flow_def(name="DemoFlow")
229+
def demo_flow(flow_builder: cocoindex.FlowBuilder, data_scope: cocoindex.DataScope):
230+
...
231+
with data_scope["table1"].row(max_inflight_rows=10, max_inflight_bytes=10*1024*1024) as table1_row:
232+
# Children operations
233+
table1_row["field2"] = table1_row["field1"].transform(DemoFunctionSpec(...))
234+
```
214235

215236
### Get a sub field
216237

0 commit comments

Comments
 (0)