From 213971582979c85a3eb464168d96bd1e736cfb9d Mon Sep 17 00:00:00 2001 From: DXC Date: Thu, 4 Jun 2026 10:38:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(runner):=20step5=20=E4=B8=A5=E6=A0=BC?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=20step4=20=E4=BA=A7=E7=89=A9=20+=20=E6=8B=92?= =?UTF-8?q?=E7=BB=9D=E9=9D=99=E9=BB=98=E8=B7=B3=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - step5.requires 加入 processed_csv_path(step4 产物) 并显式 parameter_map 到 csv_path 形参;step5.skip_when_missing=False 配合 Facade **kwargs 兜底 - parameter_map 双向映射规避 L2 顺序注入冲突: processed_csv_path→csv_path(主), csv_path→_raw_csv_ignored(占位, 落 **kwargs) - PipelineRunner.run() skip_when_missing 块新增 _notify 通知, 让 GUI 知道具体缺了什么(拒绝静默跳过) --- src/core/pipeline/runner.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/core/pipeline/runner.py b/src/core/pipeline/runner.py index 4999b71..6b46269 100644 --- a/src/core/pipeline/runner.py +++ b/src/core/pipeline/runner.py @@ -67,8 +67,18 @@ PIPELINE_STEPS: List[StepSpec] = [ ), StepSpec( step_id="step5", method_name="step5_extract_training_spectra", - requires=["deglint_img_path", "csv_path", "boundary_path", "glint_mask_path"], + requires=["deglint_img_path", "processed_csv_path", "csv_path", "boundary_path", "glint_mask_path"], produces=["training_csv_path"], + # processed_csv_path(step4 产物) 才是 step5 真正需要的主路径, + # 通过 parameter_map 显式映射到形参 csv_path。 + # raw csv_path 也保留在 requires 中以备 user_config 覆盖, + # 但用占位名 _raw_csv_ignored 注入,落到 step5 形参列表末尾的 **kwargs 兜底。 + # 这样可以避免 L2 顺序注入中"后注入的 csv_path=None 覆盖前面的 processed_csv_path"的冲突。 + parameter_map={ + "processed_csv_path": "csv_path", + "csv_path": "_raw_csv_ignored", + }, + skip_when_missing=False, description="实测样本点光谱提取", ), StepSpec( @@ -157,9 +167,10 @@ class PipelineRunner: missing = [k for k in spec.requires if not ctx.get(k)] if missing: ctx.status[spec.step_id] = "skipped" - ctx.append_log( - f"[RUNNER] {spec.step_id} 缺少入参: {missing},跳过" - ) + reason = f"缺少必要的上下文参数,自动跳过: {missing}" + ctx.append_log(f"[RUNNER] {spec.step_id} {reason}") + if hasattr(self.pipeline, "_notify"): + self.pipeline._notify(spec.description, "skipped", reason) continue self._invoke(spec, ctx) ctx.pipeline_end_time = time.time()