Skip to content

Commit bda12ff

Browse files
authored
fix: handle the bug of wrong dag_parant index (#996)
* fix the dag_parant_index bug caused by the wrong calling order of * auto-lint
1 parent b116807 commit bda12ff

File tree

1 file changed

+8
-6
lines changed
  • rdagent/scenarios/data_science

1 file changed

+8
-6
lines changed

rdagent/scenarios/data_science/loop.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ def record(self, prev_out: dict[str, Any]):
222222
e = prev_out.get(self.EXCEPTION_KEY, None)
223223
if e is None:
224224
exp = prev_out["running"]
225-
self.trace.hist.append((exp, prev_out["feedback"]))
226225

227226
# NOTE: we put below operations on selections here, instead of out of the if-else block,
228227
# to fit the corner case that the trace will be reset
@@ -232,20 +231,23 @@ def record(self, prev_out: dict[str, Any]):
232231
self.trace.set_current_selection(exp.local_selection)
233232
self.trace.sync_dag_parent_and_hist()
234233

234+
self.trace.hist.append((exp, prev_out["feedback"]))
235+
235236
else:
236237
exp: DSExperiment = prev_out["direct_exp_gen"] if isinstance(e, CoderError) else prev_out["coding"]
238+
239+
# set the local selection to the trace as global selection, then set the DAG parent for the trace
240+
if exp.local_selection is not None:
241+
self.trace.set_current_selection(exp.local_selection)
242+
self.trace.sync_dag_parent_and_hist()
243+
237244
self.trace.hist.append(
238245
(
239246
exp,
240247
ExperimentFeedback.from_exception(e),
241248
)
242249
)
243250

244-
# set the local selection to the trace as global selection, then set the DAG parent for the trace
245-
if exp.local_selection is not None:
246-
self.trace.set_current_selection(exp.local_selection)
247-
self.trace.sync_dag_parent_and_hist()
248-
249251
if self.trace.sota_experiment() is None:
250252
if DS_RD_SETTING.coder_on_whole_pipeline:
251253
# check if feedback is not generated

0 commit comments

Comments
 (0)