fix: 修复下游面板自动填充断裂的三处根因 + 清理过时 pipeline→panel 映射
This commit is contained in:
@ -25,9 +25,9 @@ class WorkspaceManager:
|
||||
|
||||
def __init__(self):
|
||||
self.step_default_outputs = {
|
||||
'step1': {'water_mask': "1_water_mask/water_mask_from_ndwi.dat"},
|
||||
'step1': {'water_mask': "1_water_mask/water_mask_out.dat"},
|
||||
'step2': {'glint_mask': "2_Glint_Detection/severe_glint_area.dat"},
|
||||
'step3': {'deglint_image': "3_deglint/deglint_goodman.bsq"},
|
||||
'step3': {'deglint_image': "3_deglint/deglint_image.bsq"},
|
||||
'step4_sampling': {'sampling_points': "4_sampling/sampling_spectra.csv"},
|
||||
'step5_clean': {'processed_data': "5_Data_Cleaning/processed_data.csv"},
|
||||
'step6_feature': {'training_spectra': "6_Spectral_Feature_Extraction/training_spectra.csv"},
|
||||
@ -38,12 +38,6 @@ class WorkspaceManager:
|
||||
'step11_map': {'14_visualization': "14_visualization/"},
|
||||
}
|
||||
self.step_outputs = {}
|
||||
# pipeline step_id → panel step_id 映射(由 WaterQualityGUI 注入)
|
||||
self._pipeline_to_panel = {}
|
||||
|
||||
def set_step_id_mapping(self, mapping: dict):
|
||||
"""注入 pipeline step_id → panel step_id 映射,用于事件发布时统一 ID。"""
|
||||
self._pipeline_to_panel = mapping
|
||||
|
||||
def _publish_outputs(self, step_id: str, outputs: dict):
|
||||
"""将发现的产出发布到 EventBus。
|
||||
@ -206,18 +200,11 @@ class WorkspaceManager:
|
||||
return discovered_outputs
|
||||
|
||||
def update_step_outputs(self, step_name, work_path):
|
||||
"""更新指定步骤的输出路径记录并发布 EventBus 事件。
|
||||
|
||||
step_name 可能是 pipeline step_id(如 'step4'),
|
||||
会先通过 _pipeline_to_panel 映射为面板 step_id(如 'step5_clean')。
|
||||
"""
|
||||
# 映射 pipeline step_id → panel step_id
|
||||
panel_step_id = self._pipeline_to_panel.get(step_name, step_name)
|
||||
|
||||
if panel_step_id not in self.step_default_outputs:
|
||||
"""更新指定步骤的输出路径记录并发布 EventBus 事件。"""
|
||||
if step_name not in self.step_default_outputs:
|
||||
return
|
||||
|
||||
step_outputs = self.step_default_outputs[panel_step_id]
|
||||
step_outputs = self.step_default_outputs[step_name]
|
||||
published = {}
|
||||
|
||||
for output_type, relative_path in step_outputs.items():
|
||||
@ -227,17 +214,17 @@ class WorkspaceManager:
|
||||
if matching_files:
|
||||
latest_file = max(matching_files, key=lambda p: p.stat().st_mtime)
|
||||
path_str = str(latest_file)
|
||||
self.step_outputs.setdefault(panel_step_id, {})[output_type] = path_str
|
||||
self.step_outputs.setdefault(step_name, {})[output_type] = path_str
|
||||
published[output_type] = path_str
|
||||
else:
|
||||
output_path = work_path / relative_path
|
||||
if output_path.exists():
|
||||
path_str = str(output_path)
|
||||
self.step_outputs.setdefault(panel_step_id, {})[output_type] = path_str
|
||||
self.step_outputs.setdefault(step_name, {})[output_type] = path_str
|
||||
published[output_type] = path_str
|
||||
|
||||
if published:
|
||||
self._publish_outputs(panel_step_id, published)
|
||||
self._publish_outputs(step_name, published)
|
||||
|
||||
@staticmethod
|
||||
def prune_config_for_prediction_mode(config: dict) -> dict:
|
||||
|
||||
Reference in New Issue
Block a user