feat(foreign): JSON call and parallel fan-out
F2: call/call_many JSON bridge, run_many ordered parallel execution with per-item isolation and concurrency cap, plus node gold tests for call and call_many.
This commit is contained in:
1 parent
e32ff8f6b3
commit
7859170aec
8 files changed
+597
-19
No files matched your search
@@ -3343,6 +3343,18 @@ fn lib_foreign_json() {
|
||||
assert_out("tests/lib/foreign-json.mq.md", "True\n4\n10");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lib_foreign_call() {
|
||||
if !node_available() {
|
||||
eprintln!("skip lib_foreign_call: no node on PATH");
|
||||
return;
|
||||
}
|
||||
assert_out(
|
||||
"tests/lib/foreign-call.mq.md",
|
||||
"2\n[2, 4, 6, 8]",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lib_foreign_env_timeout() {
|
||||
if !node_available() {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: foreign call and call_many
|
||||
import foreign:lib/foreign.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
`双倍` =
|
||||
```node
|
||||
let s = "";
|
||||
process.stdin.on("data", d => { s += d; });
|
||||
process.stdin.on("end", () => {
|
||||
console.log(JSON.stringify(JSON.parse(s) * 2));
|
||||
});
|
||||
```
|
||||
|
||||
**单个 = > foreign.call code=`双倍` input=1**
|
||||
> print text=`单个`
|
||||
|
||||
`数值表` =
|
||||
|
||||
| 数值 |
|
||||
|------|
|
||||
| 1 |
|
||||
| 2 |
|
||||
| 3 |
|
||||
| 4 |
|
||||
|
||||
**多个 = > foreign.call_many code=`双倍` inputs=`数值表` concurrency=2**
|
||||
> print text=`多个`
|
||||
Reference in new issue
Block a user