@dazitech/cli 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -14
- package/dist/clis/dazi-app.js +95 -14
- package/dist/clis/dazi-flow.js +602 -172
- package/dist/clis/dazi-onto.js +5 -3
- package/dist/clis/dazi.js +139 -38
- package/dist/docs/app/app-init.md +15 -15
- package/dist/docs/app/build-upload.md +13 -13
- package/dist/docs/app/release-guide.md +9 -9
- package/dist/docs/app//344/270/273/350/246/201/350/264/242/345/212/241/346/214/207/346/240/207/345/244/215/346/235/202/346/212/245/350/241/250/345/274/200/345/217/221/345/256/236/350/267/265.md +45 -41
- package/dist/docs/auth/auth-login.md +4 -4
- package/dist/docs/auth/token-management.md +5 -5
- package/dist/docs/data/cube-guide.md +2 -2
- package/dist/docs/data/data-spaces.md +4 -3
- package/dist/docs/data/table-preview.md +6 -6
- package/dist/docs/flow/ai-workflow-playbook.md +69 -0
- package/dist/docs/flow/flow-project-guide.md +92 -87
- package/dist/docs/flow/flows-guide.md +98 -94
- package/dist/docs/flow/local-files-spec.md +194 -0
- package/dist/docs/flow/node-code-guide.md +57 -55
- package/dist/docs/flow/run-guide.md +18 -18
- package/dist/docs/flow/variables-guide.md +61 -61
- package/dist/docs/flow//346/265/201/347/250/213/345/274/200/345/217/221/346/234/200/344/275/263/345/256/236/350/267/265-VS-flow0/346/241/210/344/276/213.md +31 -31
- package/dist/docs/guides/cli-invocation.md +30 -29
- package/dist/docs/guides/cli-reference.md +72 -71
- package/dist/docs/guides/flow-consistency-checklist.md +42 -0
- package/dist/docs/guides/mcp-setup.md +34 -34
- package/dist/docs/guides/migrate-v2-v3.md +6 -5
- package/dist/docs/guides/quickstart.md +8 -8
- package/dist/docs/guides/troubleshooting.md +40 -22
- package/dist/docs/guides/workspace-v3.md +17 -17
- package/dist/docs/index.json +19 -7
- package/dist/docs/onto/action-guide.md +4 -3
- package/dist/docs/onto/dazi_script_sdk_reference.md +20 -14
- package/dist/docs/onto/dazi_script_seed_data_guide.md +14 -14
- package/dist/docs/onto/function-guide.md +5 -5
- package/dist/docs/onto/rule-guide.md +7 -6
- package/dist/docs/onto/space-management.md +5 -3
- package/dist/docs/onto//346/234/254/344/275/223/350/204/232/346/234/254/347/274/226/345/206/231/346/214/207/345/215/227.md +35 -35
- package/dist/docs/onto//346/234/254/344/275/223/350/247/204/345/210/222/346/214/207/345/215/227.md +21 -21
- package/dist/docs/onto//350/247/204/345/210/222/347/244/272/344/276/213_/345/210/251/346/266/246/345/210/206/346/236/220/346/234/254/344/275/223/346/226/271/346/241/210.md +11 -11
- package/dist/examples/flow/minimal-excel-python/README.md +5 -0
- package/dist/examples/flow/minimal-excel-python/flow.json +48 -0
- package/dist/examples/flow/minimal-excel-python/flow.meta.json +23 -0
- package/dist/examples/flow/minimal-excel-python//350/212/202/347/202/271/Excel/347/244/272/344/276/213/code.py +7 -0
- package/dist/examples/flow/minimal-excel-python//350/212/202/347/202/271/Excel/347/244/272/344/276/213/node.info.json +14 -0
- package/dist/examples/index.json +7 -1
- package/dist/prompts/data/data-analysis.md +2 -2
- package/dist/prompts/flow/ai-workflow-playbook.md +69 -0
- package/dist/prompts/flow/flow-design.md +33 -19
- package/dist/prompts/flow/plan-generate.md +7 -7
- package/dist/prompts/flow/run-debug.md +15 -15
- package/dist/prompts/flow/run-fix-loop.md +20 -17
- package/dist/prompts/general/ask-dazi.md +6 -6
- package/dist/prompts/general/troubleshoot.md +4 -3
- package/dist/prompts/index.json +94 -15
- package/dist/prompts/onto/action-design.md +7 -5
- package/dist/prompts/onto/function-design.md +6 -4
- package/dist/prompts/onto/rule-seed.md +4 -2
- package/dist/prompts/onto/script-publish-run.md +19 -19
- package/package.json +1 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# 流程本地文件规范与示例
|
|
2
|
+
|
|
3
|
+
**文档 ID**: `flow/local-files-spec`
|
|
4
|
+
**适用**: `项目/flow_*/流程/<名>/` 目录、AI Agent、流程设计器
|
|
5
|
+
**关联**: [AI 工作手册](./ai-workflow-playbook.md)、[数据流程项目开发指南](./flow-project-guide.md)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. 三个文件的职责
|
|
10
|
+
|
|
11
|
+
| 文件 | 谁维护 | 存什么 | 禁止 |
|
|
12
|
+
|------|--------|--------|------|
|
|
13
|
+
| **`flow.json`** | 你 / 设计器 / `node new` + 编辑 | 画布:节点 `data`(配置)、`edges`、坐标;**不含**代码正文 | 手搓 `node_uuid`;嵌入大段 SQL/Python |
|
|
14
|
+
| **`flow.meta.json`** | **仅** `pull` / `node new` / `repair-meta` | `flowId`、uuid→`节点/` 映射、`codeHash`、画布指纹 | 手改后不同步 |
|
|
15
|
+
| **`节点/<名>/node.info.json`** | CLI 自动生成(只读) | uuid、类型、label、配置快照 | 当真理源编辑 |
|
|
16
|
+
|
|
17
|
+
**代码正文**只在 `节点/<名>/code.py` 或 `code.sql`。
|
|
18
|
+
|
|
19
|
+
设计器 **「打开代码」** 读取 `flow.meta.json` 的 `dir` + `codeFile`,**不会**扫描 `节点/` 猜文件。
|
|
20
|
+
→ meta 缺条目 = 图上有节点但打不开代码(见 §6)。
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2. 标准目录树
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
流程/<流程名>/
|
|
28
|
+
├── flow.json # 画布真理源(轻量,无 pythonCode/sql 正文)
|
|
29
|
+
├── flow.meta.json # 工程索引(CLI 维护)
|
|
30
|
+
├── 快速启动_<流程名>.md # pull 后生成(含一致性检查)
|
|
31
|
+
├── 节点/
|
|
32
|
+
│ └── Excel成本报表解析/
|
|
33
|
+
│ ├── code.py # 代码真理源
|
|
34
|
+
│ └── node.info.json # 只读派生
|
|
35
|
+
├── 变量/ # 调试 Run 派生(只读)
|
|
36
|
+
└── _run/ # 测试/运行错误(*.last-error.md)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 3. 标准示例(start → excel-python → end)
|
|
42
|
+
|
|
43
|
+
### 3.1 `flow.json`(片段)
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"nodes": [
|
|
48
|
+
{
|
|
49
|
+
"id": "start-node",
|
|
50
|
+
"type": "custom",
|
|
51
|
+
"position": { "x": 50, "y": 250 },
|
|
52
|
+
"data": { "label": "开始", "type": "start" },
|
|
53
|
+
"deletable": false,
|
|
54
|
+
"node_uuid": "aa1ba01e-bc96-41ab-b9e4-4b42e77aaae5"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "n-excel01",
|
|
58
|
+
"type": "custom",
|
|
59
|
+
"position": { "x": 310, "y": 250 },
|
|
60
|
+
"data": {
|
|
61
|
+
"label": "Excel成本报表解析",
|
|
62
|
+
"type": "excel-python",
|
|
63
|
+
"managed_file_id": "51853ede-9e6b-4a3a-aa7a-060cbead0862",
|
|
64
|
+
"output_variable_name": "成本统计报表"
|
|
65
|
+
},
|
|
66
|
+
"node_uuid": "d96222ce-aaa9-4050-b782-830c2f2de9eb"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "end-node",
|
|
70
|
+
"type": "custom",
|
|
71
|
+
"position": { "x": 850, "y": 250 },
|
|
72
|
+
"data": { "label": "结束", "type": "end" },
|
|
73
|
+
"deletable": false,
|
|
74
|
+
"node_uuid": "47c53b38-6005-4d7f-9f89-7ea56dab6b38"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"edges": [
|
|
78
|
+
{
|
|
79
|
+
"id": "e1",
|
|
80
|
+
"source": "start-node",
|
|
81
|
+
"sourceHandle": "r",
|
|
82
|
+
"target": "n-excel01",
|
|
83
|
+
"targetHandle": "l"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"id": "e2",
|
|
87
|
+
"source": "n-excel01",
|
|
88
|
+
"sourceHandle": "r",
|
|
89
|
+
"target": "end-node",
|
|
90
|
+
"targetHandle": "l"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
要点:`type` 恒为 `custom`,业务类型在 `data.type`;`node_uuid` 必须来自平台(`pull` / `node new`)。
|
|
97
|
+
|
|
98
|
+
### 3.2 `flow.meta.json`(片段)
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"flowId": "119",
|
|
103
|
+
"flowName": "vs-test-03",
|
|
104
|
+
"nodes": {
|
|
105
|
+
"aa1ba01e-bc96-41ab-b9e4-4b42e77aaae5": {
|
|
106
|
+
"nodeId": "start-node",
|
|
107
|
+
"nodeType": "start"
|
|
108
|
+
},
|
|
109
|
+
"d96222ce-aaa9-4050-b782-830c2f2de9eb": {
|
|
110
|
+
"nodeId": "n-excel01",
|
|
111
|
+
"nodeType": "excel-python",
|
|
112
|
+
"dir": "节点/Excel成本报表解析",
|
|
113
|
+
"codeFile": "code.py",
|
|
114
|
+
"codeLanguage": "python",
|
|
115
|
+
"codeHash": "abc123..."
|
|
116
|
+
},
|
|
117
|
+
"47c53b38-6005-4d7f-9f89-7ea56dab6b38": {
|
|
118
|
+
"nodeId": "end-node",
|
|
119
|
+
"nodeType": "end"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"lastPulledAt": "2026-06-03T08:37:53.126Z",
|
|
123
|
+
"graphFingerprint": "sha1:..."
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**每个代码节点**在 `nodes` 中必须有 `dir` + `codeFile`。
|
|
128
|
+
|
|
129
|
+
### 3.3 `node.info.json`(片段,只读)
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"_readonly": "此文件由 dazi-flow 生成,仅供查看;编辑代码请改 code.py,配置改 flow.json",
|
|
134
|
+
"node_uuid": "d96222ce-aaa9-4050-b782-830c2f2de9eb",
|
|
135
|
+
"nodeId": "n-excel01",
|
|
136
|
+
"nodeType": "excel-python",
|
|
137
|
+
"label": "Excel成本报表解析",
|
|
138
|
+
"codeFile": "code.py",
|
|
139
|
+
"codeLanguage": "python",
|
|
140
|
+
"data": {
|
|
141
|
+
"label": "Excel成本报表解析",
|
|
142
|
+
"type": "excel-python",
|
|
143
|
+
"managed_file_id": "51853ede-9e6b-4a3a-aa7a-060cbead0862",
|
|
144
|
+
"output_variable_name": "成本统计报表"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 4. 错误示例(勿模仿)
|
|
152
|
+
|
|
153
|
+
| 现象 | 原因 |
|
|
154
|
+
|------|------|
|
|
155
|
+
| `flow.json` 有 3 节点,`meta.nodes` 只有 2 条 | 手改画布未 `node new` / 未 `repair-meta` |
|
|
156
|
+
| 有 `节点/xxx/code.py` 但设计器打不开代码 | meta 无该 uuid 的 `dir` |
|
|
157
|
+
| 多次 `project push` 平台仍无 `managed_file_id` | 用了 `push` 但未加 **`--canvas`** |
|
|
158
|
+
| `node push` 无效果 | meta 无索引 → 命令 skipped |
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 5. 变更类型 → 命令
|
|
163
|
+
|
|
164
|
+
| 改了什么 | 命令 |
|
|
165
|
+
|----------|------|
|
|
166
|
+
| `managed_file_id`、`output_variable_name`、连线、增删节点 | `dazi flow project push --dir . --canvas` |
|
|
167
|
+
| `code.py` / `code.sql` | `dazi flow node push --node <uuid> --dir .` |
|
|
168
|
+
| **新增代码节点** | `dazi flow node new --type <type> --dir . --label "<名>"` → 改 `flow.json` 配置 → `push --canvas` → 写 code → `node push` |
|
|
169
|
+
| 目录不一致 | `dazi flow project repair-meta --dir .` → `doctor` |
|
|
170
|
+
|
|
171
|
+
`project push`(**无** `--canvas`)**不会**上传 `flow.json` 配置变更。
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 6. 设计器「找不到代码」
|
|
176
|
+
|
|
177
|
+
1. 执行 `dazi flow project doctor --dir .`
|
|
178
|
+
2. 若 meta 缺条目:`dazi flow project repair-meta --dir .`
|
|
179
|
+
3. 再在设计器点击「打开代码」
|
|
180
|
+
4. **勿**在本地画布多于平台时盲目 `pull`(会覆盖 `flow.json`)
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 7. 内置示例目录
|
|
185
|
+
|
|
186
|
+
扩展内置:`examples/flow/minimal-excel-python/`(`dazi docs sync` 后位于 `资源/examples/flow/`)。
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 8. 相关文档
|
|
191
|
+
|
|
192
|
+
- [流程 AI 工作手册](./ai-workflow-playbook.md)
|
|
193
|
+
- [一致性检查表](../guides/flow-consistency-checklist.md)
|
|
194
|
+
- [节点代码编写指南](./node-code-guide.md)
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
**文档 ID**: `flow/node-code-guide`
|
|
4
4
|
**适用**: `项目/flow_*/流程/<名>/节点/<节点名>/code.*`
|
|
5
|
-
**前置**: [
|
|
5
|
+
**前置**: **[流程本地文件规范](./local-files-spec.md)**(必读)、[数据流程项目开发指南](./flow-project-guide.md)、[流程变量系统指南](./variables-guide.md)
|
|
6
|
+
|
|
7
|
+
> 设计器「打开代码」依赖 `flow.meta.json` 中该节点的 `dir`+`codeFile`。若打不开,先 `dazi flow project doctor` → `repair-meta`。
|
|
6
8
|
|
|
7
9
|
---
|
|
8
10
|
|
|
@@ -10,15 +12,15 @@
|
|
|
10
12
|
|
|
11
13
|
> 完整 **14 种** 可用 `data.type`(含无代码节点)见 [flows-guide §流程节点组件](./flows-guide.md#流程节点组件)。
|
|
12
14
|
|
|
13
|
-
| 业务类型 `data.type` | 本地文件
|
|
14
|
-
|
|
15
|
-
| `sql-query`
|
|
16
|
-
| `database-source`
|
|
17
|
-
| `dataspace-source`
|
|
18
|
-
| `python-script`
|
|
19
|
-
| `excel-python`
|
|
20
|
-
| `condition`
|
|
21
|
-
| `data-quality-check` | `code.py`(键 `dqPythonCode`) | 同上
|
|
15
|
+
| 业务类型 `data.type` | 本地文件 | 平台存储 |
|
|
16
|
+
| -------------------- | ------------------------------ | ---------------------- |
|
|
17
|
+
| `sql-query` | `code.sql` | `flow_nodes.code_body` |
|
|
18
|
+
| `database-source` | `code.sql` | 同上 |
|
|
19
|
+
| `dataspace-source` | `code.sql` | 同上 |
|
|
20
|
+
| `python-script` | `code.py` | 同上 |
|
|
21
|
+
| `excel-python` | `code.py` | 同上 |
|
|
22
|
+
| `condition` | `code.py` | 同上 |
|
|
23
|
+
| `data-quality-check` | `code.py`(键 `dqPythonCode`) | 同上 |
|
|
22
24
|
|
|
23
25
|
纯配置节点(如 `database-sink`、`dataspace-sink`、`excel-import`、`delay`、`file-source` 等)**无** `code.*`,只在 `flow.json` 的 `data` 里配置;完整列表见 [flows-guide](./flows-guide.md#流程节点组件)。
|
|
24
26
|
|
|
@@ -44,13 +46,13 @@ cd "项目\flow_xxx\流程\MyFlow"
|
|
|
44
46
|
# 2. 编辑 节点/SQL查询/code.sql 等
|
|
45
47
|
|
|
46
48
|
# 3. 查看是否有本地改动
|
|
47
|
-
|
|
49
|
+
dazi flow project status
|
|
48
50
|
|
|
49
51
|
# 4. 单节点测试(会先 GET debug-run,再 POST 单节点运行)
|
|
50
|
-
|
|
52
|
+
dazi flow run node-exec --node <node_uuid> --dir .
|
|
51
53
|
|
|
52
54
|
# 5. 提交代码到平台
|
|
53
|
-
|
|
55
|
+
dazi flow node push --node <node_uuid> --dir .
|
|
54
56
|
```
|
|
55
57
|
|
|
56
58
|
`node_uuid` 在 `flow.meta.json` → `nodes.<uuid>`,或设计器属性面板、 `node.info.json` 中查看。
|
|
@@ -65,11 +67,11 @@ cd "项目\flow_xxx\流程\MyFlow"
|
|
|
65
67
|
**文件**: `code.sql`
|
|
66
68
|
**画布配置**(`flow.json` → 节点 `data`):
|
|
67
69
|
|
|
68
|
-
| 类型
|
|
69
|
-
|
|
70
|
-
| `database-source`
|
|
71
|
-
| `dataspace-source` | `spaceId`、`output_variable_name`
|
|
72
|
-
| `sql-query`
|
|
70
|
+
| 类型 | 关键字段 |
|
|
71
|
+
| ------------------ | ---------------------------------------- |
|
|
72
|
+
| `database-source` | `connectionId`、`output_variable_name` |
|
|
73
|
+
| `dataspace-source` | `spaceId`、`output_variable_name` |
|
|
74
|
+
| `sql-query` | `output_variable_name`(消费上游表变量) |
|
|
73
75
|
|
|
74
76
|
> **变量用法**:`sql-query` 在 SQL 里把 **上游 `output_variable_name`** 当作 **表名**;`database-source` / `dataspace-source` 只 **产出** 变量、不消费 Run 内变量。详见 [流程变量系统指南 §6.1–6.2](./variables-guide.md#61-sql-queryduckdb-内存-sql)。
|
|
75
77
|
|
|
@@ -135,14 +137,14 @@ JOIN customers c ON o.customer_id = c.customer_id;
|
|
|
135
137
|
|
|
136
138
|
**运行时注入**
|
|
137
139
|
|
|
138
|
-
| 符号
|
|
139
|
-
|
|
140
|
-
| `pd`
|
|
141
|
-
| `df`
|
|
142
|
-
| `get_variable("名")`
|
|
143
|
-
| `set_table_output(name, df)` | 多表输出
|
|
144
|
-
| `result_df`
|
|
145
|
-
| `output.print(...)`
|
|
140
|
+
| 符号 | 说明 |
|
|
141
|
+
| ---------------------------- | -------------------------------------------------- |
|
|
142
|
+
| `pd` | pandas |
|
|
143
|
+
| `df` | 来自入边 Parquet(整图跑时通常非空) |
|
|
144
|
+
| `get_variable("名")` | 从调试 Run 读上游表(**单节点测试时优先用这个**) |
|
|
145
|
+
| `set_table_output(name, df)` | 多表输出 |
|
|
146
|
+
| `result_df` | 主输出 DataFrame(与 `output_variable_name` 对应) |
|
|
147
|
+
| `output.print(...)` | 运行日志(**勿用裸 `print`**) |
|
|
146
148
|
|
|
147
149
|
**单节点测试要点**
|
|
148
150
|
|
|
@@ -189,32 +191,32 @@ set_table_output("merged_preview", result_df.head(100)) # 可选附加表
|
|
|
189
191
|
**文件**: `code.py`
|
|
190
192
|
**画布**(`flow.json` → 节点 `data`,**不是写在 code.py 里**):
|
|
191
193
|
|
|
192
|
-
| 字段
|
|
193
|
-
|
|
194
|
-
| **`managed_file_id`**
|
|
195
|
-
| **`output_variable_name`** | 主输出表变量名;**必须与** `set_table_output` 第一个参数 **完全一致**
|
|
194
|
+
| 字段 | 说明 |
|
|
195
|
+
| -------------------------- | ------------------------------------------------------------------------------------------- |
|
|
196
|
+
| **`managed_file_id`** | 平台「文件上传管理」登记的 **UUID**(见 `资源/files/<名>_<id8>/文件信息.json` → `file_id`) |
|
|
197
|
+
| **`output_variable_name`** | 主输出表变量名;**必须与** `set_table_output` 第一个参数 **完全一致** |
|
|
196
198
|
|
|
197
199
|
### 分工(AI 必守)
|
|
198
200
|
|
|
199
|
-
| 谁配置
|
|
200
|
-
|
|
201
|
-
| **`flow.json` / 设计器** | `managed_file_id` = UUID
|
|
202
|
-
| **`code.py`**
|
|
201
|
+
| 谁配置 | 配什么 | 禁止 |
|
|
202
|
+
| ------------------------ | ----------------------------------- | -------------------------------------------------------------- |
|
|
203
|
+
| **`flow.json` / 设计器** | `managed_file_id` = UUID | 不要用文件名、相对路径、data upload 的 `id` |
|
|
204
|
+
| **`code.py`** | 用 **`excel_source_path`** 读 Excel | 不要 `open("xxx.xlsx")`、`pd.read_excel("D:/...")`、不要猜路径 |
|
|
203
205
|
|
|
204
206
|
引擎根据 `managed_file_id` 查库得到物理路径,执行前注入:
|
|
205
207
|
|
|
206
|
-
| 变量
|
|
207
|
-
|
|
208
|
-
| **`excel_source_path`**
|
|
209
|
-
| **`excel_original_filename`** | 登记显示名(仅用于 `output.print` 日志)
|
|
210
|
-
| `pd`
|
|
211
|
-
| `set_table_output(name, df)`
|
|
212
|
-
| `output.print(...)`
|
|
208
|
+
| 变量 | 说明 |
|
|
209
|
+
| ----------------------------- | ----------------------------------------------------------- |
|
|
210
|
+
| **`excel_source_path`** | 服务端 Excel **绝对路径**(代码里唯一正确的读文件方式) |
|
|
211
|
+
| **`excel_original_filename`** | 登记显示名(仅用于 `output.print` 日志) |
|
|
212
|
+
| `pd` | pandas |
|
|
213
|
+
| `set_table_output(name, df)` | 产出表变量(**必须**调用,主表名 = `output_variable_name`) |
|
|
214
|
+
| `output.print(...)` | 运行日志 |
|
|
213
215
|
|
|
214
216
|
**获取 `managed_file_id`**
|
|
215
217
|
|
|
216
218
|
1. 侧栏 **数据资源 → 文件上传管理** → 拉取到 `资源/files/.../文件信息.json`
|
|
217
|
-
2. 或 CLI
|
|
219
|
+
2. 或 CLI:`dazi flow managed-files list` / `managed-files pull --file-id <uuid>`
|
|
218
220
|
|
|
219
221
|
**`flow.json` 示例(画布配置)**
|
|
220
222
|
|
|
@@ -348,13 +350,13 @@ result_df = pd.read_excel(excel_source_path)
|
|
|
348
350
|
|
|
349
351
|
**注入**
|
|
350
352
|
|
|
351
|
-
| 符号
|
|
352
|
-
|
|
353
|
-
| `df`
|
|
354
|
-
| `get_variable("名")`
|
|
355
|
-
| `quality_config`
|
|
356
|
-
| `set_scalar_output(name, value)` | 综合分等标量
|
|
357
|
-
| `result_df`
|
|
353
|
+
| 符号 | 说明 |
|
|
354
|
+
| -------------------------------- | ------------------------------ |
|
|
355
|
+
| `df` | 入边 Parquet;单节点时可能为空 |
|
|
356
|
+
| `get_variable("名")` | 调试 Run 中的附加表 |
|
|
357
|
+
| `quality_config` | 与画布 `qualityConfig` 对齐 |
|
|
358
|
+
| `set_scalar_output(name, value)` | 综合分等标量 |
|
|
359
|
+
| `result_df` | 质检报告表 |
|
|
358
360
|
|
|
359
361
|
**推荐**:`df.empty` 时用 `get_variable` 补主表(变量名与 `attached_variables` / 上游输出一致)。
|
|
360
362
|
|
|
@@ -364,10 +366,10 @@ result_df = pd.read_excel(excel_source_path)
|
|
|
364
366
|
|
|
365
367
|
## 8. 画布配置 vs 代码分工
|
|
366
368
|
|
|
367
|
-
| 改什么
|
|
368
|
-
|
|
369
|
-
| SQL / Python 正文
|
|
370
|
-
| 连线、坐标、节点增删
|
|
369
|
+
| 改什么 | 改哪里 | 怎么提交 |
|
|
370
|
+
| ---------------------------------------- | ------------------------ | ----------------------- |
|
|
371
|
+
| SQL / Python 正文 | `code.sql` / `code.py` | `node push` |
|
|
372
|
+
| 连线、坐标、节点增删 | `flow.json`(设计器) | `project push --canvas` |
|
|
371
373
|
| connectionId、表名、output_variable_name | 设计器属性 → `flow.json` | `project push --canvas` |
|
|
372
374
|
|
|
373
375
|
**不要**在 `flow.json` 里硬塞大段 `pythonCode`/`sql`:pull 会剥离到 `code.*`,push 代码走 `flow-nodes` 接口。
|
|
@@ -380,10 +382,10 @@ result_df = pd.read_excel(excel_source_path)
|
|
|
380
382
|
|
|
381
383
|
```powershell
|
|
382
384
|
# 拉取单个变量(schema + 前 10 行)到 变量/<name>.json
|
|
383
|
-
|
|
385
|
+
dazi flow variable pull --name sales_df --dir .
|
|
384
386
|
|
|
385
387
|
# 同步全部调试变量
|
|
386
|
-
|
|
388
|
+
dazi flow variable sync --dir .
|
|
387
389
|
```
|
|
388
390
|
|
|
389
391
|
设计器:选中节点 → 属性 **`output_variable_name`** → 点击 **📊**。
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**文档 ID**: `flow/run-guide`
|
|
4
4
|
|
|
5
|
-
**命令前缀**(`dazi-work`
|
|
5
|
+
**命令前缀**(`dazi-work` 根):`dazi flow …`
|
|
6
6
|
**流程项目**:在 `项目/flow_*/流程/<名>/` 下执行,或使用 `--dir <流程目录>`。
|
|
7
7
|
|
|
8
8
|
---
|
|
@@ -13,26 +13,26 @@
|
|
|
13
13
|
cd "项目\flow_xxx\流程\MyFlow"
|
|
14
14
|
|
|
15
15
|
# 按 node_uuid 测试(CLI 内部翻译为语义 nodeId)
|
|
16
|
-
|
|
16
|
+
dazi flow run node-exec --node <node_uuid> --dir .
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
**行为**
|
|
20
20
|
|
|
21
|
-
1. `GET /flows/{id}/debug-run` — 确保 `ads_flows.debug_run_id` 已绑定调试 Run
|
|
22
|
-
2. `POST /flows/{id}/nodes/{nodeId}/run` — 执行单节点
|
|
23
|
-
3. 成功时同步该节点 `output_variable_name` 到 **`变量/<名>.json`**
|
|
21
|
+
1. `GET /flows/{id}/debug-run` — 确保 `ads_flows.debug_run_id` 已绑定调试 Run
|
|
22
|
+
2. `POST /flows/{id}/nodes/{nodeId}/run` — 执行单节点
|
|
23
|
+
3. 成功时同步该节点 `output_variable_name` 到 **`变量/<名>.json`**
|
|
24
24
|
4. 失败时写入 **`_run/<节点名>.last-error.md`**(扩展会自动打开)
|
|
25
25
|
|
|
26
|
-
扩展:右键 **节点/** 或 **code
|
|
26
|
+
扩展:右键 **节点/** 或 **code.\*** → **测试运行节点**。
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
30
30
|
## 2. 流程项目:整流程运行
|
|
31
31
|
|
|
32
32
|
```powershell
|
|
33
|
-
|
|
33
|
+
dazi flow run flow-exec --dir . --type debug
|
|
34
34
|
# preview:清空调试变量后全新运行
|
|
35
|
-
|
|
35
|
+
dazi flow run flow-exec --dir . --type preview
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
成功后 **`flow variable sync`** 同步全部变量到 `变量/` 目录。
|
|
@@ -48,10 +48,10 @@ cd "项目\flow_xxx\流程\MyFlow"
|
|
|
48
48
|
|
|
49
49
|
```powershell
|
|
50
50
|
# 拉取单个变量(schema + 前 10 行)→ 变量/<name>.json
|
|
51
|
-
|
|
51
|
+
dazi flow variable pull --name sales_df --dir .
|
|
52
52
|
|
|
53
53
|
# 同步全部调试 Run 变量
|
|
54
|
-
|
|
54
|
+
dazi flow variable sync --dir .
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
设计器:节点 **`output_variable_name`** 旁 **📊** 按钮。
|
|
@@ -64,16 +64,16 @@ cd "项目\flow_xxx\流程\MyFlow"
|
|
|
64
64
|
|
|
65
65
|
```powershell
|
|
66
66
|
# 启动 Run
|
|
67
|
-
|
|
67
|
+
dazi flow run start <flow-id> --input '{}'
|
|
68
68
|
|
|
69
69
|
# 列表
|
|
70
|
-
|
|
70
|
+
dazi flow run list <flow-id> --limit 10
|
|
71
71
|
|
|
72
72
|
# 调试信息(最近 Run)
|
|
73
|
-
|
|
73
|
+
dazi flow run debug <flow-id>
|
|
74
74
|
|
|
75
75
|
# 变量列表(需 --flow)
|
|
76
|
-
|
|
76
|
+
dazi flow run variables-list <runId> --flow <flow-id>
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
流程项目日常开发优先用 **§1–§3** 的 `node-exec` / `flow-exec` / `variable pull`。
|
|
@@ -84,7 +84,7 @@ cd "项目\flow_xxx\流程\MyFlow"
|
|
|
84
84
|
|
|
85
85
|
```powershell
|
|
86
86
|
# 拉取 failure-bundle 落盘
|
|
87
|
-
|
|
87
|
+
dazi flow run failure --run <runId> --dir .
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
流程项目测试失败时,优先看 **`_run/*.last-error.md`**(含错误分类:缺上游变量、配置缺失、代码错误等)。
|
|
@@ -93,6 +93,6 @@ cd "项目\flow_xxx\流程\MyFlow"
|
|
|
93
93
|
|
|
94
94
|
## 6. 相关文档
|
|
95
95
|
|
|
96
|
-
- [流程变量系统指南](./variables-guide.md) — 变量模型与代码示例
|
|
97
|
-
- [数据流程项目开发指南](./flow-project-guide.md) — debug_run_id、开发循环
|
|
98
|
-
- [节点代码编写指南](./node-code-guide.md) — 单节点脚本约定
|
|
96
|
+
- [流程变量系统指南](./variables-guide.md) — 变量模型与代码示例
|
|
97
|
+
- [数据流程项目开发指南](./flow-project-guide.md) — debug_run_id、开发循环
|
|
98
|
+
- [节点代码编写指南](./node-code-guide.md) — 单节点脚本约定
|