Github开源生信云平台 DEMO
edges
input_connections
下面我将用工程化视角 + Galaxy 内部原理给你解释:
Galaxy 的 DAG 不是用 edges 数组保存的,而是靠:
例如:
"input_connections": { "single_paired|in1": { "id": 0, "output_name": "output" } }
这行就表示:
step 2 (fastp) — its input[in1] → 来自 step 0 的 output
Galaxy 的 边(edge) 就隐含在:
每个节点 step.input_connections[*]
因此 Galaxy 的真正 DAG 是:
edges = [] for each step: for each (input → upstreamStepId) in step.input_connections: edges.append({from: upstreamStepId, to: step.id, ... })
换句话说:Galaxy 的 edges 在数据结构内部是隐式的,而不是一个显式 edges 数组。这是为了:
来看两种设计方案:
{ "nodes": [...], "edges": [ { "from": "a", "to": "b", "out": "html", "in": "input1" } ] }
优点:
缺点:
{ "steps": { "2": { "input_connections": { "in1": { "id": "0", "output_name": "output" } } } } }
这是最成熟、工程化最佳的方案:
🔥 这个方案同时获得两者的优点。
CREATE TABLE scripts ( id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, version VARCHAR(50), description TEXT, form_schema JSONB NOT NULL, -- UI 参数表单 input_io_schema JSONB NOT NULL, -- 输入结构定义 output_io_schema JSONB NOT NULL, -- 输出结构定义 command_template TEXT NOT NULL, -- 执行命令模板 docker_image VARCHAR(255), -- 运行环境 resources JSONB, -- CPU/内存等默认设置 created_at TIMESTAMP, updated_at TIMESTAMP );
CREATE TABLE workflows ( id SERIAL PRIMARY KEY, name VARCHAR(255), description TEXT, version INT DEFAULT 1, created_at TIMESTAMP, updated_at TIMESTAMP );
CREATE TABLE workflow_steps ( id SERIAL PRIMARY KEY, workflow_id INT, script_id INT, position JSONB, -- {x,y} 用于UI params JSONB, -- 参数值 input_connections JSONB, -- Galaxy 风格 UNIQUE(workflow_id, id) );
{ "name": "RNA-seq QC", "steps": { "1": { "script_id": 15, "params": {...}, "input_connections": { "reads1": { "step_id": "0", "output": "fastq" } } } } }
它就隐式地定义了 DAG。
后台执行时:
build_graph_from_input_connections() topological_sort() execute()
✔ Galaxy 模式隐藏 edges 是 专业工作流系统最常见的方式✔ 你如果同时需要拖拽 UI → 可以使用“UI 层 edges + 存储层 input_connections”设计✔ 工程化执行引擎使用 Galaxy 风格 更简单,最少冗余数据
📌 最终答案:Galaxy 模型更适合生产级流程执行器,而 edges 更适合前端 UI 编辑器。你应当两个都使用,各司其职。
如果你愿意,我可以继续给你:
✅ 完整 React 拖拽节点示例(React Flow)✅ edges → input_connections 转换代码✅ Python 流程执行引擎(执行、调度、缓存、中间文件)✅ 跨节点文件传递(cache / store / outputs)✅ 整个 BRAVE(你的 pipeline 系统)流程架构图
需要哪个?