@@ -222,7 +222,6 @@ def record(self, prev_out: dict[str, Any]):
222
222
e = prev_out .get (self .EXCEPTION_KEY , None )
223
223
if e is None :
224
224
exp = prev_out ["running" ]
225
- self .trace .hist .append ((exp , prev_out ["feedback" ]))
226
225
227
226
# NOTE: we put below operations on selections here, instead of out of the if-else block,
228
227
# to fit the corner case that the trace will be reset
@@ -232,20 +231,23 @@ def record(self, prev_out: dict[str, Any]):
232
231
self .trace .set_current_selection (exp .local_selection )
233
232
self .trace .sync_dag_parent_and_hist ()
234
233
234
+ self .trace .hist .append ((exp , prev_out ["feedback" ]))
235
+
235
236
else :
236
237
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
+
237
244
self .trace .hist .append (
238
245
(
239
246
exp ,
240
247
ExperimentFeedback .from_exception (e ),
241
248
)
242
249
)
243
250
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
-
249
251
if self .trace .sota_experiment () is None :
250
252
if DS_RD_SETTING .coder_on_whole_pipeline :
251
253
# check if feedback is not generated
0 commit comments